[PATCH 2/2] Added support for compiling against Android bionic

Dan Fandrich dan at coneharvesters.com
Wed Jun 1 16:21:27 UTC 2011


On Wed, Jun 01, 2011 at 11:59:46AM +0200, walter harms wrote:
> I have no idea how common _sc_pagesize is.
> perhaps you should protect that _sc_pagesize like:
> 
> #ifndef PAGE_SIZE
> #ifndef _sc_pagesize
> # error "no way to find your PAGE_SIZE"
> #endif
> 
> #define PAGE_SIZE { sysconf(_sc_pagesize): }

I could do something like that, but sysconf() is in POSIX.1-2001, but
PAGE_SIZE has at least the problem that it's PAGESIZE on some systems.
PAGE_SIZE is also not necessarily accurate on systems where the page size
is dynamic. Always using sysconf seems the best approach, except for the
cost of a few extra bytes for the extra function call.

On Wed, Jun 01, 2011 at 01:54:14PM +0200, Tito wrote:
> Why don't you just include #include <asm/page.h>
> as android's sysconf.c does?

I'm trying to avoid special-casing this for various systems by using a
standards-based approach instead.

>>> Dan


More information about the busybox mailing list