diff options
author | Marius Halden <marius.h@lden.org> | 2015-12-02 05:10:44 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2015-12-02 05:10:44 +0100 |
commit | 4510abfc1a80a1ef6e32d49ba42cc34bb8eec5ec (patch) | |
tree | 164916381d59435588cb5efcb1513c65a28dce8b /svcscan.c | |
parent | 98f591956e853da6e305db0247b20a3821725cd5 (diff) | |
download | svcmon-4510abfc1a80a1ef6e32d49ba42cc34bb8eec5ec.tar.gz svcmon-4510abfc1a80a1ef6e32d49ba42cc34bb8eec5ec.tar.bz2 svcmon-4510abfc1a80a1ef6e32d49ba42cc34bb8eec5ec.tar.xz |
Add a little more
Diffstat (limited to 'svcscan.c')
-rw-r--r-- | svcscan.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -231,10 +231,10 @@ reap_all() r = waitpid(-1, NULL, WNOHANG); if (r == 0) { - m++; if (m >= 3) break; sleep(1); + m++; } if (r == -1) { @@ -405,7 +405,6 @@ main(int argc, char **argv) struct kevent evt[6], revt[6]; struct procctl_reaper_kill rk; struct procctl_reaper_status rs; - pid_t mypid = getpid(); if (argc > 1) supdir = argv[1]; @@ -417,7 +416,7 @@ main(int argc, char **argv) setup_signals(); - if (procctl(P_PID, mypid, PROC_REAP_ACQUIRE, NULL) == -1) + if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1) err(1, "procctl()"); dir_fd = open(supdir, O_RDONLY | O_DIRECTORY | O_CLOEXEC); @@ -477,11 +476,11 @@ main(int argc, char **argv) } end: - if (procctl(P_PID, mypid, PROC_REAP_STATUS, &rs) != -1) { + if (procctl(P_PID, getpid(), PROC_REAP_STATUS, &rs) != -1) { if (rs.rs_children > 0) { rk.rk_sig = SIGTERM; rk.rk_flags = REAPER_KILL_CHILDREN; - if (procctl(P_PID, mypid, PROC_REAP_KILL, &rk)) + if (procctl(P_PID, getpid(), PROC_REAP_KILL, &rk)) perror("procctl()"); } } else { |