[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FUNC_MMAP lacks <unistd.h> include?
From: |
Florian Weimer |
Subject: |
Re: AC_FUNC_MMAP lacks <unistd.h> include? |
Date: |
Wed, 17 May 2023 21:25:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
* 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