Return the correct value for sysconf(_SC_PAGESIZE)

Erik Bray
Tue Nov 15 15:47:00 GMT 2016

On Tue, Nov 15, 2016 at 3:58 PM, Corinna Vinschen
<> wrote:
> On Nov 15 14:51, Erik Bray wrote:
>> Greetings,
>> Currently sysconf(_SC_PAGESIZE) returns the value of
>> wincap.allocation_granularity()--a change I *think* had to have been
>> made by mistake in
>> There's no obvious reason, anyways, that this value should be returned
>> and not the actual page size.
> That's no accident, but a deliberate decision.  Originally we used the
> page size at this point, but that's long ago.  This has been discussed
> on the cygwin-developers mailing list years ago.  The problem is the
> POSIX assumption that the allocation granularity equals the page size.
> The only working solution which does not break assumptions is to return
> the allocation granularity as page size.

Okay, sorry for suggesting otherwise.  When I looked at that commit it
seemed like a there was a lot of mass renaming going on, so I thought
it might have been an accident.  I didn't see the threads where this
was discussed.

I see the reason for the change now, but the fact remains
sysconf(_SC_PAGESIZE) cannot, then, be relied on to make any
memory-related calculations from page counts.  Is there a different
(posix-compliant) way to get the actual page size, or at least maybe
it could be somewhere in /proc?

Sorry otherwise for the noise.


More information about the Cygwin-patches mailing list