Opened 11 years ago
Last modified 5 years ago
#5595 new Bugs
Windows: Cannot write to files which have been mapped to memory in other threads/processes
Reported by: | Owned by: | Jonathan Turkanis | |
---|---|---|---|
Milestone: | To Be Determined | Component: | iostreams |
Version: | Boost 1.43.0 | Severity: | Problem |
Keywords: | memory mapping, windows | Cc: |
Description
Windows: If I try to open a file for writing which has been memory mapped by using boost::iostreams::mapped_file_source, I get an "Permission denied".
Under Linux (e.g. Ubuntu, openSUSE) there is no problem.
The cause of this behavior seems to be, that mapped_file_impl::open_file uses CreateFile WIN32 API with the parameter FILE_SHARE_READ instead of FILE_SHARE_WRITE.
Is this supposed to be like this?
Change History (8)
comment:1 by , 11 years ago
comment:7 by , 8 years ago
Still not fixed in boost 1.57.0 :(
Patch (diff mapped_file.cpp mapped_file.cpp.org):
186c186 < FILE_SHARE_READ | FILE_SHARE_WRITE, --- > FILE_SHARE_READ, 194c194 < FILE_SHARE_READ | FILE_SHARE_WRITE, --- > FILE_SHARE_READ,
Note:
See TracTickets
for help on using tickets.
It should be FILE_SHARE_READ | FILE_SHARE_WRITE instead of only FILE_SHARE_READ.