Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Nov 2001 13:54:43 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Jason Mawdsley <jason@macadamian.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: mmap/madvise
Message-ID:  <3BEC50A3.73AD7834@mindspring.com>
References:  <200111081947.fA8JlAe03457@web.cs.ndsu.nodak.edu> <02ae01c16891$4c1f4970$2a64a8c0@macadamian.com> <3BEB0A57.3C510C49@mindspring.com> <019401c16959$4e64a8b0$2a64a8c0@macadamian.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jason Mawdsley wrote:
> 
> > > I am creating a virtual memory manager.
> > >
> > > Currently I am doing a
> > > mmap(...PROT_NONE, MAP_ANON ) to reserve the memory.
> > > then when committing the memory I am using mprotect( ...PROT_READ |
> > > PROT_WRITE )
> >
> > mmap For reservation of memory; you should
> > mmap the fd for /dev/zero, with MAP_ANON
> > to grab pages initially.
> 
> The man pages state that the fd must be -1 for MAP_ANON.
> an open() /dev/zero will return an valid file descriptor. So how would I
> mmap using /dev/zero?

Mmap'ing /dev/zero gives you anopnymous pages; they can't
be not private.

It's pretty much the same thing.  I would use /dev/zero,
since it's portable.

-- 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?3BEC50A3.73AD7834>