On Tue, Jul 24, 2007 at 07:13:23PM +0200, Joerg Sonnenberger
wrote:
> On Tue, Jul 24, 2007 at 07:06:04PM +0200, Matthias
Drochner wrote:
> > NetBSD's new mremap(2) does not only require the
start address
> > of the memory range to be page aligned, but
additionally the
> > old and new sizes to be multiple of the page
size.
> > This differs from the Linux behaviour, and it is
also
> > inconsistent to mmap(2) which rounds up
implicitely.
>
> I always found the mmap behaviour a bit bogus, but I
don't have a strong
> position on it. Feel free to commit.
hmmm... beyond a bit bogus, the behaviour of our mmap just
seems wrong:
if you map a 10 byte file (for example), the mmap man page
says that
the mapped region may be extended up to the page size. That
seems
reasonable to me, but the man page also says any bytes
beyond the end
of the mapped object will be zero filled. This isn't always
the case.
When I try it I get data that was in memory from a previous
run of my
program. (char *p=mmap(), assert(p[11] == 0), p[11] = 'X'
fails on the
second run)
I suppose there's a bit of a performance hit with zeroing
out the page
every time, but it seems like a necessary thing to do. A
couple other
OSes I've tried it on do so.
eric
|