linux mmap has slightly different behavior than ours with a hint.
actually, this behavior may be peculiar to just uvm. uvm will avoid
mapping in what it thinks is the heap, even if passed a hint. at least
one linux app doesn't like this behavior.
reference:
http://marc.theaimsgroup.com/?l=netbsd-tech-kern&m=105612525808607&w=1
this goes on top of the mmap2 patch.
- compat/linux/linux_misc.c.orig Wed Jun 25 19:23:11 2003
+++ compat/linux/linux_misc.c Wed Jun 25 19:23:17 2003
@@ -664,7 +664,6 @@
return sys_mmap(p, &cma, retval);
}
-#define MAP_TRYFIXED 0 /* XXX -tedu just for now */
static void
linux_to_bsd_mmap_args(cma, uap)
struct sys_mmap_args *cma;
Index: sys/mman.h
RCS file: /cvs/src/sys/sys/mman.h,v
retrieving revision 1.16
diff -u -r1.16 mman.h
--- sys/mman.h 2003/06/02 23:28:21 1.16
+++ sys/mman.h 2003/06/26 02:30:14
@@ -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()
Index: uvm/uvm_mmap.c
RCS file: /cvs/src/sys/uvm/uvm_mmap.c,v
retrieving revision 1.46
diff -u -r1.46 uvm_mmap.c
--- uvm/uvm_mmap.c 2003/05/17 14:02:06 1.46
+++ uvm/uvm_mmap.c 2003/06/26 02:30:14
@@ -513,8 +513,10 @@
- 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);
}
--
"First, it was not a strip bar, it was an erotic club. And second,
what can I say? I'm a night owl."
- M. Barry, Mayor of Washington, DC
Received on Wed Jun 25 22:50:44 2003
This archive was generated by hypermail 2.1.8
: Wed Aug 23 2006 - 13:45:02 EDT
|