summary refs log tree commit diff stats
path: root/lib/posix
diff options
context:
space:
mode:
authorNick Greenfield <boyd.greenfield@gmail.com>2014-07-23 12:06:13 -0700
committerNick Greenfield <boyd.greenfield@gmail.com>2014-07-23 12:06:13 -0700
commita0df72fcdc8c180b14d4e030c083a6ef1b5320b3 (patch)
tree938cce13f18239526e516c792b03f379b116e54b /lib/posix
parent3a57052e57a6e6d2a7b4b6fa8babdd750620d687 (diff)
downloadNim-a0df72fcdc8c180b14d4e030c083a6ef1b5320b3.tar.gz
Only try to import MAP_POPULATE on Linux, define flag as 0 otherwise.
Diffstat (limited to 'lib/posix')
-rw-r--r--lib/posix/posix.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index 17bcc420e..5bd43fe9c 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -1375,8 +1375,6 @@ var
     ## Share changes.
   MAP_PRIVATE* {.importc, header: "<sys/mman.h>".}: cint
     ## Changes are private.
-  MAP_POPULATE* {.importc, header: "<sys/mman.h>".}: cint
-    ## Populate (prefault) page tables for a mapping.
   MAP_FIXED* {.importc, header: "<sys/mman.h>".}: cint
     ## Interpret addr exactly.
   MS_ASYNC* {.importc, header: "<sys/mman.h>".}: cint
@@ -1581,6 +1579,16 @@ var
   MSG_OOB* {.importc, header: "<sys/socket.h>".}: cint
     ## Out-of-band data.
 
+
+when defined(linux):
+  var
+    MAP_POPULATE* {.importc, header: "<sys/mman.h>".}: cint
+      ## Populate (prefault) page tables for a mapping.
+else:
+  var
+    MAP_POPULATE*: cint = 0
+
+
 when defined(macosx):
   var
     MSG_HAVEMORE* {.importc, header: "<sys/socket.h>".}: cint