* tests/test-free.c (main): Use sysconf (_SC_PAGESIZE) instead of
getpagesize, as this code is compiled only on platforms that have
_SC_PAGESIZE and POSIX prefers the latter.
---
 ChangeLog         | 5 +++++
 tests/test-free.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 19ecdc1a67..36371ad8e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-06-14  Paul Eggert  <egg...@cs.ucla.edu>
 
+       free-posix-tests: port to plain POSIX
+       * tests/test-free.c (main): Use sysconf (_SC_PAGESIZE) instead of
+       getpagesize, as this code is compiled only on platforms that have
+       _SC_PAGESIZE and POSIX prefers the latter.
+
        maint: avoid some test getpagesize dependencies
        * modules/memcasecmp-tests, modules/memchr-tests:
        * modules/memchr2-tests, modules/memcmp-tests:
diff --git a/tests/test-free.c b/tests/test-free.c
index 70e481b599..b0c084da79 100644
--- a/tests/test-free.c
+++ b/tests/test-free.c
@@ -121,7 +121,7 @@ main ()
   if (open ("/proc/sys/vm/max_map_count", O_RDONLY) >= 0)
     {
       /* Preparations.  */
-      size_t pagesize = getpagesize ();
+      size_t pagesize = sysconf (_SC_PAGESIZE);
       void *firstpage_backup = malloc (pagesize);
       void *lastpage_backup = malloc (pagesize);
       /* Allocate a large memory area, as a bumper, so that the MAP_FIXED
-- 
2.45.2


Reply via email to