Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 May 2000 13:18:34 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Arun Sharma <adsharma@sharmas.dhs.org>
Cc:        nathan@khmere.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: mremap help ? or no support for FreeBSD ? so do what ?
Message-ID:  <200005132018.NAA04929@apollo.backplane.com>
References:  <391D39E0.934224E4@khmere.com> <200005131546.IAA15713@sharmas.dhs.org> <200005131908.MAA01426@apollo.backplane.com> <20000513124909.A16289@sharmas.dhs.org>

next in thread | previous in thread | raw e-mail | index | archive | help

:On Sat, May 13, 2000 at 12:08:35PM -0700, Matthew Dillon wrote:
:>     The linux mremap() is an idiotic system call.  Just unmap the file and
:>     re-mmap it.
:
:If you are just appending to the file, you can skip the munmap. mmap deletes
:the old mappings.
:
:	-Arun

    There are a thousand ways to do it, which is why linux's mremap() 
    syscall is stupid.

    * simply mmap() a larger block in the first place.  For example,
      if you have a 16K file mmap() 1MB.  You will seg fault on pages
      that are beyond the file EOF, but those pages will become valid
      the moment the file is extended into them without having to lift
      a finger.

    * mmap() the tail end of the newly extended file without removing or
      overwriting the previous mmap, by specifying an absolute address.

    * munmap() and re-mmap() the file.

    * Don't depend on a single monolithic mmap(), it won't work for files
      larger then 2-3GB anyway (on intel architecture), instead mmap the
      file in chunks on an as-needed basis.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005132018.NAA04929>