diff options
-rw-r--r-- | lib/posix/posix.nim | 2 | ||||
-rw-r--r-- | lib/pure/memfiles.nim | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 8e66336c2..17bcc420e 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -1375,6 +1375,8 @@ 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 diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index 31fefc6c8..ffeb0beff 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -54,7 +54,7 @@ proc mapMem*(m: var TMemFile, mode: TFileMode = fmRead, nil, mappedSize, if readonly: PROT_READ else: PROT_READ or PROT_WRITE, - if readonly: MAP_PRIVATE else: MAP_SHARED, + if readonly: (MAP_PRIVATE or MAP_POPULATE) else: (MAP_SHARED or MAP_POPULATE), m.handle, offset) if result == cast[pointer](MAP_FAILED): osError(osLastError()) @@ -207,7 +207,7 @@ proc open*(filename: string, mode: TFileMode = fmRead, nil, result.size, if readonly: PROT_READ else: PROT_READ or PROT_WRITE, - if readonly: MAP_PRIVATE else: MAP_SHARED, + if readonly: (MAP_PRIVATE or MAP_POPULATE) else: (MAP_SHARED or MAP_POPULATE), result.handle, offset) |