diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-04-02 21:43:13 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-04-02 21:43:13 +0000 |
commit | af30415b0b2928465e43e6cf1262e7275d8dd1c5 (patch) | |
tree | c0943d31f2c4f5f6770363b2596da79e506bfc31 /sys/kern/kern_exit.c | |
parent | 92d3551f6f3379d9e9e7a6e3652ca50686373a1d (diff) |
On popular demand, the Linux-compatibility clone(2) implementation based
on NetBSD's code, as well as some faked Posix RT extensions by me. This makes
at least simple linuxthreads tests work.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 575394f72ae..bbe76ff7bc7 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.29 2001/03/23 18:42:06 art Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.30 2001/04/02 21:43:11 niklas Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -286,6 +286,10 @@ exit1(p, rv) wakeup((caddr_t)pp); } + if ((p->p_flag & P_FSTRACE) == 0 && p->p_exitsig != 0) + psignal(p->p_pptr, P_EXITSIG(p)); + wakeup((caddr_t)p->p_pptr); + /* * Notify procfs debugger */ @@ -293,6 +297,11 @@ exit1(p, rv) wakeup((caddr_t)p); /* + * Release the process's signal state. + */ + sigactsfree(p); + + /* * Clear curproc after we've done all operations * that could block, and before tearing down the rest * of the process state that might be used from clock, etc. @@ -433,6 +442,16 @@ loop: p->p_pid != SCARG(uap, pid) && p->p_pgid != -SCARG(uap, pid))) continue; + + /* + * Wait for processes with p_exitsig != SIGCHLD processes only + * if WALTSIG is set; wait for processes with pexitsig == + * SIGCHLD only if WALTSIG is clear. + */ + if ((SCARG(uap, options) & WALTSIG) ? + (p->p_exitsig == SIGCHLD) : (P_EXITSIG(p) != SIGCHLD)) + continue; + nfound++; if (p->p_stat == SZOMB) { retval[0] = p->p_pid; @@ -458,7 +477,8 @@ loop: if (p->p_oppid && (t = pfind(p->p_oppid))) { p->p_oppid = 0; proc_reparent(p, t); - psignal(t, SIGCHLD); + if (p->p_exitsig != 0) + psignal(t, P_EXITSIG(p)); wakeup((caddr_t)t); return (0); } @@ -509,6 +529,9 @@ proc_reparent(child, parent) if (child->p_pptr == parent) return; + if (parent == initproc) + child->p_exitsig = SIGCHLD; + LIST_REMOVE(child, p_sibling); LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); child->p_pptr = parent; |