linux-mips
[Top] [All Lists]

Re: PAGE_ALIGN + PAGE_SHIFT from userspace

To: Daniel Laird <danieljlaird@hotmail.com>
Subject: Re: PAGE_ALIGN + PAGE_SHIFT from userspace
From: Thiemo Seufer <ths@networkno.de>
Date: Mon, 18 Dec 2006 12:47:00 +0000
Cc: linux-mips@linux-mips.org
In-reply-to: <7925460.post@talk.nabble.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <7925460.post@talk.nabble.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.13 (2006-08-11)
Daniel Laird wrote:
> 
> Hi All,
> 
> I was using linux 2.6.17.13 on my MIPS and it was all going well.  I am just
> porting to 2.6.19 and am having a couple of issues.
> 
> My first issue is that i used to mmap a buffer from user space.  I used to
> use a PAGE_ALIGN macro when doing this:
> /** to align the pointer to the (next) page boundary */
> #define PAGE_ALIGN(addr)      (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
> 
> this worked as PAGE_SIZE and PAGE_MASK were available in page.h.

It didn't work reliably since the pagesize is a kernel configuration option.

> This have now been moved inside the #ifdef KERNEL guard in the header file. 
> Meaning these are no longer available.
> 
> Are these available somewhere else?
> Should I be doing something different to mmap?

Use the libc's sysconf(_SC_PAGESIZE) function.


Thiemo

<Prev in Thread] Current Thread [Next in Thread>