From 007abb3d0f610b5ef4951bc7053311e78e4f21ef Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 20 Apr 2009 14:34:55 +0000 Subject: [PATCH] On the exit of the child process which parent either set SA_NOCLDWAIT or ignored SIGCHLD, unconditionally wake up the parent instead of doing this only when the child is a last child. This brings us in line with other U**xes that support SA_NOCLDWAIT. If the parent called waitpid(childpid), then exit of the child should wake up the parent immediately instead of forcing it to wait for all children to exit. Reported by: Alan Ferrency Submitted by: Jilles Tjoelker PR: 108390 MFC after: 2 weeks --- sys/kern/kern_exit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 425573474b9..c35c6f2356a 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -504,13 +504,13 @@ exit1(struct thread *td, int rv) proc_reparent(p, initproc); p->p_sigparent = SIGCHLD; PROC_LOCK(p->p_pptr); + /* - * If this was the last child of our parent, notify - * parent, so in case he was wait(2)ing, he will + * Notify parent, so in case he was wait(2)ing or + * executiing waitpid(2) with our pid, he will * continue. */ - if (LIST_EMPTY(&pp->p_children)) - wakeup(pp); + wakeup(pp); } else mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx);