[PATCH] Write pid files for klogd, ntpd and watchdog
Anthony G. Basile
basile at opensource.dyc.edu
Wed Dec 5 19:10:53 UTC 2012
From: "Anthony G. Basile" <blueness at gentoo.org>
Several applets can be run as daemons, such as syslogd. These
write pid files but a few, like klogd, ntpd and watchdog, do not.
We add write_pidfile() for these as is done for syslogd. This
gives initialization systems like openrc better control over
those daemons. See the downstream bug
https://bugs.gentoo.org/show_bug.cgi?id=445434
Signed-off-by: Anthony G. Basile <blueness at gentoo.org>
---
miscutils/watchdog.c | 2 ++
networking/ntpd.c | 2 ++
sysklogd/klogd.c | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index ee28dc3..52abe0e 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -95,6 +95,8 @@ int watchdog_main(int argc, char **argv)
stimer_duration, htimer_duration * 1000);
#endif
+ write_pidfile("/var/run/watchdog.pid");
+
while (1) {
/*
* Make sure we clear the counter before sleeping,
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 5b92db6..c0e4ccf 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("/var/run/ntpd.pid");
+
while (!bb_got_signal) {
llist_t *item;
unsigned i, j;
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index efa0e53..3504e34 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -195,6 +195,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
syslog(LOG_NOTICE, "klogd started: %s", bb_banner);
+ write_pidfile("/var/run/klogd.pid");
+
used = 0;
while (!bb_got_signal) {
int n;
--
1.7.8.6
More information about the busybox
mailing list