free-posix-tests: port to plain POSIX
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 17:54:36 +0000 (10:54 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 20:19:04 +0000 (13:19 -0700)
* 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
tests/test-free.c

index 19ecdc1a6705da2481362d84e14a9eb1c3e04012..36371ad8e41194a5fa86fffb650f1d28eb8d425e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-06-14  Paul Eggert  <eggert@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:
index 70e481b59923310ff8566cb7c34d1d254ad0351b..b0c084da795e7718c7213b0c8ffbbd04f80e313e 100644 (file)
@@ -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