bin/108390: [libc] [patch] wait4() erroneously waits for all
children when SIGCHLD is SIG_IGN [regression]
Kostik Belousov
kostikbel at gmail.com
Sun Apr 19 19:54:17 UTC 2009
Further check on Solaris revealed that for the case where SIGCHLD is
ignored, wait4() returned -1/ECHLD, conforming to the FreeBSD behaviour
of reparenting to init.
Unless further comments are given, I will commit this in several days:
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 4255734..c35c6f2 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-bugs/attachments/20090419/4a230892/attachment.pgp
More information about the freebsd-bugs
mailing list