summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorNick Greenfield <boyd.greenfield@gmail.com>2014-07-23 11:36:35 -0700
committerNick Greenfield <boyd.greenfield@gmail.com>2014-07-23 11:36:35 -0700
commit3a57052e57a6e6d2a7b4b6fa8babdd750620d687 (patch)
treea485167318c8ab438b429f9c52ecef94ab3a5261 /lib/pure
parentcba75db4e36b3af0d39b5717141a971e6d558554 (diff)
downloadNim-3a57052e57a6e6d2a7b4b6fa8babdd750620d687.tar.gz
Revert "Do not automatically use MAP_POPULATE for opening mmap files."
This reverts commit cba75db4e36b3af0d39b5717141a971e6d558554. The prior
commit yields a compiler error 'error: lvalue required as left operand
of assignment; MAP_POPULATE = ((int) 0);'. So for now this branch
*always* adds MAP_POPULATE when using the open and mapMem procs.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/memfiles.nim12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim
index 06f2c215e..ffeb0beff 100644
--- a/lib/pure/memfiles.nim
+++ b/lib/pure/memfiles.nim
@@ -30,17 +30,14 @@ type
 
     when defined(windows):
       fHandle: int
-      mapHandle: int
+      mapHandle: int 
     else:
       handle: cint
 
 
 proc mapMem*(m: var TMemFile, mode: TFileMode = fmRead,
-             mappedSize = -1, offset = 0,
-             use_map_populate = false): pointer =
+             mappedSize = -1, offset = 0): pointer =
   var readonly = mode == fmRead
-  if not use_map_populate:
-    MAP_POPULATE = 0
   when defined(windows):
     result = mapViewOfFileEx(
       m.mapHandle,
@@ -75,8 +72,7 @@ proc unmapMem*(f: var TMemFile, p: pointer, size: int) =
 
 
 proc open*(filename: string, mode: TFileMode = fmRead,
-           mappedSize = -1, offset = 0, newFileSize = -1,
-           use_map_populate = false): TMemFile =
+           mappedSize = -1, offset = 0, newFileSize = -1): TMemFile =
   ## opens a memory mapped file. If this fails, ``EOS`` is raised.
   ## `newFileSize` can only be set if the file does not exist and is opened
   ## with write access (e.g., with fmReadWrite). `mappedSize` and `offset`
@@ -98,8 +94,6 @@ proc open*(filename: string, mode: TFileMode = fmRead,
   # The file can be resized only when write mode is used:
   assert newFileSize == -1 or mode != fmRead
   var readonly = mode == fmRead
-  if not use_map_populate:
-    MAP_POPULATE = 0
 
   template rollback =
     result.mem = nil