diff options
author | 2000-07-07 15:57:01 +0000 | |
---|---|---|
committer | 2000-07-07 15:57:01 +0000 | |
commit | 7ea77953bbc15758f2f7b7f6fa76f3a00b769c36 (patch) | |
tree | 1c0f9cd515a9ec7e38b090a0f5a4339182fed9ab /sys/kern/kern_fork.c | |
parent | Make hzto return 0 for timeouts that should happen now or in the past. (diff) | |
download | wireguard-openbsd-7ea77953bbc15758f2f7b7f6fa76f3a00b769c36.tar.xz wireguard-openbsd-7ea77953bbc15758f2f7b7f6fa76f3a00b769c36.zip |
The rfork sharing of vmspace is .. special and was broken with UVM.
Add a new flag to fork1 - FORK_VMNOSTACK that shares all of the vmspace
except the stack and use it for rfork.
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 30eb6228e73..cfd7da3b678 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.32 2000/06/18 17:59:55 niklas Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.33 2000/07/07 15:57:02 art Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -128,7 +128,7 @@ sys_rfork(p, v, retval) flags |= FORK_NOZOMBIE; if (rforkflags & RFMEM) - flags |= FORK_SHAREVM; + flags |= FORK_VMNOSTACK; return (fork1(p, flags, NULL, 0, retval)); } @@ -163,6 +163,11 @@ fork1(p1, flags, stack, stacksize, retval) return (EAGAIN); } +#if !defined(UVM) + if (flag & FORK_SHAREVM) + return (EINVAL); +#endif + /* * Increment the count of procs running with this uid. Don't allow * a nonprivileged user to exceed their current limit. @@ -336,8 +341,15 @@ again: */ p1->p_holdcnt++; -#if !defined(UVM) /* We do this later for UVM */ - if (flags & FORK_SHAREVM) { +#if defined(UVM) + if (flags & FORK_VMNOSTACK) { + /* share as much address space as possible */ + (void) uvm_map_inherit(&p1->p_vmspace->vm_map, + VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS - MAXSSIZ, + VM_INHERIT_SHARE); + } +#else + if (flags & FORK_VMNOSTACK) { /* share as much address space as possible */ (void) vm_map_inherit(&p1->p_vmspace->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS - MAXSSIZ, |