Date: Mon, 1 Sep 1997 20:41:37 -0700 (PDT) From: "Jamil J. Weatherbee" <jamil@counterintelligence.ml.org> To: David Greenman <dg@root.com> Cc: Greg Lehey <grog@lemis.com>, freebsd-hackers@FreeBSD.ORG Subject: Re: SIGCLD Message-ID: <Pine.BSF.3.96.970901203511.3844A-100000@counterintelligence.ml.org> In-Reply-To: <199709020249.TAA16490@implode.root.com>
next in thread | previous in thread | raw e-mail | index | archive | help
So I would be right to assume that the following would work under sysV without the die routine and signal call in main, and would leave no zombies, but that the die routine is necessary under BSD if we want to ignore the children --- 1 question also, will this work correctly with an arbitrary number of exiting children: what I am asking is if there is any differnce between wait3 (&status, 0, (struct rusage *) NULL); and while (wait3(&status, WNOHANG, (struct rusage *) 0)>0); which is what stevens uses in his book. ------------------------------------------------------------------------- #include <stdio.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> void die (int sig) { int status; wait3 (&status, 0, (struct rusage *) NULL); } void main (void) { signal (SIGCHLD, die); printf ("Parent.\n"); if (fork()) { printf ("Hanging Parent.\n"); for (;;); } printf ("Child Dying.\n"); } --------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970901203511.3844A-100000>