From a0df72fcdc8c180b14d4e030c083a6ef1b5320b3 Mon Sep 17 00:00:00 2001 From: Nick Greenfield Date: Wed, 23 Jul 2014 12:06:13 -0700 Subject: [PATCH] Only try to import MAP_POPULATE on Linux, define flag as 0 otherwise. --- lib/posix/posix.nim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 17bcc420ed..5bd43fe9cf 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -1375,8 +1375,6 @@ var ## Share changes. MAP_PRIVATE* {.importc, header: "".}: cint ## Changes are private. - MAP_POPULATE* {.importc, header: "".}: cint - ## Populate (prefault) page tables for a mapping. MAP_FIXED* {.importc, header: "".}: cint ## Interpret addr exactly. MS_ASYNC* {.importc, header: "".}: cint @@ -1581,6 +1579,16 @@ var MSG_OOB* {.importc, header: "".}: cint ## Out-of-band data. + +when defined(linux): + var + MAP_POPULATE* {.importc, header: "".}: cint + ## Populate (prefault) page tables for a mapping. +else: + var + MAP_POPULATE*: cint = 0 + + when defined(macosx): var MSG_HAVEMORE* {.importc, header: "".}: cint