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.
Shouldn't <unistd.h> come from [AC_INCLUDES_DEFAULT]?
Yes. I didn't see the need for urgent changes there, though. The code should work as-is, and although it may be suboptimal right now we're limiting ourselves to bug fixes.
From 8e7281d7bebb5e389befe6e9a5afbb7b2ae13ae0 Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Wed, 17 May 2023 11:50:27 -0700 Subject: [PATCH] Improve AC_FUNC_MMAP comments * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Add comment. --- lib/autoconf/functions.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 3d6e4aca..54d04cc3 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1311,6 +1311,8 @@ AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped], #include <sys/mman.h> #ifndef getpagesize +/* Prefer sysconf to the legacy getpagesize function, as getpagesize has + been removed from POSIX and is limited to page sizes that fit in 'int'. */ # ifdef _SC_PAGESIZE # define getpagesize() sysconf (_SC_PAGESIZE) # elif defined _SC_PAGE_SIZE -- 2.39.2