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

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2012-12-10 23:49:39 +0400
committerMike Frysinger <vapier@gentoo.org>2012-12-20 00:53:33 +0400
commit12677acf0a0bda4a863279ece65eccda6c36d6b1 (patch)
treec93e3cece76881ebfbc09747fc841db94f2797d5 /networking
parent393c395ca50d0b95003d5adfc6d1ca95763cc732 (diff)
CONFIG_PID_FILE_PATH: new configuration option for pidfile paths
We set a default path for the directory where pidfiles are create when FEATURE_PIDFILE is selected. The default has no effect on applets which must specify a pidfile path on the command line to run, and it can be overridden by applets which optionally allow the user to specify the pidfile path. We also add pidfile write/remove support for klogd, ntpd and watchdog. For syslogd, we add a missing remove_pidfile() for better cleanup on daemon exit. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'networking')
-rw-r--r--networking/ifplugd.c2
-rw-r--r--networking/inetd.c6
-rw-r--r--networking/ntpd.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 88bf448fa..86586f0fe 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -551,7 +551,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
applet_name = xasprintf("ifplugd(%s)", G.iface);
#if ENABLE_FEATURE_PIDFILE
- pidfile_name = xasprintf(_PATH_VARRUN"ifplugd.%s.pid", G.iface);
+ pidfile_name = xasprintf(CONFIG_PID_FILE_PATH "/ifplugd.%s.pid", G.iface);
pid_from_pidfile = read_pid(pidfile_name);
if (opts & FLAG_KILL) {
diff --git a/networking/inetd.c b/networking/inetd.c
index 00baf6971..584c5e5e4 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -186,8 +186,6 @@
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN 0
#endif
-#define _PATH_INETDPID "/var/run/inetd.pid"
-
#define CNT_INTERVAL 60 /* servers in CNT_INTERVAL sec. */
#define RETRYTIME 60 /* retry after bind or server fail */
@@ -1132,7 +1130,7 @@ static void clean_up_and_exit(int sig UNUSED_PARAM)
if (ENABLE_FEATURE_CLEAN_UP)
close(sep->se_fd);
}
- remove_pidfile(_PATH_INETDPID);
+ remove_pidfile(CONFIG_PID_FILE_PATH "/inetd.pid");
exit(EXIT_SUCCESS);
}
@@ -1181,7 +1179,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
setgroups(1, &gid);
}
- write_pidfile(_PATH_INETDPID);
+ write_pidfile(CONFIG_PID_FILE_PATH "/inetd.pid");
/* never fails under Linux (except if you pass it bad arguments) */
getrlimit(RLIMIT_NOFILE, &rlim_ofile);
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 5b92db6f6..7facf9484 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -2080,6 +2080,8 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
*/
cnt = G.peer_cnt * (INITIAL_SAMPLES + 1);
+ write_pidfile(CONFIG_PID_FILE_PATH "/ntpd.pid");
+
while (!bb_got_signal) {
llist_t *item;
unsigned i, j;
@@ -2195,6 +2197,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
}
} /* while (!bb_got_signal) */
+ remove_pidfile(CONFIG_PID_FILE_PATH "/ntpd.pid");
kill_myself_with_sig(bb_got_signal);
}