Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/threads.h6
-rw-r--r--src/libs/zbxself/selfmon.c4
-rw-r--r--src/libs/zbxsys/threads.c1
-rw-r--r--src/zabbix_agent/active.c6
-rw-r--r--src/zabbix_agent/listener.c6
-rw-r--r--src/zabbix_agent/stats.c2
-rw-r--r--src/zabbix_agent/zabbix_agentd.c31
-rw-r--r--src/zabbix_proxy/datasender/datasender.c6
-rw-r--r--src/zabbix_proxy/heart/heart.c6
-rw-r--r--src/zabbix_proxy/proxy.c6
-rw-r--r--src/zabbix_proxy/proxyconfig/proxyconfig.c6
-rw-r--r--src/zabbix_sender/zabbix_sender.c2
-rw-r--r--src/zabbix_server/alerter/alerter.c6
-rw-r--r--src/zabbix_server/dbconfig/dbconfig.c6
-rw-r--r--src/zabbix_server/dbsyncer/dbsyncer.c6
-rw-r--r--src/zabbix_server/discoverer/discoverer.c6
-rw-r--r--src/zabbix_server/escalator/escalator.c6
-rw-r--r--src/zabbix_server/housekeeper/housekeeper.c6
-rw-r--r--src/zabbix_server/httppoller/httppoller.c6
-rw-r--r--src/zabbix_server/pinger/pinger.c6
-rw-r--r--src/zabbix_server/poller/poller.c6
-rw-r--r--src/zabbix_server/proxypoller/proxypoller.c6
-rw-r--r--src/zabbix_server/selfmon/selfmon.c6
-rw-r--r--src/zabbix_server/server.c6
-rw-r--r--src/zabbix_server/snmptrapper/snmptrapper.c6
-rw-r--r--src/zabbix_server/timer/timer.c6
-rw-r--r--src/zabbix_server/trapper/trapper.c9
-rw-r--r--src/zabbix_server/vmware/vmware.c6
-rw-r--r--src/zabbix_server/watchdog/watchdog.c6
29 files changed, 93 insertions, 94 deletions
diff --git a/include/threads.h b/include/threads.h
index 6f3479a6514..af78924054f 100644
--- a/include/threads.h
+++ b/include/threads.h
@@ -74,9 +74,9 @@
typedef struct
{
- int thread_num; /* number of thread in a group of all agent threads */
- int process_num; /* number of thread in a specific group of threads (e.g. listeners) */
- unsigned char process_type; /* type of thread */
+ int server_num;
+ int process_num;
+ unsigned char process_type;
void *args;
}
zbx_thread_args_t;
diff --git a/src/libs/zbxself/selfmon.c b/src/libs/zbxself/selfmon.c
index 7f0fd6f7eae..04beb9d0957 100644
--- a/src/libs/zbxself/selfmon.c
+++ b/src/libs/zbxself/selfmon.c
@@ -137,7 +137,7 @@ int get_process_type_forks(unsigned char proc_type)
}
THIS_SHOULD_NEVER_HAPPEN;
- exit(FAIL);
+ exit(EXIT_FAILURE);
}
/******************************************************************************
@@ -203,7 +203,7 @@ const char *get_process_type_string(unsigned char proc_type)
}
THIS_SHOULD_NEVER_HAPPEN;
- exit(FAIL);
+ exit(EXIT_FAILURE);
}
int get_process_type_by_name(const char *proc_type_str)
diff --git a/src/libs/zbxsys/threads.c b/src/libs/zbxsys/threads.c
index 5513902d655..d0ee368da24 100644
--- a/src/libs/zbxsys/threads.c
+++ b/src/libs/zbxsys/threads.c
@@ -98,7 +98,6 @@ ZBX_THREAD_HANDLE zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), zbx_thread
}
#else
-
if (0 == (thread = zbx_child_fork())) /* child process */
{
(*handler)(thread_args);
diff --git a/src/zabbix_agent/active.c b/src/zabbix_agent/active.c
index 9f4c68b1ab2..9b51f9a5800 100644
--- a/src/zabbix_agent/active.c
+++ b/src/zabbix_agent/active.c
@@ -1327,7 +1327,7 @@ ZBX_THREAD_ENTRY(active_checks_thread, args)
{
ZBX_THREAD_ACTIVECHK_ARGS activechk_args;
- int nextcheck = 0, nextrefresh = 0, nextsend = 0, thread_num, process_num;
+ int nextcheck = 0, nextrefresh = 0, nextsend = 0, server_num, process_num;
#ifndef _WINDOWS
sigset_t mask, orig_mask;
#endif
@@ -1337,10 +1337,10 @@ ZBX_THREAD_ENTRY(active_checks_thread, args)
process_type = ZBX_AGENT_PROCESS_TYPE_ACTIVE_CHECKS;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
- zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [active checks #%d]", thread_num, process_num);
+ zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [active checks #%d]", server_num, process_num);
activechk_args.host = zbx_strdup(NULL, ((ZBX_THREAD_ACTIVECHK_ARGS *)((zbx_thread_args_t *)args)->args)->host);
activechk_args.port = ((ZBX_THREAD_ACTIVECHK_ARGS *)((zbx_thread_args_t *)args)->args)->port;
diff --git a/src/zabbix_agent/listener.c b/src/zabbix_agent/listener.c
index 369816ffd66..1090351b334 100644
--- a/src/zabbix_agent/listener.c
+++ b/src/zabbix_agent/listener.c
@@ -69,7 +69,7 @@ static void process_listener(zbx_sock_t *s)
ZBX_THREAD_ENTRY(listener_thread, args)
{
- int ret, local_request_failed = 0, thread_num, process_num;
+ int ret, local_request_failed = 0, server_num, process_num;
zbx_sock_t s;
#ifndef _WINDOWS
sigset_t mask, orig_mask;
@@ -80,10 +80,10 @@ ZBX_THREAD_ENTRY(listener_thread, args)
process_type = ZBX_AGENT_PROCESS_TYPE_LISTENER;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
- zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [listener #%d]", thread_num, process_num);
+ zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [listener #%d]", server_num, process_num);
memcpy(&s, (zbx_sock_t *)((zbx_thread_args_t *)args)->args, sizeof(zbx_sock_t));
diff --git a/src/zabbix_agent/stats.c b/src/zabbix_agent/stats.c
index 11296875c33..2d93ab153de 100644
--- a/src/zabbix_agent/stats.c
+++ b/src/zabbix_agent/stats.c
@@ -423,7 +423,7 @@ ZBX_THREAD_ENTRY(collector_thread, args)
process_type = ZBX_AGENT_PROCESS_TYPE_COLLECTOR;
- zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [collector]", ((zbx_thread_args_t *)args)->thread_num);
+ zabbix_log(LOG_LEVEL_INFORMATION, "agent #%d started [collector]", ((zbx_thread_args_t *)args)->server_num);
zbx_free(args);
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index e72fca41a3f..2836c7cf1e2 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -572,7 +572,7 @@ int MAIN_ZABBIX_ENTRY()
{
zbx_thread_args_t *thread_args;
zbx_sock_t listen_sock;
- int i, thread_num = 0;
+ int i, server_num = 0;
#ifdef _WINDOWS
DWORD res;
#endif
@@ -599,7 +599,7 @@ int MAIN_ZABBIX_ENTRY()
if (FAIL == zbx_tcp_listen(&listen_sock, CONFIG_LISTEN_IP, (unsigned short)CONFIG_LISTEN_PORT))
{
zabbix_log(LOG_LEVEL_CRIT, "listener failed: %s", zbx_tcp_strerror());
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -614,7 +614,7 @@ int MAIN_ZABBIX_ENTRY()
/* --- START THREADS ---*/
/* allocate memory for a collector, all listeners and an active check */
- threads_num = 1 + CONFIG_PASSIVE_FORKS + CONFIG_ACTIVE_FORKS;
+ threads_num = CONFIG_COLLECTOR_FORKS + CONFIG_PASSIVE_FORKS + CONFIG_ACTIVE_FORKS;
#ifdef _WINDOWS
if (MAXIMUM_WAIT_OBJECTS < threads_num)
@@ -629,29 +629,29 @@ int MAIN_ZABBIX_ENTRY()
/* start the collector thread */
thread_args = (zbx_thread_args_t *)zbx_malloc(NULL, sizeof(zbx_thread_args_t));
- thread_args->thread_num = thread_num;
+ thread_args->server_num = server_num;
thread_args->process_num = 1;
thread_args->args = NULL;
- threads[thread_num++] = zbx_thread_start(collector_thread, thread_args);
+ threads[server_num++] = zbx_thread_start(collector_thread, thread_args);
/* start listeners */
for (i = 0; i < CONFIG_PASSIVE_FORKS; i++)
{
thread_args = (zbx_thread_args_t *)zbx_malloc(NULL, sizeof(zbx_thread_args_t));
- thread_args->thread_num = thread_num;
+ thread_args->server_num = server_num;
thread_args->process_num = i + 1;
thread_args->args = &listen_sock;
- threads[thread_num++] = zbx_thread_start(listener_thread, thread_args);
+ threads[server_num++] = zbx_thread_start(listener_thread, thread_args);
}
/* start active check */
for (i = 0; i < CONFIG_ACTIVE_FORKS; i++)
{
thread_args = (zbx_thread_args_t *)zbx_malloc(NULL, sizeof(zbx_thread_args_t));
- thread_args->thread_num = thread_num;
+ thread_args->server_num = server_num;
thread_args->process_num = i + 1;
thread_args->args = &CONFIG_ACTIVE_ARGS[i];
- threads[thread_num++] = zbx_thread_start(active_checks_thread, thread_args);
+ threads[server_num++] = zbx_thread_start(active_checks_thread, thread_args);
}
#ifdef _WINDOWS
@@ -797,7 +797,7 @@ int get_process_type_forks(unsigned char proc_type)
}
THIS_SHOULD_NEVER_HAPPEN;
- exit(FAIL);
+ exit(EXIT_FAILURE);
}
const char *get_process_type_string(unsigned char proc_type)
@@ -813,7 +813,7 @@ const char *get_process_type_string(unsigned char proc_type)
}
THIS_SHOULD_NEVER_HAPPEN;
- exit(FAIL);
+ exit(EXIT_FAILURE);
}
void get_process_info_by_thread(int server_num, int *process_type, int *process_num)
@@ -822,23 +822,24 @@ void get_process_info_by_thread(int server_num, int *process_type, int *process_
if (server_num <= (server_count += CONFIG_COLLECTOR_FORKS))
{
- *process_num = server_num - server_count + CONFIG_COLLECTOR_FORKS;
*process_type = ZBX_AGENT_PROCESS_TYPE_COLLECTOR;
+ *process_num = server_num - server_count + CONFIG_COLLECTOR_FORKS;
}
else if (server_num <= (server_count += CONFIG_PASSIVE_FORKS))
{
- *process_num = server_num - server_count + CONFIG_PASSIVE_FORKS;
*process_type = ZBX_AGENT_PROCESS_TYPE_LISTENER;
+ *process_num = server_num - server_count + CONFIG_PASSIVE_FORKS;
+
}
else if (server_num <= (server_count += CONFIG_ACTIVE_FORKS))
{
- *process_num = server_num - server_count + CONFIG_ACTIVE_FORKS;
*process_type = ZBX_AGENT_PROCESS_TYPE_ACTIVE_CHECKS;
+ *process_num = server_num - server_count + CONFIG_ACTIVE_FORKS;
}
else
{
THIS_SHOULD_NEVER_HAPPEN;
- exit(FAIL);
+ exit(EXIT_FAILURE);
}
}
diff --git a/src/zabbix_proxy/datasender/datasender.c b/src/zabbix_proxy/datasender/datasender.c
index 08569a48cb5..248111450a7 100644
--- a/src/zabbix_proxy/datasender/datasender.c
+++ b/src/zabbix_proxy/datasender/datasender.c
@@ -30,7 +30,7 @@
#include "../servercomms.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -161,11 +161,11 @@ ZBX_THREAD_ENTRY(datasender_thread, args)
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zbx_setproctitle("%s [connecting to the database]", get_process_type_string(process_type));
diff --git a/src/zabbix_proxy/heart/heart.c b/src/zabbix_proxy/heart/heart.c
index 5f0b977a7cd..fe341d934e1 100644
--- a/src/zabbix_proxy/heart/heart.c
+++ b/src/zabbix_proxy/heart/heart.c
@@ -27,7 +27,7 @@
#include "../servercomms.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -100,11 +100,11 @@ ZBX_THREAD_ENTRY(heart_thread, args)
/* once in STAT_INTERVAL seconds */
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
last_stat_time = time(NULL);
diff --git a/src/zabbix_proxy/proxy.c b/src/zabbix_proxy/proxy.c
index b3803de5717..8dc06bf10fd 100644
--- a/src/zabbix_proxy/proxy.c
+++ b/src/zabbix_proxy/proxy.c
@@ -100,12 +100,12 @@ static char shortopts[] = "c:n:hVR:";
int threads_num = 0;
pid_t *threads = NULL;
-int thread_num;
unsigned char daemon_type = ZBX_DAEMON_TYPE_PROXY_ACTIVE;
int process_num = 0;
unsigned char process_type = ZBX_PROCESS_TYPE_UNKNOWN;
+int server_num = 0;
int CONFIG_PROXYMODE = ZBX_PROXYMODE_ACTIVE;
int CONFIG_DATASENDER_FORKS = 1;
@@ -796,9 +796,9 @@ int MAIN_ZABBIX_ENTRY()
get_process_info_by_thread(i + 1, &process_type, &process_num);
- thread_num = i + 1;
+ server_num = i + 1;
thread_args.process_type = process_type;
- thread_args.thread_num = thread_num;
+ thread_args.server_num = server_num;
thread_args.process_num = process_num;
thread_args.args = NULL;
diff --git a/src/zabbix_proxy/proxyconfig/proxyconfig.c b/src/zabbix_proxy/proxyconfig/proxyconfig.c
index 502f5b14332..ddbf21d5f09 100644
--- a/src/zabbix_proxy/proxyconfig/proxyconfig.c
+++ b/src/zabbix_proxy/proxyconfig/proxyconfig.c
@@ -30,7 +30,7 @@
#define CONFIG_PROXYCONFIG_RETRY 120 /* seconds */
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -127,11 +127,11 @@ ZBX_THREAD_ENTRY(proxyconfig_thread, args)
double sec;
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zbx_setproctitle("%s [connecting to the database]", get_process_type_string(process_type));
diff --git a/src/zabbix_sender/zabbix_sender.c b/src/zabbix_sender/zabbix_sender.c
index 9ba3949abed..3f4c1615daf 100644
--- a/src/zabbix_sender/zabbix_sender.c
+++ b/src/zabbix_sender/zabbix_sender.c
@@ -403,7 +403,7 @@ int main(int argc, char **argv)
goto exit;
}
- thread_args.thread_num = 0;
+ thread_args.server_num = 0;
thread_args.args = &sentdval_args;
sentdval_args.server = ZABBIX_SERVER;
diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c
index 5df3fc2bfc9..9ba87e84f83 100644
--- a/src/zabbix_server/alerter/alerter.c
+++ b/src/zabbix_server/alerter/alerter.c
@@ -33,7 +33,7 @@
#define ALARM_ACTION_TIMEOUT 40
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -154,11 +154,11 @@ ZBX_THREAD_ENTRY(alerter_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zbx_setproctitle("%s [connecting to the database]", get_process_type_string(process_type));
diff --git a/src/zabbix_server/dbconfig/dbconfig.c b/src/zabbix_server/dbconfig/dbconfig.c
index 5ea50770889..b28d4208d4e 100644
--- a/src/zabbix_server/dbconfig/dbconfig.c
+++ b/src/zabbix_server/dbconfig/dbconfig.c
@@ -28,7 +28,7 @@
extern int CONFIG_CONFSYNCER_FREQUENCY;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -50,11 +50,11 @@ ZBX_THREAD_ENTRY(dbconfig_thread, args)
double sec = 0.0;
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zbx_setproctitle("%s [waiting %d sec for processes]", get_process_type_string(process_type),
CONFIG_CONFSYNCER_FREQUENCY);
diff --git a/src/zabbix_server/dbsyncer/dbsyncer.c b/src/zabbix_server/dbsyncer/dbsyncer.c
index 782a9b30f51..20c72ea6ace 100644
--- a/src/zabbix_server/dbsyncer/dbsyncer.c
+++ b/src/zabbix_server/dbsyncer/dbsyncer.c
@@ -29,7 +29,7 @@
extern int CONFIG_HISTSYNCER_FREQUENCY;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -51,11 +51,11 @@ ZBX_THREAD_ENTRY(dbsyncer_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/discoverer/discoverer.c b/src/zabbix_server/discoverer/discoverer.c
index 0d068e0b2ee..2d39ffa9ad8 100644
--- a/src/zabbix_server/discoverer/discoverer.c
+++ b/src/zabbix_server/discoverer/discoverer.c
@@ -35,7 +35,7 @@
extern int CONFIG_DISCOVERER_FORKS;
extern unsigned char daemon_type;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -874,7 +874,7 @@ ZBX_THREAD_ENTRY(discoverer_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
#ifdef HAVE_SNMP
@@ -882,7 +882,7 @@ ZBX_THREAD_ENTRY(discoverer_thread, args)
#endif
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/escalator/escalator.c b/src/zabbix_server/escalator/escalator.c
index f4d6ccc81c5..608be1f55c5 100644
--- a/src/zabbix_server/escalator/escalator.c
+++ b/src/zabbix_server/escalator/escalator.c
@@ -42,7 +42,7 @@ typedef struct
ZBX_USER_MSG;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -1548,11 +1548,11 @@ ZBX_THREAD_ENTRY(escalator_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c
index 9b2476ba526..7a96c9941de 100644
--- a/src/zabbix_server/housekeeper/housekeeper.c
+++ b/src/zabbix_server/housekeeper/housekeeper.c
@@ -28,7 +28,7 @@
#include "housekeeper.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
#define HK_INITIAL_DELETE_QUEUE_SIZE 4096
@@ -789,11 +789,11 @@ ZBX_THREAD_ENTRY(housekeeper_thread, args)
sigaddset (&mask, SIGUSR1);
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
for (;;)
{
diff --git a/src/zabbix_server/httppoller/httppoller.c b/src/zabbix_server/httppoller/httppoller.c
index 7c342c18b58..f9075d20f5b 100644
--- a/src/zabbix_server/httppoller/httppoller.c
+++ b/src/zabbix_server/httppoller/httppoller.c
@@ -30,7 +30,7 @@
extern int CONFIG_HTTPPOLLER_FORKS;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -104,11 +104,11 @@ ZBX_THREAD_ENTRY(httppoller_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c
index eadb89f5291..cbcda98c098 100644
--- a/src/zabbix_server/pinger/pinger.c
+++ b/src/zabbix_server/pinger/pinger.c
@@ -37,7 +37,7 @@
#define MIN_TIMEOUT 50
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -542,11 +542,11 @@ ZBX_THREAD_ENTRY(pinger_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
if (NULL == items)
items = zbx_malloc(items, sizeof(icmpitem_t) * items_alloc);
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index afa26f171a2..5a5def1f7ce 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -44,7 +44,7 @@
#include "checks_calculated.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
static void update_triggers_status_to_unknown(zbx_uint64_t hostid, zbx_item_type_t type, zbx_timespec_t *ts, char *reason)
{
@@ -772,11 +772,11 @@ ZBX_THREAD_ENTRY(poller_thread, args)
poller_type = *(unsigned char *)((zbx_thread_args_t *)args)->args;
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#ifdef HAVE_SNMP
if (ZBX_POLLER_TYPE_NORMAL == poller_type || ZBX_POLLER_TYPE_UNREACHABLE == poller_type)
diff --git a/src/zabbix_server/proxypoller/proxypoller.c b/src/zabbix_server/proxypoller/proxypoller.c
index 1a61afccbaa..4cfa00735dc 100644
--- a/src/zabbix_server/proxypoller/proxypoller.c
+++ b/src/zabbix_server/proxypoller/proxypoller.c
@@ -31,7 +31,7 @@
#include "proxy.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
static int connect_to_proxy(DC_PROXY *proxy, zbx_sock_t *sock, int timeout)
{
@@ -348,11 +348,11 @@ ZBX_THREAD_ENTRY(proxypoller_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/selfmon/selfmon.c b/src/zabbix_server/selfmon/selfmon.c
index ead14bc75f6..87ccfd17a94 100644
--- a/src/zabbix_server/selfmon/selfmon.c
+++ b/src/zabbix_server/selfmon/selfmon.c
@@ -24,18 +24,18 @@
#include "selfmon.h"
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
ZBX_THREAD_ENTRY(selfmon_thread, args)
{
double sec;
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
for (;;)
{
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index 40746e71554..47c2a30c6cf 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -104,12 +104,12 @@ static char shortopts[] = "c:n:hVR:";
int threads_num = 0;
pid_t *threads = NULL;
-int thread_num;
unsigned char daemon_type = ZBX_DAEMON_TYPE_SERVER;
unsigned char process_type = ZBX_PROCESS_TYPE_UNKNOWN;
int process_num = 0;
+int server_num = 0;
int CONFIG_ALERTER_FORKS = 1;
int CONFIG_DISCOVERER_FORKS = 1;
@@ -787,9 +787,9 @@ int MAIN_ZABBIX_ENTRY()
get_process_info_by_thread(i + 1, &process_type, &process_num);
- thread_num = i + 1;
+ server_num = i + 1;
thread_args.process_type = process_type;
- thread_args.thread_num = thread_num;
+ thread_args.server_num = server_num;
thread_args.process_num = process_num;
thread_args.args = NULL;
diff --git a/src/zabbix_server/snmptrapper/snmptrapper.c b/src/zabbix_server/snmptrapper/snmptrapper.c
index 2003e797494..7588194222f 100644
--- a/src/zabbix_server/snmptrapper/snmptrapper.c
+++ b/src/zabbix_server/snmptrapper/snmptrapper.c
@@ -32,7 +32,7 @@ static int trap_lastsize;
static ino_t trap_ino = 0;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
static void DBget_lastsize()
{
@@ -474,11 +474,11 @@ ZBX_THREAD_ENTRY(snmptrapper_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zabbix_log(LOG_LEVEL_DEBUG, "In %s() trapfile:'%s'", __function_name, CONFIG_SNMPTRAP_FILE);
diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c
index f17562d173e..58e2cdcea6c 100644
--- a/src/zabbix_server/timer/timer.c
+++ b/src/zabbix_server/timer/timer.c
@@ -36,7 +36,7 @@
#define ZBX_TRIGGERS_MAX 1000
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -804,11 +804,11 @@ ZBX_THREAD_ENTRY(timer_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c
index 67741cb5c69..48d511afcf5 100644
--- a/src/zabbix_server/trapper/trapper.c
+++ b/src/zabbix_server/trapper/trapper.c
@@ -39,7 +39,7 @@
extern unsigned char daemon_type;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -421,7 +421,6 @@ static int recv_getqueue(zbx_sock_t *sock, struct zbx_json_parse *jp)
ZBX_JSON_TYPE_STRING);
queue_stats_export(&queue_stats, "proxyid", &json);
zbx_hashset_destroy(&queue_stats);
-src/zabbix_server/trapper/trapper.c
break;
case ZBX_GET_QUEUE_DETAILS:
zbx_vector_ptr_sort(&queue, (zbx_compare_func_t)queue_compare_by_nextcheck_asc);
@@ -461,7 +460,7 @@ out:
}
static void active_passive_misconfig(zbx_sock_t *sock)
-{src/zabbix_server/trapper/trapper.c
+{
const char *msg = "misconfiguration error: the proxy is running in the active mode but server sends "
"requests to it as to proxy in passive mode";
@@ -653,11 +652,11 @@ ZBX_THREAD_ENTRY(trapper_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
memcpy(&s, (zbx_sock_t *)((zbx_thread_args_t *)args)->args, sizeof(zbx_sock_t));
diff --git a/src/zabbix_server/vmware/vmware.c b/src/zabbix_server/vmware/vmware.c
index 7afecbaaf61..014077be26a 100644
--- a/src/zabbix_server/vmware/vmware.c
+++ b/src/zabbix_server/vmware/vmware.c
@@ -52,7 +52,7 @@ extern char *CONFIG_FILE;
extern int CONFIG_VMWARE_FREQUENCY;
extern zbx_uint64_t CONFIG_VMWARE_CACHE_SIZE;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
#define VMWARE_VECTOR_CREATE(ref, type) zbx_vector_##type##_create_ext(ref, __vm_mem_malloc_func, \
__vm_mem_realloc_func, __vm_mem_free_func)
@@ -2753,11 +2753,11 @@ ZBX_THREAD_ENTRY(vmware_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
#define STAT_INTERVAL 5 /* if a process is busy and does not sleep then update status not faster than */
/* once in STAT_INTERVAL seconds */
diff --git a/src/zabbix_server/watchdog/watchdog.c b/src/zabbix_server/watchdog/watchdog.c
index 1dff72b0608..fe76874a77f 100644
--- a/src/zabbix_server/watchdog/watchdog.c
+++ b/src/zabbix_server/watchdog/watchdog.c
@@ -46,7 +46,7 @@ static int lastsent = 0;
extern int CONFIG_CONFSYNCER_FREQUENCY;
extern unsigned char process_type;
-extern int thread_num, process_num;
+extern int server_num, process_num;
/******************************************************************************
* *
@@ -209,11 +209,11 @@ ZBX_THREAD_ENTRY(watchdog_thread, args)
sigset_t mask, orig_mask;
#endif
process_type = ((zbx_thread_args_t *)args)->process_type;
- thread_num = ((zbx_thread_args_t *)args)->thread_num;
+ server_num = ((zbx_thread_args_t *)args)->server_num;
process_num = ((zbx_thread_args_t *)args)->process_num;
zabbix_log(LOG_LEVEL_INFORMATION, "server #%d started [%s #%d]",
- thread_num, get_process_type_string(process_type), process_num);
+ server_num, get_process_type_string(process_type), process_num);
zbx_vector_ptr_create(&recipients);