summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2003-02-01 12:17:09 +0000
committerjulian <julian@FreeBSD.org>2003-02-01 12:17:09 +0000
commite8efa7328e487806fb77d3ec54bf5fa5f8b017ed (patch)
tree5ab8f2c0a0aaeb3da3779201a31e710dee48d388 /sys/kern/kern_exit.c
parent1c5753d03f1205c6e2831f320c4007946a4b050f (diff)
downloadFreeBSD-src-e8efa7328e487806fb77d3ec54bf5fa5f8b017ed.zip
FreeBSD-src-e8efa7328e487806fb77d3ec54bf5fa5f8b017ed.tar.gz
Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but them's the rules.. I am using my "David's mentor" hat to revert this as he's offline for a while.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index ce9a18c..0b2c2e8 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -147,7 +147,7 @@ exit1(td, rv)
}
/*
- * XXXKSE: MUST abort all other threads before proceeding past here.
+ * XXXXKSE: MUST abort all other threads before proceeding past here.
*/
PROC_LOCK(p);
if (p->p_flag & P_KSES) {
@@ -156,6 +156,17 @@ exit1(td, rv)
* if so, act apropriatly, (exit or suspend);
*/
thread_suspend_check(0);
+ /*
+ * Here is a trick..
+ * We need to free up our KSE to process other threads
+ * so that we can safely set the UNBOUND flag
+ * (whether or not we have a mailbox) as we are NEVER
+ * going to return to the user.
+ * The flag will not be set yet if we are exiting
+ * because of a signal, pagefault, or similar
+ * (or even an exit(2) from the UTS).
+ */
+ td->td_flags |= TDF_UNBOUND;
/*
* Kill off the other threads. This requires
@@ -181,6 +192,7 @@ exit1(td, rv)
* Turn off threading support.
*/
p->p_flag &= ~P_KSES;
+ td->td_flags &= ~TDF_UNBOUND;
thread_single_end(); /* Don't need this any more. */
}
/*
@@ -225,10 +237,8 @@ exit1(td, rv)
*/
TAILQ_FOREACH(ep, &exit_list, next)
(*ep->function)(p);
-
- PROC_LOCK(p);
+
stopprofclock(p);
- PROC_UNLOCK(p);
MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
M_ZOMBIE, 0);
OpenPOWER on IntegriCloud