summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1999-03-02 00:28:09 +0000
committerJulian Elischer <julian@FreeBSD.org>1999-03-02 00:28:09 +0000
commit4ac9ae70836f53e6d351857aedc400151dc62f86 (patch)
treecb2306e49c95af881fe612d264e13d61f22aac40 /sys/kern
parent4cbb89d95de69d3a19afc3cdeaa052007e154bdc (diff)
Notes
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exit.c17
-rw-r--r--sys/kern/kern_fork.c7
2 files changed, 18 insertions, 6 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index c80b3c8adb9d..297d9a7260ca 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 */
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 1ee86ae241e3..2877636e63d3 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
- * $Id: kern_fork.c,v 1.54 1999/01/07 21:23:42 julian Exp $
+ * $Id: kern_fork.c,v 1.55 1999/01/26 02:38:10 julian Exp $
*/
#include "opt_ktrace.h"
@@ -361,9 +361,10 @@ again:
/* Note that we fill in the values of sigacts in vm_fork */
p2->p_sigacts = NULL;
}
- if (flags & RFLINUXTHPN) {
+ if (flags & RFLINUXTHPN)
p2->p_sigparent = SIGUSR1;
- }
+ else
+ p2->p_sigparent = SIGCHLD;
/* bump references to the text vnode (for procfs) */
p2->p_textvp = p1->p_textvp;