diff options
author | 2007-04-11 14:27:08 +0000 | |
---|---|---|
committer | 2007-04-11 14:27:08 +0000 | |
commit | 01a15e811fc3a12aed742a784132f56be2bb533a (patch) | |
tree | 232f795b20a69c9b1f24d55f9247ba2784db98c6 | |
parent | The return value of uvm_grow() (and previously, grow()) has not been used (diff) | |
download | wireguard-openbsd-01a15e811fc3a12aed742a784132f56be2bb533a.tar.xz wireguard-openbsd-01a15e811fc3a12aed742a784132f56be2bb533a.zip |
remove proc from process thread list sooner in exit (notably, before waiting
for the list to become empty)
ok art
-rw-r--r-- | sys/kern/kern_exit.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index c5e1483815b..cd9a2692627 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.69 2007/04/10 21:09:42 tedu Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.70 2007/04/11 14:27:08 tedu Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -119,7 +119,11 @@ exit1(struct proc *p, int rv, int flags) panic("init died (signal %d, exit %d)", WTERMSIG(rv), WEXITSTATUS(rv)); + /* unlink ourselves from the active threads */ + TAILQ_REMOVE(&p->p_p->ps_threads, p, p_thr_link); #ifdef RTHREADS + if (TAILQ_EMPTY(&p->p_p->ps_threads)) + wakeup(&p->p_p->ps_threads); /* * if one thread calls exit, we take down everybody. * we have to be careful not to get recursively caught. @@ -141,12 +145,6 @@ exit1(struct proc *p, int rv, int flags) q = TAILQ_FIRST(&p->p_p->ps_threads); for (; q != NULL; q = nq) { nq = TAILQ_NEXT(q, p_thr_link); - - /* - * Don't shoot ourselves again. - */ - if (q == p) - continue; atomic_setbits_int(&q->p_flag, P_IGNEXITRV); q->p_xstat = rv; psignal(q, SIGKILL); @@ -269,12 +267,6 @@ exit1(struct proc *p, int rv, int flags) } } - /* unlink ourselves from the active threads */ - TAILQ_REMOVE(&p->p_p->ps_threads, p, p_thr_link); -#ifdef RTHREADS - if (TAILQ_EMPTY(&p->p_p->ps_threads)) - wakeup(&p->p_p->ps_threads); -#endif /* * Save exit status and final rusage info, adding in child rusage |