Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add FORK_CLEANFILES flag to fork1(), which makes the new...
details: https://anonhg.NetBSD.org/src/rev/b0a3a1144b84
branches: trunk
changeset: 534920:b0a3a1144b84
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Aug 06 13:58:08 2002 +0000
description:
Add FORK_CLEANFILES flag to fork1(), which makes the new process start out
with a clean descriptor set (ie. not copied or shared from parent).
for rfork()
diffstat:
sys/kern/kern_fork.c | 6 ++++--
sys/sys/proc.h | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r 05faf8745bcd -r b0a3a1144b84 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c Tue Aug 06 13:55:03 2002 +0000
+++ b/sys/kern/kern_fork.c Tue Aug 06 13:58:08 2002 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
if (flags & FORK_SHAREFILES)
fdshare(p1, p2);
+ else if (flags & FORK_CLEANFILES)
+ p2->p_fd = fdinit(p1);
else
p2->p_fd = fdcopy(p1);
diff -r 05faf8745bcd -r b0a3a1144b84 sys/sys/proc.h
--- a/sys/sys/proc.h Tue Aug 06 13:55:03 2002 +0000
+++ b/sys/sys/proc.h Tue Aug 06 13:58:08 2002 +0000
@@ -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 @@
#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;
Home |
Main Index |
Thread Index |
Old Index