
Jonathan Turkanis wrote:
"Neal D. Becker" <ndbecker2@verizon.net> wrote in message news:ch4qs2$npr$1@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.