I have a quick question about mmap, hopefully someone can smack me and
point
out what I'm missing :)
the man page says:
The mmap() function causes the pages starting at addr and continuing for
at most len bytes to be mapped from the object described by fd, starting
at byte offset offset. If len is not a multiple of the pagesize, the
mapped region may extend past the specified range. Any such extension
beyond the end of the mapped object will be zero-filled.
Which is fine and dandy, I'll just stat() the file to get the filesize and
mmap() it. But what happens in someone comes along and replaces the file
with
a larger file? I understand that my view of the file will change to the new
file, but only the length that I mmap()ed originally. Do I have to
periodically stat() the file to determine if I need to re-mmap() it should
the file size change? And if so, doesn't that partly diminish the usefulness
of mmap()? I mean, sure you can edit the file as a file and they are
reflected in the in-memory image, but how many edits don't change the file
size?
Also, in case it hasn't been notice already (I'm running -stable from May
18th), the mmap(2) manpage has a typo: it has "#include <sys/mman.h>"
Thanks for your help,
Kelly
~[EMAIL PROTECTED]~
FreeBSD - The Power To Serve - http://www.freebsd.org/
Join Team FreeBSD - http://www.posi.net/freebsd/Team-FreeBSD
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message