summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-12-31 15:49:48 +0100
committerAraq <rumpf_a@web.de>2011-12-31 15:49:48 +0100
commit4d9e8e13ae35452f66dfcb89e1692762660deaac (patch)
treecababbcc6b8554beba77419cde4aed76319636b8 /lib
parentf30eb9feb8430587d285d863f4f906d8874b8d73 (diff)
downloadNim-4d9e8e13ae35452f66dfcb89e1692762660deaac.tar.gz
MAP_ANONYMOUS is not always 0x20 for linux; changed the tests
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system/alloc.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim
index bc8124aca..e31ef47df 100755
--- a/lib/system/alloc.nim
+++ b/lib/system/alloc.nim
@@ -20,15 +20,14 @@ when defined(posix):
     PROT_WRITE = 2             # page can be written 
     MAP_PRIVATE = 2            # Changes are private 
   
-  when defined(linux) or defined(aix):
-    const MAP_ANONYMOUS = 0x20       # don't use a file
-  elif defined(macosx) or defined(bsd):
+  when defined(macosx) or defined(bsd):
     const MAP_ANONYMOUS = 0x1000
   elif defined(solaris): 
     const MAP_ANONYMOUS = 0x100
   else:
-    {.error: "Port memory manager to your platform".}
-
+    var
+      MAP_ANONYMOUS {.importc: "MAP_ANONYMOUS", header: "<sys/mman.h>".}: cint
+    
   proc mmap(adr: pointer, len: int, prot, flags, fildes: cint,
             off: int): pointer {.header: "<sys/mman.h>".}