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
path: root/src
diff options
context:
space:
mode:
authorArtjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com>2022-04-05 13:15:20 +0300
committerArtjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com>2022-04-05 13:15:20 +0300
commitab2a50c8b44edea63833e861d443f306b234755c (patch)
treec24d53f4140c0cbcf7318d6551b182872b48073f /src
parent641bc74ea7d931b84bfc6c2dc1f875af2fc54ded (diff)
.......... [DEV-2132] reordered includes in the public header and moved pid functions out of public interface
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxnix/Makefile.am1
-rw-r--r--src/libs/zbxnix/daemon.c7
-rw-r--r--src/libs/zbxnix/pid.c6
-rw-r--r--src/libs/zbxnix/pid.h28
-rw-r--r--src/zabbix_agent/zabbix_agentd.c2
5 files changed, 37 insertions, 7 deletions
diff --git a/src/libs/zbxnix/Makefile.am b/src/libs/zbxnix/Makefile.am
index 88ccea05cbb..644ea9ab7a7 100644
--- a/src/libs/zbxnix/Makefile.am
+++ b/src/libs/zbxnix/Makefile.am
@@ -12,5 +12,6 @@ libzbxnix_a_SOURCES = \
fatal.h \
ipc.c \
pid.c \
+ pid.h \
sigcommon.h \
sighandler.c
diff --git a/src/libs/zbxnix/daemon.c b/src/libs/zbxnix/daemon.c
index 2c61b7be692..07a60eed431 100644
--- a/src/libs/zbxnix/daemon.c
+++ b/src/libs/zbxnix/daemon.c
@@ -26,6 +26,7 @@
#include "cfg.h"
#include "log.h"
#include "control.h"
+#include "pid.h"
char *CONFIG_PID_FILE = NULL;
static int parent_pid = -1;
@@ -390,7 +391,7 @@ int zbx_daemon_start(int allow_root, const char *user, unsigned int flags)
exit(EXIT_FAILURE);
}
- if (FAIL == zbx_create_pid_file(CONFIG_PID_FILE))
+ if (FAIL == create_pid_file(CONFIG_PID_FILE))
exit(EXIT_FAILURE);
atexit(zbx_daemon_stop);
@@ -416,7 +417,7 @@ void zbx_daemon_stop(void)
if (parent_pid != (int)getpid())
return;
- zbx_drop_pid_file(CONFIG_PID_FILE);
+ drop_pid_file(CONFIG_PID_FILE);
}
int zbx_sigusr_send(int flags)
@@ -426,7 +427,7 @@ int zbx_sigusr_send(int flags)
#ifdef HAVE_SIGQUEUE
pid_t pid;
- if (SUCCEED == zbx_read_pid_file(CONFIG_PID_FILE, &pid, error, sizeof(error)))
+ if (SUCCEED == read_pid_file(CONFIG_PID_FILE, &pid, error, sizeof(error)))
{
union sigval s;
diff --git a/src/libs/zbxnix/pid.c b/src/libs/zbxnix/pid.c
index 438ede299d9..893123a9f79 100644
--- a/src/libs/zbxnix/pid.c
+++ b/src/libs/zbxnix/pid.c
@@ -25,7 +25,7 @@
static FILE *fpid = NULL;
static int fdpid = -1;
-int zbx_create_pid_file(const char *pidfile)
+int create_pid_file(const char *pidfile)
{
int fd;
zbx_stat_t buf;
@@ -72,7 +72,7 @@ int zbx_create_pid_file(const char *pidfile)
return SUCCEED;
}
-int zbx_read_pid_file(const char *pidfile, pid_t *pid, char *error, size_t max_error_len)
+int read_pid_file(const char *pidfile, pid_t *pid, char *error, size_t max_error_len)
{
int ret = FAIL;
FILE *f_pid;
@@ -93,7 +93,7 @@ int zbx_read_pid_file(const char *pidfile, pid_t *pid, char *error, size_t max_e
return ret;
}
-void zbx_drop_pid_file(const char *pidfile)
+void drop_pid_file(const char *pidfile)
{
struct flock fl;
diff --git a/src/libs/zbxnix/pid.h b/src/libs/zbxnix/pid.h
new file mode 100644
index 00000000000..65c271fcaae
--- /dev/null
+++ b/src/libs/zbxnix/pid.h
@@ -0,0 +1,28 @@
+/*
+** Zabbix
+** Copyright (C) 2001-2022 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.
+**/
+
+#ifndef ZABBIX_PID_H
+#define ZABBIX_PID_H
+
+#include "threads.h"
+
+int create_pid_file(const char *pidfile);
+int read_pid_file(const char *pidfile, pid_t *pid, char *error, size_t max_error_len);
+void drop_pid_file(const char *pidfile);
+#endif /* ZABBIX_FATAL_H */
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index 7c2593e3b3c..e66fea0b8d4 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -1462,7 +1462,7 @@ int main(int argc, char **argv)
break;
}
- START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags);
+ ZBX_START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags);
exit(EXIT_SUCCESS);
}