From owner-freebsd-hackers Fri Nov 9 13:55:29 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from snipe.prod.itd.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id 9D56837B419 for ; Fri, 9 Nov 2001 13:55:27 -0800 (PST) Received: from dialup-209.245.138.29.dial1.sanjose1.level3.net ([209.245.138.29] helo=mindspring.com) by snipe.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 162Jb0-0007hb-00; Fri, 09 Nov 2001 13:53:55 -0800 Message-ID: <3BEC50A3.73AD7834@mindspring.com> Date: Fri, 09 Nov 2001 13:54:43 -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: Jason Mawdsley Cc: 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> 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 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