Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jul 1999 19:19:51 -0400
From:      "Kelly Yancey" <>
To:        <>
Subject:   mmap question
Message-ID:  <000101bec73c$e20e3660$>

Next in thread | Raw E-Mail | Index | Archive | Help

  I have a quick question about mmap, hopefully someone can smack me and
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
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

  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,

  FreeBSD - The Power To Serve -
  Join Team FreeBSD -

To Unsubscribe: send mail to
with "unsubscribe freebsd-hackers" in the body of the message

Want to link to this message? Use this URL: <$e20e3660$291c453f>