[PATCH v3 02/29] Prepare for the addition of the <sys/pagesize.h> header

Florian Weimer fweimer@redhat.com
Tue Oct 1 22:54:56 GMT 2024


* Paul Eggert:

> On 2024-10-01 11:22, Maciej W. Rozycki wrote:
>>   And why is it going to be a problem?
>
> It's in a standard as a constraint, which means standard compilers are
> required to issue a diagnostic, unfortunately.

We already have __extern_inline in <sys/cdefs.h> for that.  It's used
for things like bsearch.  This patch adds more inline functions like
that:

  [PATCH v3 29/29] Optimize various ways to obtain the page size using
  <bits/pagesize.h>
  <https://inbox.sourceware.org/libc-alpha/52aa57f9ba1971262b8aaa5c705b2a260e6c09eb.1727624528.git.fweimer@redhat.com/>

The tricky part is that we want to tell GCC that sysconf (_SC_PAGE_SIZE)
is a constant, but sysconf in general is not __attribute__
((__const__)).  The easiest way to implement that is to call
__getpagesize, which has the right attribute.  The patch doesn't
implement that, though.

Thanks,
Florian



More information about the Libc-alpha mailing list