[PATCH 3/5] Use sysconf(_SC_PAGESIZE) to determine PAGE_SIZE
Rich Felker
dalias at aerifal.cx
Fri Jun 3 22:38:11 UTC 2011
On Fri, Jun 03, 2011 at 09:29:26PM +0200, Denys Vlasenko wrote:
> Moreover, PAGE_SIZE is only used for
>
> mallopt(M_TRIM_THRESHOLD, 2 * PAGE_SIZE);
> mallopt(M_MMAP_THRESHOLD, 8 * PAGE_SIZE - 256);
>
> We can simply use fixed constants instead.
Agreed. The cleanest is:
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif
Or perhaps even remove the use of PAGE_SIZE altogether and just use
4k everywhere. I think this code seriously raises a question as to
whether it's using PAGE_SIZE to mean "the system page size" or whether
it's using PAGE_SIZE to mean "4096 but we don't want to write a magic
number in the source so we picked a macro whose value happened to be
4096" and I suspect it's the latter....
Rich
More information about the busybox
mailing list