[PATCH] Core: use sysconf(_SC_PAGESIZE) instead of getpagesize()
piotrsikora at google.com
Fri Dec 4 03:24:51 UTC 2015
> Any practical reasons for the change?
Kind of... OS X doesn't expose getpagesize() when it's compiled with
_POSIX_C_SOURCE >= 200112L and no other define (not even
_DARWIN_C_SOURCE) can change that.
Side note: I considered adding _DARWIN_C_SOURCE to
ngx_darwin_config.h, like it's done for _GNU_SOURCE, but I decided
against it, because I found the ability to enforce strict POSIX
interface (even if it doesn't really work right now) quite handy...
and it's off by default, so someone needs to force it anyway.
> While getpagesize() isn't required by the current issue of POSIX,
> it is easier to use and used to be more widely available than
Considering that sysconf(_SC_PAGESIZE) is part of POSIX and
getpagesize() isn't, I don't believe this is true anymore.
> The cast looks unneeded.
It's signed-to-unsigned conversion... it's a little bit on the
pedantic side, but I wouldn't say it's unneeded... and it follows
style from similar cast just few lines below.
More information about the nginx-devel