diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-07-07 15:57:03 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-07-07 15:57:03 +0000 |
commit | 9fe706ffdd0084f9b56cf7c5dcc263e77695db31 (patch) | |
tree | 098ff9c49b039a5860e4ccfbbad5e1b37ecd03e4 /sys/kern | |
parent | 9a51730a9b75386fb02f14582fcd305864c03258 (diff) |
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')
-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, |