This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Return the correct value for sysconf(_SC_PAGESIZE)


On Tue, Nov 15, 2016 at 3:58 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> 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
>> https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;f=winsup/cygwin/sysconf.cc;h=177dc6c7f6d0608ef6540fd997d9b444e324cae2
>>
>> 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.

Thanks,
Erik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]