bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_FUNC_MMAP lacks <unistd.h> include?


From: Paul Eggert
Subject: Re: AC_FUNC_MMAP lacks <unistd.h> include?
Date: Wed, 17 May 2023 11:52:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

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.

Attachment: 0001-Improve-AC_FUNC_MMAP-comments.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]