diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2014-07-07 05:31:43 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2014-07-07 05:31:43 +0000 |
commit | 65a4ef06bf897d499792e83cde9c7896ef35e802 (patch) | |
tree | 2e7f72453d91610e29a855d8ec747af340cdf725 /sys/kern | |
parent | 6db9051c7f4424673b9d56512f8009cb96c6bfd7 (diff) |
fork1: FORK_THREAD requires FORK_SHAREFILES
Now that file descriptor tables have moved from a per-thread resource
to per-process, it's impossible to fork a thread without sharing the
file descriptor table.
ok guenther
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_fork.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 859a2bcdfdc..40760e1999d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.168 2014/07/04 05:58:30 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.169 2014/07/07 05:31:42 matthew Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -253,7 +253,9 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr, /* sanity check some flag combinations */ if (flags & FORK_THREAD) { - if ((flags & FORK_SIGHAND) == 0 || (flags & FORK_SYSTEM) != 0) + if ((flags & FORK_SHAREFILES) == 0 || + (flags & FORK_SIGHAND) == 0 || + (flags & FORK_SYSTEM) != 0) return (EINVAL); } if (flags & FORK_SIGHAND && (flags & FORK_SHAREVM) == 0) |