summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_misc.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/compat/linux/linux_misc.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/compat/linux/linux_misc.c')
-rw-r--r--sys/compat/linux/linux_misc.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index d2cf6b6..c50bf1c 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1695,34 +1695,23 @@ linux_setdomainname(struct thread *td, struct linux_setdomainname_args *args)
int
linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
{
- struct linux_emuldata *em, *td_em, *tmp_em;
- struct proc *sp;
+ struct linux_emuldata *em;
#ifdef DEBUG
if (ldebug(exit_group))
printf(ARGS(exit_group, "%i"), args->error_code);
#endif
- if (linux_use26(td)) {
- td_em = em_find(td->td_proc, EMUL_DONTLOCK);
-
- KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n"));
-
- EMUL_SHARED_RLOCK(&emul_shared_lock);
- LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
- if (em->pid == td_em->pid)
- continue;
-
- sp = pfind(em->pid);
- psignal(sp, SIGKILL);
- PROC_UNLOCK(sp);
-#ifdef DEBUG
- printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid);
-#endif
- }
-
- EMUL_SHARED_RUNLOCK(&emul_shared_lock);
+ em = em_find(td->td_proc, EMUL_DONTLOCK);
+ if (em->shared->refs > 1) {
+ EMUL_SHARED_WLOCK(&emul_shared_lock);
+ em->shared->flags |= EMUL_SHARED_HASXSTAT;
+ em->shared->xstat = W_EXITCODE(args->error_code, 0);
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+ if (linux_use26(td))
+ linux_kill_threads(td, SIGKILL);
}
+
/*
* XXX: we should send a signal to the parent if
* SIGNAL_EXIT_GROUP is set. We ignore that (temporarily?)
OpenPOWER on IntegriCloud