Re: AC_FUNC_MMAP lacks <unistd.h> include?

Florian Weimer <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
* Paul Eggert:

> On 2023-05-17 11:14, Florian Weimer wrote:
> +#ifndef getpagesize
>>> +# ifdef _SC_PAGESIZE
>>> +#  define getpagesize() sysconf (_SC_PAGESIZE)
>>> +# elif defined _SC_PAGE_SIZE
>>> +#  define getpagesize() sysconf (_SC_PAGE_SIZE)
>>> +# elif HAVE_GETPAGESIZE
>>> +int getpagesize ();
>> Isn't this a bit weird?  Why can't we rely on the HAVE_GETPAGESIZE
>> check?
>
> POSIX has standardized on sysconf; it no longer specifies
> getpagesize. Also, getpagesize doesn't work for page sizes greater
> than INT_MAX. For both reasons, it's better to prefer sysconf to
> getpagesize nowadays. I installed the attached patch to try to make
> this clearer.

But then HAVE_GETPAGESIZE probably should not succeed spuriously because
of an implicit function declaration.

I still suspect there is something peculiar to libgtop that triggers
this, such as some late -D_XOPEN_SOURCE somewhere, or conditional
execution of the HAVE_UNISTD_H check.

Thanks,
Florian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.