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 <alan pair com>
Submitted by:	Jilles Tjoelker <jilles stack nl>
PR:	108390
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2009-04-20 14:34:55 +00:00
parent 2ba2ee8d07
commit 007abb3d0f

View File

@ -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);