MAP_ANONYMOUS is not always 0x20 for linux; changed the tests

This commit is contained in:
Araq 2011-12-31 15:49:48 +01:00
commit 4d9e8e13ae
3 changed files with 20 additions and 9 deletions

View file

@ -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>".}