Boost logo

Boost :

From: Tomas Puverle (Tomas.Puverle_at_[hidden])
Date: 2006-05-22 21:35:13

> Dear Boost Community,
> Is there any interest in submission of a Random Access to Files (RAF)
> Library to Boost?
> Please see for documentation and an
> initial implementation.

I'm affraid I've not had the time to look at your implementation but I had a
quick scan of the docs.

An approach I've taken when implementing a memory mapped file class in the
pass was to try to improve on the compile-time guarantees one can provide.
When you open a file as read only, you can still read it but write access
causes a SEGV on Unix. This is undesirable, especially if at compile time you
know that you will only access the MMF for reads. What I am suggesting is
that you take advantage of the type system and distinguish between readonly
(const) MMFs (which will consequently return const_iterators).

Also, aside from the RW criteria, it would be useful to be able to provide a
range for the mapping. This brings up the possibility of what happens should
the file be smaller than the range that was initially requested, and also an
interesting question as to what would I do if I am trying to read a file that
is growing as I read it (similar to tail -f).

Finally, it would be nice to be able to specify some of the flags that memory
mapped files can take when they are being opened, such as MAP_PRIVATE,

Also as a word of caution: please don't assume any particular page size in
your library. (You may need to know the page size if you decide to provide
subrange mappings). For very large files we use page sizes larger than the
usual 4/8KB because using anything smaller destroys our TLB caches. But I am
sure you're not doing anything like that anyway.



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