Subject: more mmap options
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 04/21/2002 19:07:51
Hi!

IRIX's mmap has several options which do not exist in NetBSD. I wonder
how hard it would be to emulate them (which seems to mean adding options
to our mmap, like it was done for MAP_RENAME as I understand).

There is a MAP_AUTOGROW which will increase the file size if the mapping
goes beyond the end of the file and if pages mapped beyond the end of
the file are touched. For now, I just increase the file size at mapping
ime so that it fits the mapped area whatever if pages beyond the file
are touched or not. I have no idea about how to implement the correct
behavior (ie: file is grown when pages after the end are touched). How
hard would it be? Roughly, how can it be achieved? And do we want it in
native mmap? (if we don't, how should I do?)

There is also a reserved range of memory that is garanteed to not be
used when MAP_FiXED is not set. I wonder how I could emulate this
without adding dirty hacks to native mmap code. Any suggestion?

Finnally, there is a MAP_AUTORESRV flag to automatically book a page of
swap for each modified page in the mapping. It seems to look like the
MAP_SWAP that does not exists yet but is "predocumented" in mmap(2). 

-- 
Emmanuel Dreyfus
manu@netbsd.org