summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2010-11-22 09:06:59 +0000
committernetchild <netchild@FreeBSD.org>2010-11-22 09:06:59 +0000
commit46e50a7603917cf17df6f85004e94e846f192e37 (patch)
tree0c5325cf1dc8ea3c0510b059ec27414f9482c17f /sys/kern/kern_exit.c
parent775302a94a5ee0466093ff453c02ba80b5827cf3 (diff)
downloadFreeBSD-src-46e50a7603917cf17df6f85004e94e846f192e37.zip
FreeBSD-src-46e50a7603917cf17df6f85004e94e846f192e37.tar.gz
By using the 32-bit Linux version of Sun's Java Development Kit 1.6
on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes. 2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm. The submitters fix this in a similar way to how NetBSD handles this. I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him). The patches committed here are from [2], with some little modifications from me to the style. PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt <stefan.schmidt@stadtbuch.de>, gk Reviewed by: rdivacky (in april 2010) MFC after: 5 days
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 31389e1..e95ac8f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -200,6 +200,7 @@ exit1(struct thread *td, int rv)
while (p->p_lock > 0)
msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0);
+ p->p_xstat = rv; /* Let event handler change exit status */
PROC_UNLOCK(p);
/* Drain the limit callout while we don't have the proc locked */
callout_drain(&p->p_limco);
@@ -242,6 +243,7 @@ exit1(struct thread *td, int rv)
* P_PPWAIT is set; we will wakeup the parent below.
*/
PROC_LOCK(p);
+ rv = p->p_xstat; /* Event handler could change exit status */
stopprofclock(p);
p->p_flag &= ~(P_TRACED | P_PPWAIT);
@@ -424,7 +426,6 @@ exit1(struct thread *td, int rv)
/* Save exit status. */
PROC_LOCK(p);
- p->p_xstat = rv;
p->p_xthread = td;
/* Tell the prison that we are gone. */
OpenPOWER on IntegriCloud