> > > > > are correct; an "r+m" file is read() not mmaped. > > > > > > > > Have you written a test program that verifies (presumably via > > > > monitoring via 'strace') how 'm' changes the behaviour of stdio > > > > with respect to the use of mmap()? > > > Erm, yes, thats what I'm talking about (and is strace exactly what I > > > did). But I'm not sure if I understand you .. I verified that all 3 > > > routines mmap() a file if "m" is given (and it is read-only), and do > > > not mmap() it if "m" is not given (or if it is not read-only). > > > > > > I include now the test program :) > > > > Yes, but did you verify: > > > > -- which file is being mmap()ed? (There might be many other > > unrelated mmap() calls going on.) > Yes; note that it only happens after you fread() for the first time. > > > -- whether the behaviour changes if 'm' is removed from the fopen()? > > (the strace output shd be different). > Yes: > > > routines mmap() a file if "m" is given (and it is read-only), and do > > > not mmap() it if "m" is not given (or if it is not read-only).
Hmmm -- I'm not seeing this. Can you post for each of the two test cases: -- the fopen() call that is used. -- the command line that is used to run the program. -- the results of grep the strace output using: egrep '(mmap|open|read)' Thanks, Michael -- Michael Kerrisk maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 Want to help with man page maintenance? Grab the latest tarball at ftp://ftp.win.tue.nl/pub/linux-local/manpages/, read the HOWTOHELP file and grep the source files for 'FIXME'. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]