diff options
author | julian <julian@FreeBSD.org> | 1999-03-02 00:28:09 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1999-03-02 00:28:09 +0000 |
commit | 7e163b4f0313f73dd74ac128673638762d5aaeba (patch) | |
tree | 92cee78761b7ef19b2318d7e5b963a3552b8a2f7 /sys/kern/kern_exit.c | |
parent | 0674f5c758dac16d84023df4db88655d5a532e42 (diff) | |
download | FreeBSD-src-7e163b4f0313f73dd74ac128673638762d5aaeba.zip FreeBSD-src-7e163b4f0313f73dd74ac128673638762d5aaeba.tar.gz |
Fix thread/process tracking and differentiation for Linux threads emulation.
Submitted by: Richard Seaman, Jr." <dick@tar.com>
Also clean some compiler warnings in surrounding code.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index c80b3c8..297d9a7 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 - * $Id: kern_exit.c,v 1.74 1999/01/31 03:15:13 newton Exp $ + * $Id: kern_exit.c,v 1.75 1999/02/19 14:25:34 luoqi Exp $ */ #include "opt_compat.h" @@ -283,7 +283,7 @@ exit1(p, rv) LIST_REMOVE(q, p_sibling); LIST_INSERT_HEAD(&initproc->p_children, q, p_sibling); q->p_pptr = initproc; - q->p_sigparent = 0; + q->p_sigparent = SIGCHLD; /* * Traced processes are killed * since their existence means someone is screwing up. @@ -420,7 +420,7 @@ wait1(q, uap, compat) if (uap->pid == 0) uap->pid = -q->p_pgid; - if (uap->options &~ (WUNTRACED|WNOHANG)) + if (uap->options &~ (WUNTRACED|WNOHANG|WLINUXCLONE)) return (EINVAL); loop: nfound = 0; @@ -428,6 +428,17 @@ loop: if (uap->pid != WAIT_ANY && p->p_pid != uap->pid && p->p_pgid != -uap->pid) continue; + + /* This special case handles a kthread spawned by linux_clone + * (see linux_misc.c). The linux_wait4 and linux_waitpid functions + * need to be able to distinguish between waiting on a process and + * waiting on a thread. It is a thread if p_sigparent is not SIGCHLD, + * and the WLINUXCLONE option signifies we want to wait for threads + * and not processes. + */ + if ((p->p_sigparent != SIGCHLD) ^ ((uap->options & WLINUXCLONE) != 0)) + continue; + nfound++; if (p->p_stat == SZOMB) { /* charge childs scheduling cpu usage to parent */ |