summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-09-19 07:57:44 +0000
committerGerrit Pape <pape@smarden.org>2007-09-19 07:57:44 +0000
commitf13e09ad39696e7d0459e0e8348933522122b055 (patch)
tree1a56cc28b9c709abda4bda6a701e15a36fcc6c7e
parent777dc5387dba0edf9cf194fafb11d4f01c7d32ab (diff)
downloadrunit-f13e09ad39696e7d0459e0e8348933522122b055.tar.gz
runit-f13e09ad39696e7d0459e0e8348933522122b055.tar.xz
runit-f13e09ad39696e7d0459e0e8348933522122b055.zip
* runit.c: force check for zombies after a 14 second timeout without
    signals (CHLD, CONT, INT).
-rw-r--r--package/CHANGES2
-rw-r--r--src/runit.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/package/CHANGES b/package/CHANGES
index cfa407f..64a122a 100644
--- a/package/CHANGES
+++ b/package/CHANGES
@@ -15,6 +15,8 @@
     on AIX 5.2 ML1, AIX 5.3 ML5 (thx Daniel Clark).
   * sv.c: fix race on check for down if pid is 0 and state is run or finish.
   * runit.c: speed up collecting zombies.
+  * runit.c: force check for zombies after a 14 second timeout without
+    signals (CHLD, CONT, INT).
 
 1.7.2
 Tue, 21 Nov 2006 15:13:47 +0000
diff --git a/src/runit.c b/src/runit.c
index 77ee93f..25da3b8 100644
--- a/src/runit.c
+++ b/src/runit.c
@@ -49,6 +49,7 @@ int main (int argc, const char * const *argv, char * const *envp) {
   iopause_fd x;
 #ifndef IOPAUSE_POLL
   fd_set rfds;
+  struct timeval t;
 #endif
   char ch;
   int ttyfd;
@@ -138,10 +139,6 @@ int main (int argc, const char * const *argv, char * const *envp) {
 
     x.fd =selfpipe[0];
     x.events =IOPAUSE_READ;
-#ifndef IOPAUSE_POLL
-    FD_ZERO(&rfds);
-    FD_SET(x.fd, &rfds);
-#endif
     for (;;) {
       int child;
 
@@ -149,9 +146,12 @@ int main (int argc, const char * const *argv, char * const *envp) {
       sig_unblock(sig_cont);
       sig_unblock(sig_int);
 #ifdef IOPAUSE_POLL
-      poll(&x, 1, -1);
+      poll(&x, 1, 14000);
 #else
-      select(x.fd +1, &rfds, (fd_set*)0, (fd_set*)0, (struct timeval*)0);
+      t.tv_sec =14; t.tv_usec =0;
+      FD_ZERO(&rfds);
+      FD_SET(x.fd, &rfds);
+      select(x.fd +1, &rfds, (fd_set*)0, (fd_set*)0, &t);
 #endif
       sig_block(sig_cont);
       sig_block(sig_child);