id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 1612,Support for PAGE_WRITECOPY(Windows) and MAP_PRIVATE(POSIX) flags,Jorge Lodos,Jonathan Turkanis,"The use of these flags allos for opening the file in read mode and creating the mapping so it could be written to without really changing the underlying physical object. Currently they are infered from the open mode in the OS primitives, defaulting to read only (in) or synchronized read/write (out). An additional flag parameter could be added to the mapped_file_params structure and open methods. Possible portable values for this flags could be PRIVATE and SHARED, defaulting to SHARED which is the current behavior. A bool parameter could be used instead. Sample implementation: // You might want to pass objects of this class by reference most of the time, now // they are being passed by value everywhere struct mapped_file_params { explicit mapped_file_params() : mode(), offset(0), length(static_cast(-1)), new_file_size(0), hint(0), flags(SHARED) { } explicit mapped_file_params(const std::string& path) : path(path), mode(), offset(0), length(static_cast(-1)), new_file_size(0), hint(0), flags(SHARED) { } std::string path; BOOST_IOS::openmode mode; stream_offset offset; std::size_t length; stream_offset new_file_size; const char* hint; int flags; }; // Modified functions in mapped_file_source (assign flgas in the implementation) explicit mapped_file_source( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0, int flags = SHARED ); void open( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0, int flags = SHARED ); // Modified functions in mapped_file (assign flgas in the implementation) explicit mapped_file( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, size_type length = max_length, stream_offset offset = 0, int flags = SHARED ); void open( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, size_type length = max_length, stream_offset offset = 0, int flags = SHARED ); // Modified functions in mapped_file_sik (assign flgas in the implementation) explicit mapped_file_sink( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0, int flags = SHARED ); void open( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0, int flags = SHARED); // In mapped_file_source::open_impl(mapped_file_params p) implementation, // the lines // pimpl_->mapped_handle_ = // ::CreateFileMappingA( pimpl_->handle_, NULL, // readonly ? PAGE_READONLY : PAGE_READWRITE, // 0, 0, NULL ); // should be replaced by: DWORD protect = readonly ? PAGE_READONLY : PAGE_READWRITE; if (p.flags == PRIVATE) protect = PAGE_WRITECOPY; pimpl_->mapped_handle_ = ::CreateFileMappingA( pimpl_->handle_, NULL, protect, 0, 0, NULL ); // The lines // void* data = ::mmap( hint, pimpl_->size_, // readonly ? PROT_READ : (PROT_READ | PROT_WRITE), // readonly ? MAP_PRIVATE : MAP_SHARED, // pimpl_->handle_, p.offset ); // should be replaced by: void* data = ::mmap( hint, pimpl_->size_, readonly ? PROT_READ : (PROT_READ | PROT_WRITE), p.flags == PRIVATE ? MAP_PRIVATE : MAP_SHARED, pimpl_->handle_, p.offset ); Thank you!",Feature Requests,closed,Boost 1.36.0,iostreams,Boost 1.34.1,Not Applicable,fixed,,