Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-01 16:01:24

"Neal D. Becker" <ndbecker2_at_[hidden]> wrote in message
> Jonathan Turkanis wrote:

> 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.


Craig's original implementation, IIRC, exposed protection and security settings,
but there was no portable syntax. E.g., on windows flags_or_security_t was
defined like this:

        typedef struct flags_or_security_
            DWORD access;
            LPSECURITY_ATTRIBUTES security;
        } flags_or_security_t;

while on posix it was:

        typedef int flags_or_security_t;

If you wanted to specify security settings, you'd have to use the native
constants. (Craig, please correct me if I'm wrong.)

I dropped this support for two reasons:

- I didn't want to have to come up with a portable syntax, esp. since I am not
expert in this area
- Neither the standard library nor Boost.Filesystem exposes security or
file-sharing options provided by the OS.

If there's support for adding these features, it would seem appropriate to work
on it after the review, and then request comments.

Best Regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at