MAP_ANONYMOUS is not always 0x20 for linux; changed the tests
This commit is contained in:
parent
f30eb9feb8
commit
4d9e8e13ae
3 changed files with 20 additions and 9 deletions
|
|
@ -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>".}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue