]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: add MAP_FIXED
authorBen Gras <ben@minix3.org>
Wed, 11 Apr 2012 15:15:15 +0000 (17:15 +0200)
committerBen Gras <ben@minix3.org>
Thu, 12 Apr 2012 13:01:36 +0000 (15:01 +0200)
include/sys/mman.h
servers/vm/mmap.c

index 4a28810cad3e277fd26bbd9d3fafafc298a01916..406db8c9f838766eada9c342e6d56ae42d688346 100644 (file)
@@ -56,6 +56,8 @@ typedef       __off_t         off_t;          /* file offset */
 #define        MAP_ALIGNMENT_64KB      MAP_ALIGN64K
 #define        MAP_IPC_SHARED  0x0100  /* share changes */
 
+#define MAP_FIXED      0x0200  /* require mapping to happen at hint */
+
 /*
  * Error indicator returned by mmap(2)
  */
index dc9cc7c881c2208d7245f0b82e4fac1bfe7d6dcc..b74571613282870bf3ef3369333c0db6dc62e024 100644 (file)
@@ -88,6 +88,8 @@ int do_mmap(message *m)
                        addr = arch_vir2map(vmp, m->VMM_ADDR);
                        vr = map_page_region(vmp, addr, 0, len, MAP_NONE,
                                vrflags, mfflags);
+                       if(!vr && (m->VMM_FLAGS & MAP_FIXED))
+                               return ENOMEM;
                }
                if (!vr) {
                        /* No address given or address already in use. */