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 | |
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.
-rw-r--r-- | sys/kern/kern_fork.c | 20 | ||||
-rw-r--r-- | sys/sys/proc.h | 3 |
2 files changed, 18 insertions, 5 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, diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 5ed87c3de54..34553df974a 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.31 2000/06/05 11:02:48 art Exp $ */ +/* $OpenBSD: proc.h,v 1.32 2000/07/07 15:57:01 art Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -311,6 +311,7 @@ struct pcred { #define FORK_CLEANFILES 0x00000020 #define FORK_NOZOMBIE 0x00000040 #define FORK_SHAREVM 0x00000080 +#define FORK_VMNOSTACK 0x00000100 #define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash]) extern LIST_HEAD(pidhashhead, proc) *pidhashtbl; |