diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-12-01 16:58:45 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-12-01 19:38:30 +0900 |
| commit | 7e59e2dbb55649989102cccba96e56dbac4483ce (patch) | |
| tree | 138b79b3e254e63e1ddfeee28251a35889ad078f /src/OptionHandlerFactory.cc | |
| parent | b95f15b462a0481d3197409eb1ac552d17e53fb6 (diff) | |
mingw32: Open file using _wsopen and added --enable-mmap support
I tried CreateFile but the subsequent ReadFile fails with Access
Denied if sparse file is read on NTFS. I mostly reverted previous
changes and use _wsopen with read/write share enabled instead of
CreateFile.
This change also includes --enable-mmap support for MinGW32
build. Memory mapped file may be useful for 64-bits OS and lots of
RAM. Currently, FlushViewOfFile is not called during the download, so
it is slightly vulnerable against sudden power loss. I found lots of
read when resuming download due to page fault. So for now it is useful
for the initial download. I recommend not to use
--file-allocation=prealloc with --enable-mmap for MinGW32, because it
triggers page faults even in the initial download. Anyway, the option
is experimental.
Diffstat (limited to 'src/OptionHandlerFactory.cc')
| -rw-r--r-- | src/OptionHandlerFactory.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 5d8129a7..d599bc0a 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -293,7 +293,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_FILE); handlers.push_back(op); } -#ifdef HAVE_MMAP +#if defined HAVE_MMAP || defined __MINGW32__ { OptionHandler* op(new BooleanOptionHandler (PREF_ENABLE_MMAP, @@ -307,7 +307,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() op->setChangeOptionForReserved(true); handlers.push_back(op); } -#endif // HAVE_MMAP +#endif // HAVE_MMAP || __MINGW32__ { OptionHandler* op(new BooleanOptionHandler (PREF_ENABLE_RPC, |
