Module Name: src Committed By: martin Date: Sat Jul 30 20:05:46 UTC 2011
Modified Files: src/sys/uvm: uvm_map.c Log Message: Make uvmspace_exec() deal with procs that have no vmspace (yet) at all. Greatly simplifies the upcoming posix_spawn implementation. To generate a diff of this commit: cvs rdiff -u -r1.301 -r1.302 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.301 src/sys/uvm/uvm_map.c:1.302 --- src/sys/uvm/uvm_map.c:1.301 Sat Jul 30 19:29:12 2011 +++ src/sys/uvm/uvm_map.c Sat Jul 30 20:05:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.301 2011/07/30 19:29:12 martin Exp $ */ +/* $NetBSD: uvm_map.c,v 1.302 2011/07/30 20:05:46 martin Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.301 2011/07/30 19:29:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.302 2011/07/30 20:05:46 martin Exp $"); #include "opt_ddb.h" #include "opt_uvmhist.h" @@ -4184,13 +4184,24 @@ { struct proc *p = l->l_proc; struct vmspace *nvm, *ovm = p->p_vmspace; - struct vm_map *map = &ovm->vm_map; + struct vm_map *map; #ifdef __HAVE_CPU_VMSPACE_EXEC cpu_vmspace_exec(l, start, end); #endif /* + * Special case: no vmspace yet (see posix_spawn) - + * no races possible in this case. + */ + if (ovm == NULL) { + p->p_vmspace = uvmspace_alloc(start, end); + pmap_activate(l); + return; + } + + map = &ovm->vm_map; + /* * see if more than one process is using this vmspace... */