diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-01-10 02:20:21 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-01-10 02:20:21 +0000 |
commit | a4ea7ab3f6f192b870945f28eb20a444fc365a89 (patch) | |
tree | 3dbc5c9b8ee35e7f1ad89177da324f03df01fb16 /sys/kern | |
parent | 40a4ee3d14430dc3d7820866cc688e3fb4f1e05e (diff) |
Make RFNOWAIT work in rfork(2)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_exit.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 12 |
2 files changed, 7 insertions, 15 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index ad9d12bfab8..d925d666908 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.12 1997/11/06 05:58:16 csapuntz Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.13 1999/01/10 02:20:20 niklas Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -244,11 +244,11 @@ exit1(p, rv) p->p_pctcpu = 0; /* - * Notify parent that we're gone. If parent has the P_NOCLDWAIT - * flag set, notify process 1 instead (and hope it will handle - * this situation). + * Notify parent that we're gone. If we have P_NOWAIT or parent has + * the P_NOCLDWAIT flag set, notify process 1 instead (and hope it + * will handle this situation). */ - if (p->p_pptr->p_flag & P_NOCLDWAIT) { + if ((p->p_flag & P_NOZOMBIE) || (p->p_pptr->p_flag & P_NOCLDWAIT)) { struct proc *pp = p->p_pptr; proc_reparent(p, initproc); /* diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index c0b75327368..086b76a755a 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.11 1997/08/01 22:54:49 deraadt Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.12 1999/01/10 02:20:20 niklas Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -64,12 +64,6 @@ int nprocs = 1; /* process 0 */ int randompid; /* when set to 1, pid's go random */ pid_t lastpid; -#define ISFORK 0 -#define ISVFORK 1 -#define ISRFORK 2 - -int fork1 __P((struct proc *, int, int, register_t *)); - /*ARGSUSED*/ int sys_fork(p, v, retval) @@ -126,8 +120,6 @@ fork1(p1, forktype, rforkflags, retval) return (EINVAL); if (rforkflags & RFFDG) dupfd = 1; - if (rforkflags & RFNOWAIT) - return (EINVAL); /* XXX unimplimented */ if (rforkflags & RFCFDG) cleanfd = 1; } @@ -268,7 +260,7 @@ again: LIST_INSERT_AFTER(p1, p2, p_pglist); p2->p_pptr = p1; if (rforkflags & RFNOWAIT) { - /* XXX should we do anything? */ + p2->p_flag |= P_NOZOMBIE; } else { LIST_INSERT_HEAD(&p1->p_children, p2, p_sibling); } |