summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-04-13 01:48:35 +0000
committerdyson <dyson@FreeBSD.org>1997-04-13 01:48:35 +0000
commit61955ab83033e59cfabb8590ba5ccbf0669d9a47 (patch)
tree8d2081b02ed11701596e498b2013cf9f5a5625dd /sys/vm/vm_glue.c
parent438bdd8a9c9d390f13a4b05980c19b18e974d16c (diff)
downloadFreeBSD-src-61955ab83033e59cfabb8590ba5ccbf0669d9a47.zip
FreeBSD-src-61955ab83033e59cfabb8590ba5ccbf0669d9a47.tar.gz
Fully implement vfork. Vfork is now much much faster than even our
fork. (On my machine, fork is about 240usecs, vfork is 78usecs.) Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory from the other threads of a group. Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating possible existing shares with other threads/processes. Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a thread from the rest of the group. Fix the case where a thread does an exec. It is almost nonsense for a thread to modify the other threads address space by an exec, so we now automatically divorce the address space before modifying it.
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 2116a0e..b49b25f 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -59,7 +59,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_glue.c,v 1.61 1997/02/22 09:48:17 peter Exp $
+ * $Id: vm_glue.c,v 1.62 1997/04/07 07:16:04 peter Exp $
*/
#include "opt_rlimit.h"
@@ -211,14 +211,16 @@ vm_fork(p1, p2, flags)
pmap_t pvp;
vm_object_t upobj;
+ if (flags & RFMEM) {
+ p2->p_vmspace = p1->p_vmspace;
+ p1->p_vmspace->vm_refcnt++;
+ }
+
while ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min) {
VM_WAIT;
}
- if (flags & RFMEM) {
- p2->p_vmspace = p1->p_vmspace;
- p1->p_vmspace->vm_refcnt++;
- } else {
+ if ((flags & RFMEM) == 0) {
p2->p_vmspace = vmspace_fork(p1->p_vmspace);
if (p1->p_vmspace->vm_shm)
OpenPOWER on IntegriCloud