summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2007-04-10 16:54:48 +0000
committertedu <tedu@openbsd.org>2007-04-10 16:54:48 +0000
commitce991cabdda3dce2b72a0a1fc7b29b8f39ff9d14 (patch)
tree782c3110a96f15ca6d4a7100dd72c152c00ce4eb /sys
parentDo not compile unused dump_tlb() unless option DEBUG. (diff)
downloadwireguard-openbsd-ce991cabdda3dce2b72a0a1fc7b29b8f39ff9d14.tar.xz
wireguard-openbsd-ce991cabdda3dce2b72a0a1fc7b29b8f39ff9d14.zip
remove process from thread list sooner in exit (notably, before waiting
for the list to become empty)
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exit.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index db00d007f71..a1ba63a790f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.67 2007/04/05 02:31:48 tedu Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.68 2007/04/10 16:54:48 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