From owner-freebsd-hackers Sat May 13 13:18:48 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 4B44937BB12 for ; Sat, 13 May 2000 13:18:43 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id NAA04929; Sat, 13 May 2000 13:18:34 -0700 (PDT) (envelope-from dillon) Date: Sat, 13 May 2000 13:18:34 -0700 (PDT) From: Matthew Dillon Message-Id: <200005132018.NAA04929@apollo.backplane.com> To: Arun Sharma Cc: nathan@khmere.com, freebsd-hackers@FreeBSD.ORG Subject: Re: mremap help ? or no support for FreeBSD ? so do what ? References: <391D39E0.934224E4@khmere.com> <200005131546.IAA15713@sharmas.dhs.org> <200005131908.MAA01426@apollo.backplane.com> <20000513124909.A16289@sharmas.dhs.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message