summaryrefslogtreecommitdiff
path: root/zwgc/main.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1989-11-21 05:27:20 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1989-11-21 05:27:20 +0000
commit0d900e428fc94996b4d0f60b5d64c7fa4bb8e5ef (patch)
tree437544a6a9789c2055a49ce539564cac61f95d20 /zwgc/main.c
parentf0058a058852aceee6c76d2347d9950cdf54f16f (diff)
use wait3() and pick up all waiting processes
Diffstat (limited to 'zwgc/main.c')
-rw-r--r--zwgc/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/zwgc/main.c b/zwgc/main.c
index bf0c204..53949e7 100644
--- a/zwgc/main.c
+++ b/zwgc/main.c
@@ -341,11 +341,19 @@ static void signal_exit()
}
#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+/* clean up ALL the waiting children, in case we get hit with
+ multiple SIGCHLD's at once, and don't process in time. */
static signal_child()
{
union wait status;
+ int pid;
- (void)wait(&status);
+ do {
+ pid = wait3(&status, WNOHANG, (struct rusage *)0);
+ } while (pid != 0 && pid != -1);
}
static void setup_signals()