On Wed, Jun 01, 2011 at 09:21:27AM -0700, Dan Fandrich wrote:
> 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.

BTW the correct argument to sysconf is _SC_PAGESIZE, not _sc_pagesize.

Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to