|
Boost : |
From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-09-01 13:34:17
Jonathan Turkanis wrote:
>
> "Neal D. Becker" <ndbecker2_at_[hidden]> wrote in message
> news:ch4qs2$npr$1_at_sea.gmane.org...
>> "Files must exist before being opened, and are never truncated;
>> attempting to write past the end of a file results in an error. "
>>
>> This is quite restrictive, compared to the capabilities of posix mmap.
>> Are these restrictions really necessary?
>
> I'm not an expert on memory mapped files. I basically redesigned the
> public interface but used Craig Henderson's implementation. I'd be happy
> to remove any or all of these restrictions, as long as it can be done for
> Windows and Posix.
>
> Could you be more specific about the missing functionality? I'll try to
> add it if it can be done portably.
>
After reviewing this, I think I spoke too soon. The above restrictions are
consistent with Posix. I had thought that mmap would allow mapping beyond
the file current size, but it seems not. One should use ftruncate to set
the size before mmap instead.
However, there is another point.
IMHO, portable != lowest common denominator. Posix mmap supports various
options, e.g., SHARED vs PRIVATE. I don't know what windows supports. I
think a good selection of options should be available. If some platform
doesn't support an option, it should either be ignored of an error. I
think Python mmap module can (as always) serve as a good guide.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk