From owner-freebsd-bugs@FreeBSD.ORG Thu Feb 1 16:40:27 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36D6F16A401 for ; Thu, 1 Feb 2007 16:40:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id DB97A13C4B8 for ; Thu, 1 Feb 2007 16:40:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l11GeQiB007832 for ; Thu, 1 Feb 2007 16:40:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l11GeQ3m007830; Thu, 1 Feb 2007 16:40:26 GMT (envelope-from gnats) Date: Thu, 1 Feb 2007 16:40:26 GMT Message-Id: <200702011640.l11GeQ3m007830@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Alan Ferrency Cc: Subject: Re: kern/108390: wait4() erroneously waits for all children when SIGCHLD is SIG_IGN X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alan Ferrency List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 16:40:27 -0000 The following reply was made to PR kern/108390; it has been noted by GNATS. From: Alan Ferrency To: bug-followup@FreeBSD.org Cc: Alan Ferrency Subject: Re: kern/108390: wait4() erroneously waits for all children when SIGCHLD is SIG_IGN Date: Thu, 1 Feb 2007 11:38:48 -0500 (EST) Perusing the source of sys/kern/kern_exit.c on the FreeBSD CVSWEB, I believe I found the problematic change. The change is in exit1() and not in wait4() or related functions. The change is between r1.156 and r1.157, as shown here: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_exit.c.diff?r1=1.156&r2=1.157&f=h Here, exit1() was modified so that if a process has SIGCHLD set to SIG_IGN, and it calls exit(), then this is treated the same as if SA_NOCLDWAIT was set. That is: the parent process is not notified that the child exited; instead, pid 1 is notified. I modified my test script to output the return value and errno of the failing wait4() call, and it verifies that when waiting too long for the short-running process, wait4() is returning with ENOCHLD (no child processes) and not because it received notification of a child process exiting. The current implementation makes it invalid for any process to execute a blocking wait() if it is ignoring SIGCHLD. This does not seem correct. Just because I don't want to receive a signal when my children exit, this does not mean I won't want to ask them whether they're alive or not. Alan Ferrency