From owner-freebsd-hackers Mon Nov 12 14:53:42 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from raven.mail.pas.earthlink.net (raven.mail.pas.earthlink.net [207.217.120.39]) by hub.freebsd.org (Postfix) with ESMTP id 24DAB37B417 for ; Mon, 12 Nov 2001 14:53:39 -0800 (PST) Received: from dialup-209.245.136.188.dial1.sanjose1.level3.net ([209.245.136.188] helo=mindspring.com) by raven.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 163Pww-0005jt-00; Mon, 12 Nov 2001 14:53:06 -0800 Message-ID: <3BF05303.FEC66C7A@mindspring.com> Date: Mon, 12 Nov 2001 14:53:55 -0800 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Dillon Cc: Jason Mawdsley , freebsd-hackers@FreeBSD.ORG Subject: Re: mmap/madvise References: <200111081947.fA8JlAe03457@web.cs.ndsu.nodak.edu> <02ae01c16891$4c1f4970$2a64a8c0@macadamian.com> <3BEB0A57.3C510C49@mindspring.com> <019401c16959$4e64a8b0$2a64a8c0@macadamian.com> <200111121036.fACAaiv75199@apollo.backplane.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Matthew Dillon wrote: > The small-temporary-file trick is simple: create a small temporary > file, get a file descriptor to it, remove() the file, then ftruncate() > the descriptor to the amount of space you need, mmap() it > MAP_PRIVATE, and close the descriptor. Since it is a private map no > actual space is allocated for the file, only an inode. You can > leave the descriptor open if you need to 'allocate' more space using > additional calls to mmap(). One of his original issues was avoiding overcommit. In the file backed region case, as I suggested in my original response, to get this behaviour, he would have to touch each of the blocks in the file following the truncation, to make sure he didn't fall into an overcommit based failure later. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message