two questions (issues?) about phobos/std/mmfile.d
mw
mingwu at gmail.com
Fri Oct 14 00:30:55 UTC 2022
I'm checking file:
https://github.com/dlang/phobos/blob/master/std/mmfile.d
and found two questions (issues?) I don't understand, can
someone explain?
1) This ctor:
https://github.com/dlang/phobos/blob/master/std/mmfile.d#L79
version (linux) this(File file, Mode mode = Mode.read, ulong size
= 0,
void* address = null, size_t window = 0) scope
is not doc-ed: https://dlang.org/phobos/std_mmfile.html
and there is a version (Posix) implementation inside the doc-ed
ctor:
https://github.com/dlang/phobos/blob/master/std/mmfile.d#L275
There is some code duplication of these two implementation, so is
the version (linux) needed at all? or it's some dead legacy code
that should be deleted together with this:
https://github.com/dlang/phobos/blob/master/std/mmfile.d#L87
2) in ensureMapped() why the requested mmap length are 3x window
(2x is enough, since the start offset of the mmap must be
multiples of pagesize):
https://github.com/dlang/phobos/blob/master/std/mmfile.d#L556
```
map(window*(block-1),3*window);
// should this be?:
map(window*(block), 2*window);
```
and
https://github.com/dlang/phobos/blob/master/std/mmfile.d#L582
```
map(window*(iblock-1),cast(size_t)(window*(jblock-iblock+3)));
// should this be?:
map(window*(iblock),
cast(size_t)(window*(jblock-iblock+2)));
```
So the mapped buffer size is consistent of 2x window?
Thanks.
More information about the Digitalmars-d
mailing list