diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 25554b0b64d9..441d3b9fa132 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.90 2002/07/11 10:37:26 pooka Exp $ */ +/* $NetBSD: kern_fork.c,v 1.91 2002/08/06 13:58:08 pooka Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.90 2002/07/11 10:37:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.91 2002/08/06 13:58:08 pooka Exp $"); #include "opt_ktrace.h" #include "opt_systrace.h" @@ -381,6 +381,8 @@ fork1(struct proc *p1, int flags, int exitsig, void *stack, size_t stacksize, if (flags & FORK_SHAREFILES) fdshare(p1, p2); + else if (flags & FORK_CLEANFILES) + p2->p_fd = fdinit(p1); else p2->p_fd = fdcopy(p1); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 61ad2e1d7ac4..9e08b218e51a 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.142 2002/07/25 20:04:04 jdolecek Exp $ */ +/* $NetBSD: proc.h,v 1.143 2002/08/06 13:58:09 pooka Exp $ */ /*- * Copyright (c) 1986, 1989, 1991, 1993 @@ -367,6 +367,7 @@ do { \ #define FORK_SHAREFILES 0x08 /* Share file descriptors */ #define FORK_SHARESIGS 0x10 /* Share signal actions */ #define FORK_NOWAIT 0x20 /* Make init the parent of the child */ +#define FORK_CLEANFILES 0x40 /* Start with a clean descriptor set */ #define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash]) extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;