From owner-freebsd-hackers@FreeBSD.ORG Sat May 31 14:58:52 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA11837B401 for ; Sat, 31 May 2003 14:58:52 -0700 (PDT) Received: from frenchfries.net (lsanca1-ar14-4-60-145-009.lsanca1.dsl-verizon.net [4.60.145.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id A79DC43F75 for ; Sat, 31 May 2003 14:58:51 -0700 (PDT) (envelope-from pherman@frenchfries.net) Received: by frenchfries.net (Postfix, from userid 1000) id 110625086; Sat, 31 May 2003 14:58:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by frenchfries.net (Postfix) with ESMTP id 0E7764B48; Sat, 31 May 2003 14:58:51 -0700 (PDT) Date: Sat, 31 May 2003 14:58:51 -0700 (PDT) From: Paul Herman X-X-Sender: pherman@mammoth.eat.frenchfries.net To: =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= In-Reply-To: <20030531122701.H326@atlas.home> Message-ID: <20030531143506.V17955-100000@mammoth.eat.frenchfries.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-15 Content-Transfer-Encoding: 8BIT cc: hackers@freebsd.org Subject: Re: Proper behaviour for wait()? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 May 2003 21:58:52 -0000 On Sat, 31 May 2003, [ISO-8859-1] Mikko Työläjärvi wrote: > The only way (except "for historical reasons") the above standards > excerpts would make sense to me, is if setting the SIGCHLD handler to > SIG_IGN always makes the system reap child processes, OpenBSD does this, I believe. > But I've never seen that behavior described anyware, so that is > probably not the intent. Also, it does not work that way on FreeBSD: > once I've set the SA_NOCHLDWAIT flag, I don't get any SIGCGHLD > signals. The closest I can get to deciphering intent is the following manpage for wait() from The Open Group: If the calling process has SA_NOCLDWAIT set or has SIGCHLD set to SIG_IGN, and the process has no unwaited for children that were transformed into zombie processes, the calling thread will block until all of the children of the process containing the calling thread terminate, and wait() and waitpid() will fail and set errno to [ECHILD]. ...which likens setting SIGCHLD to SIG_IGN to SA_NOCLDWAIT when there aren't any zombies. In that respect they behave similarly, and FreeBSD does indeed obey and return -1, so it might not be unreasonable to infer they behave similarly when there *are* zombies waiting to be reaped, i.e. return -1 and set ECHILD as does Darwin & Solaris. FWIW, Linux (at least 2.4.21 does) seems to be out on its own: wait() returns success even when BOTH SIG_IGN and SA_NOCLDWAIT are set. > And now over to someone who actually knows what they're talking > about... :) Indeed! Anyone? -Paul.