[Pixman] [PATCH] Replace the non-standard call to getpagesize() by POSIX sysconf()

Dmitri Vorobiev dmitri.vorobiev at movial.com
Tue Sep 28 04:41:38 PDT 2010


On Tue, Sep 28, 2010 at 6:52 AM, Soeren Sandmann <sandmann at daimi.au.dk> wrote:
> Dmitri Vorobiev <dmitri.vorobiev at movial.com> writes:
>
>> Unlike sysconf(_SC_PAGESIZE), getpagesize() is not in POSIX. So,
>> let's use the former and be closer to the standard.
>
> I suspect getpagesize() is actually more widely available, especially
> considering that there is confusion about whether the constant is
> called _SC_PAGESIZE or _SC_PAGE_SIZE. Is there a specific system you
> know of where getpagesize() doesn't exist?

Just got a confirmation that at least LynxOS-178 version 2.x and
LynxOS-SE do not support getpagesize(). I don't know how much we care
about those, though :) Also, this should give more information:
http://bit.ly/ciTkZE

As for the constants, POSIX requires both to be present. A quick look
at Google code search shows that _SC_PAGESIZE has been used more
frequently.

>
>> While at it, this patch also removes an unnecessary typecast of
>> MAP_FAILED, replaces an erroneous free() by the correct munmap()
>> in the error path for a failing mprotect(), and, finally, removes
>> redundant calls to mprotect() that aren't necessary, because
>> munmap() doesn't call for any specific memory protection.
>
> All of this makes sense to me though.

I wouldn't insist on kicking getpagesize() off the code, so, will send
a patch with the clean-ups only, just in case.

Thanks,
Dmitri


More information about the Pixman mailing list