Source
zbx_get_pid_file_pathname_f get_pid_file_cb, zbx_on_exit_t zbx_on_exit_cb_arg, int config_log_type,
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static int parent_pid = -1;
/* pointer to function for getting caller's PID file location */
static zbx_get_pid_file_pathname_f get_pid_file_pathname_cb = NULL;
extern pid_t *threads;
extern int threads_num;
extern int get_process_info_by_thread(int local_server_num, unsigned char *local_process_type,
int *local_process_num);
static zbx_signal_handler_f sigusr_handler;
static zbx_signal_redirect_f signal_redirect_handler;
/******************************************************************************
* *
* Purpose: common SIGUSR1 handler for Zabbix processes *
* *
******************************************************************************/
static void common_sigusr_handler(int flags)
{
switch (ZBX_RTC_GET_MSG(flags))
{
case ZBX_RTC_LOG_LEVEL_INCREASE:
zabbix_increase_log_level();
break;
case ZBX_RTC_PROF_ENABLE:
zbx_prof_enable(ZBX_RTC_GET_SCOPE(flags));
break;
case ZBX_RTC_PROF_DISABLE:
zbx_prof_disable();
break;
case ZBX_RTC_LOG_LEVEL_DECREASE:
zabbix_decrease_log_level();
break;
default:
if (NULL != sigusr_handler)
sigusr_handler(flags);
break;
}
}
void zbx_signal_process_by_type(int proc_type, int proc_num, int flags, char **out)
{
int process_num, found = 0, i, failed_num = 0;
union sigval s;
unsigned char process_type;
size_t out_alloc = 0, out_offset = 0;
s.sival_ptr = NULL;
s.ZBX_SIVAL_INT = flags;
for (i = 0; i < threads_num; i++)
{
if (FAIL == get_process_info_by_thread(i + 1, &process_type, &process_num))