Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2007 16:40:26 GMT
From:      Alan Ferrency <alan@pair.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/108390: wait4() erroneously waits for all children when SIGCHLD is SIG_IGN
Message-ID:  <200702011640.l11GeQ3m007830@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/108390; it has been noted by GNATS.

From: Alan Ferrency <alan@pair.com>
To: bug-followup@FreeBSD.org
Cc: Alan Ferrency <alan@pair.com>
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
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702011640.l11GeQ3m007830>