Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2001 14:53:55 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Jason Mawdsley <jason@macadamian.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: mmap/madvise
Message-ID:  <3BF05303.FEC66C7A@mindspring.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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