From owner-freebsd-hackers Mon Sep 1 20:43:18 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA11009 for hackers-outgoing; Mon, 1 Sep 1997 20:43:18 -0700 (PDT) Received: from counterintelligence.ml.org (mdean.vip.best.com [206.86.94.101]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id UAA11004 for ; Mon, 1 Sep 1997 20:43:13 -0700 (PDT) Received: from localhost (jamil@localhost) by counterintelligence.ml.org (8.8.7/8.8.5) with SMTP id UAA03868; Mon, 1 Sep 1997 20:41:38 -0700 (PDT) Date: Mon, 1 Sep 1997 20:41:37 -0700 (PDT) From: "Jamil J. Weatherbee" To: David Greenman cc: Greg Lehey , freebsd-hackers@FreeBSD.ORG Subject: Re: SIGCLD In-Reply-To: <199709020249.TAA16490@implode.root.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 #include #include #include #include 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"); } --------------------------------------------------------------------------