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: Armin Pies <armin.pies@…> 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 armin.pies@…, 11 years ago

It should be FILE_SHARE_READ | FILE_SHARE_WRITE instead of only FILE_SHARE_READ.

comment:2 by Armin Pies <armin.pies@…>, 11 years ago

Still not fixed in Boost 1.47.0.

comment:3 by armin.pies@…, 11 years ago

Still not fixed in boost 1.49.0 :(

comment:4 by armin.pies@…, 10 years ago

Still not fixed in boost 1.50.0 :(

comment:5 by armin.pies@…, 10 years ago

Still not fixed in boost 1.53.0 :(

comment:6 by armin.pies@…, 9 years ago

Still not fixed in boost 1.55.0 :(

comment:7 by armin.pies@…, 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,

comment:8 by armin.pies@…, 5 years ago

Still not fixed in boost 1.65.1 :(

Note: See TracTickets for help on using tickets.