From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 29 07:15:36 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E23816A41F for ; Wed, 29 Mar 2006 07:15:36 +0000 (UTC) (envelope-from dr2867@pacbell.net) Received: from smtp108.sbc.mail.mud.yahoo.com (smtp108.sbc.mail.mud.yahoo.com [68.142.198.207]) by mx1.FreeBSD.org (Postfix) with SMTP id DA15D43D45 for ; Wed, 29 Mar 2006 07:15:35 +0000 (GMT) (envelope-from dr2867@pacbell.net) Received: (qmail 45561 invoked from network); 29 Mar 2006 07:15:35 -0000 Received: from unknown (HELO ?192.168.0.190?) (dr2867.business@pacbell.net@71.146.9.168 with plain) by smtp108.sbc.mail.mud.yahoo.com with SMTP; 29 Mar 2006 07:15:35 -0000 Message-ID: <442A3456.3070100@pacbell.net> Date: Tue, 28 Mar 2006 23:16:38 -0800 From: Daniel Rudy User-Agent: Mozilla/5.0 (X11R6; UNIX; FreeBSD/i386 6.0-RELEASE-p4; en-US; ja-JP; en-US; rv:1.7.11) Gecko/20050728 Mnenhy/0.7.2.0 MIME-Version: 1.0 To: Norbert Koch References: <442A2918.9050804@pacbell.net> <442A2C62.4030003@demig.de> In-Reply-To: <442A2C62.4030003@demig.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: What is the proper use of mlock(2)/munlock(2)? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2006 07:15:36 -0000 At about the time of 3/28/2006 10:42 PM, Norbert Koch stated the following: > > Daniel Rudy schrieb: >> Hello FreeBSD Hackers, >> >> I've been reading the man page on mlock(2) and a number of questions >> have arisen about it's use. I have looked at malloc and mmap, and I >> have not been able to figure this one out. There doesn't seem to be any >> compiler or library options dealing with this either. >> >> 1) How do you make sure that an allocated address range has been aligned >> on a multiple of the page size given FreeBSD's virtual address map? > > Memory allocated by calling mmap(2) is always page aligned. And its > size is always rounded up to a multiple of getpagesize(3). > > From mmap(2): > > The mmap() function causes the **pages** starting at addr and continuing > for at most len bytes to be mapped from the object described by fd, > starting at byte offset offset. If len is not a multiple of the > pagesize, the mapped region **may extend past** the specified range. > Any such extension beyond the end of the mapped object will be > zero-filled. > > > Norbert > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > I'm not sure why I missed that, but thank you for pointing that out. -- Daniel Rudy