diff options
author | 2003-07-01 23:23:04 +0000 | |
---|---|---|
committer | 2003-07-01 23:23:04 +0000 | |
commit | 74098e75f1c4f1676f9fe9081eea391e96e4dea8 (patch) | |
tree | 472d384259417eca23111c45b2b0c784cc06ad5b | |
parent | Add /etc/isakmpd dir as well as isakmpd.conf and isakmpd.policy files. (diff) | |
download | wireguard-openbsd-74098e75f1c4f1676f9fe9081eea391e96e4dea8.tar.xz wireguard-openbsd-74098e75f1c4f1676f9fe9081eea391e96e4dea8.zip |
add MAP_TRYFIXED, mostly to help emulate other systems.
when set, uvm will not attempt to avoid a heap address, if requested.
from todd vierling, via
http://marc.theaimsgroup.com/?l=netbsd-tech-kern&m=105612525808607&w=1
-rw-r--r-- | sys/sys/mman.h | 3 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/sys/mman.h b/sys/sys/mman.h index 76128962c10..a0ab8cc746c 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mman.h,v 1.16 2003/06/02 23:28:21 millert Exp $ */ +/* $OpenBSD: mman.h,v 1.17 2003/07/01 23:23:04 tedu Exp $ */ /* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */ /*- @@ -57,6 +57,7 @@ #define MAP_INHERIT 0x0080 /* region is retained after exec */ #define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ +#define MAP_TRYFIXED 0x0400 /* attempt hint address, even within heap */ /* * Error return from mmap() diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 3d2dd68e305..805f9adc488 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.47 2003/07/01 22:18:09 tedu Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.48 2003/07/01 23:23:04 tedu Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -441,8 +441,10 @@ sys_mmap(p, v, retval) * not fixed: make sure we skip over the largest possible heap. * we will refine our guess later (e.g. to account for VAC, etc) */ - - if (addr < uvm_map_hint(p, prot)) + if (addr == 0) + addr = uvm_map_hint(p, prot); + else if (!(flags & MAP_TRYFIXED) && + addr < uvm_map_hint(p, prot)) addr = uvm_map_hint(p, prot); } |