]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv-tests: port to plain POSIX
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 17:58:24 +0000 (10:58 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 20:19:04 +0000 (13:19 -0700)
* tests/test-sigsegv-catch-segv1.c, tests/test-sigsegv-catch-segv2.c:
(SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS):
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-sigsegv-catch-segv1.c
tests/test-sigsegv-catch-segv2.c

index 36371ad8e41194a5fa86fffb650f1d28eb8d425e..8dcf7133a9a7e85db9b55beee99f2d34e26e0a0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,12 @@
 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.
+       free-posix-tests, sigsegv-tests: port to plain POSIX
+       * tests/test-free.c (main):
+       * tests/test-sigsegv-catch-segv1.c, tests/test-sigsegv-catch-segv2.c:
+       (SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS):
+       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:
index 8c04ef0888adf456cf657b1c3b3b81ba04608ab1..b1d848c79fc6e059d1578b7d4c6e5f6e2a149bfe 100644 (file)
@@ -31,7 +31,7 @@
 
 # if SIGSEGV_FAULT_ADDRESS_ALIGNMENT > 1UL
 #  include <unistd.h>
-#  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (getpagesize () - 1)
+#  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (sysconf (_SC_PAGESIZE) - 1)
 # else
 #  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0
 # endif
index 397359e344f81ada28af58bf0233a9bee13d105e..27320b14a5dec01d6aee66d573e49c9d19fb594e 100644 (file)
@@ -40,7 +40,7 @@
 
 # if SIGSEGV_FAULT_ADDRESS_ALIGNMENT > 1UL
 #  include <unistd.h>
-#  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (getpagesize () - 1)
+#  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS (sysconf (_SC_PAGESIZE) - 1)
 # else
 #  define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0
 # endif