diff options
-rw-r--r-- | dbtests/test.vcxproj | 2 | ||||
-rw-r--r-- | pch.h | 4 | ||||
-rw-r--r-- | util/mmap_win.cpp | 13 |
3 files changed, 12 insertions, 7 deletions
diff --git a/dbtests/test.vcxproj b/dbtests/test.vcxproj index 12844418109..b7435c64351 100644 --- a/dbtests/test.vcxproj +++ b/dbtests/test.vcxproj @@ -97,7 +97,7 @@ <ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;C:\boost;\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_NOTDURABLE;_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>No</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -96,7 +96,9 @@ namespace mongo { /* this likely goes away later. to facilitate testing for a while without impacting other things. */ #if defined(_DURABLE) const bool durable = true; -#error do not use this yet +#if !defined(_DEBUG) +#error not done - do not use this yet +#endif #else const bool durable = false; #endif diff --git a/util/mmap_win.cpp b/util/mmap_win.cpp index 14049fb15d3..813296fb354 100644 --- a/util/mmap_win.cpp +++ b/util/mmap_win.cpp @@ -70,8 +70,8 @@ namespace mongo { if ( options & SEQUENTIAL ) createOptions |= FILE_FLAG_SEQUENTIAL_SCAN; DWORD rw = GENERIC_READ | GENERIC_WRITE; - if ( options & READONLY ) - rw = GENERIC_READ; + //if ( options & READONLY ) + // rw = GENERIC_READ; fd = CreateFile( toNativeString(filename).c_str(), @@ -80,7 +80,7 @@ namespace mongo { NULL, // security OPEN_ALWAYS, // create disposition createOptions , // flags - NULL); // hTemplateFile + NULL); // hTempl if ( fd == INVALID_HANDLE_VALUE ) { log() << "Create/OpenFile failed " << filename << ' ' << GetLastError() << endl; return 0; @@ -88,7 +88,7 @@ namespace mongo { mapped += length; - DWORD flProtect = (options & READONLY)?PAGE_READONLY:PAGE_READWRITE; + DWORD flProtect = PAGE_READWRITE; //(options & READONLY)?PAGE_READONLY:PAGE_READWRITE; maphandle = CreateFileMapping(fd, NULL, flProtect, length >> 32 /*maxsizehigh*/, (unsigned) length /*maxsizelow*/, @@ -99,7 +99,10 @@ namespace mongo { return 0; } - view = MapViewOfFile(maphandle, FILE_MAP_ALL_ACCESS, 0, 0, 0); + { + DWORD access = (options&READONLY)? FILE_MAP_READ : FILE_MAP_ALL_ACCESS; + view = MapViewOfFile(maphandle, access, /*f ofs hi*/0, /*f ofs lo*/ 0, /*dwNumberOfBytesToMap 0 means to eof*/0); + } if ( view == 0 ) { DWORD e = GetLastError(); log() << "MapViewOfFile failed " << filename << " " << errnoWithDescription(e) << endl; |