diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-15 05:46:15 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-15 05:46:15 +0000 |
commit | 4223257a8ea3bf3b20d2cf21f072bd177760544f (patch) | |
tree | 6532386e0576b15fe9634504cd162cd741224b91 /sys/kern/kern_exit.c | |
parent | 888e160939afae5514e1c6d0a7f2dc2d295c0fc5 (diff) |
From FreeBSD (joerg@freebsd.org):
Implement SA_NOCLDWAIT by reparenting kids of processes that have
the appropriate bit set to PID 1, and let PID 1 handle the zombie.
This assumes that PID 1 will wait for its kids (which is true of init).
This also includes some FreeBSD sigaction.2.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 00123fe90be..0f74d83a4f3 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.8 1996/10/26 07:30:24 tholo Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.9 1997/09/15 05:46:12 millert Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -244,10 +244,24 @@ exit1(p, rv) p->p_pctcpu = 0; /* - * 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 (pp->p_children.lh_first == NULL) + wakeup((caddr_t)pp); + } psignal(p->p_pptr, SIGCHLD); wakeup((caddr_t)p->p_pptr); + /* * Notify procfs debugger */ |