summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-09-13 19:42:29 +0000
committerjoerg <joerg@FreeBSD.org>1997-09-13 19:42:29 +0000
commitb3004b96f00018abb27dfa6435afa6c1364781a4 (patch)
treebe70b05473d1f2b81f048889bba4ac06515bd98e /sys/kern/kern_exit.c
parent1fe98f376a10db06be4e190a5a72e8667af43b4b (diff)
downloadFreeBSD-src-b3004b96f00018abb27dfa6435afa6c1364781a4.zip
FreeBSD-src-b3004b96f00018abb27dfa6435afa6c1364781a4.tar.gz
Implement SA_NOCLDWAIT.
The implementation is done (unlike what i've originally been contemplating) by reparenting kids of processes that have the appropriate bit set to PID 1, and let PID 1 handle the zombie. This is far less problematical than what would seem to be ``doing it right'', for a number of reasons. Of our currently shipping PID-1-intended programs, 50 % fail the above assumption. ;-) (Read this: sysinstall doesn't do it right. This is no problem as long as no program called by sysinstall actually uses SA_NOCLDWAIT.) ToDo: . clarify the correct SA_* flag inheritance, compared to other systems, . decide whether the compat cruft (osigvec(9)) should deal with new system additions or not, . merge OpenBSD's SA_SIGINFO implementation. ;) Reviewed by: bde
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 7d326da..1fb9077 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
- * $Id: kern_exit.c,v 1.53 1997/08/26 00:11:55 bde Exp $
+ * $Id: kern_exit.c,v 1.54 1997/09/02 20:05:38 bde Exp $
*/
#include "opt_ktrace.h"
@@ -294,8 +294,22 @@ exit1(p, rv)
ruadd(p->p_ru, &p->p_stats->p_cru);
/*
- * Notify parent that we're gone.
+ * Notify parent that we're gone. If parent has the P_NOCLDWAIT
+ * flag set, notify process 1 instead (and hope it will handle
+ * this situation).
*/
+ if (p->p_pptr->p_flag & P_NOCLDWAIT) {
+ struct proc *pp = p->p_pptr;
+ proc_reparent(p, initproc);
+ /*
+ * If this was the last child of our parent, notify
+ * parent, so in case he was wait(2)ing, he will
+ * continue.
+ */
+ if (LIST_EMPTY(&pp->p_children))
+ wakeup((caddr_t)pp);
+ }
+
psignal(p->p_pptr, SIGCHLD);
wakeup((caddr_t)p->p_pptr);
#if defined(tahoe)
OpenPOWER on IntegriCloud