* 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 | 11 +++++++---- tests/test-sigsegv-catch-segv1.c | 2 +- tests/test-sigsegv-catch-segv2.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 36371ad8e4..8dcf7133a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,12 @@ 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. + 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: diff --git a/tests/test-sigsegv-catch-segv1.c b/tests/test-sigsegv-catch-segv1.c index 8c04ef0888..b1d848c79f 100644 --- a/tests/test-sigsegv-catch-segv1.c +++ b/tests/test-sigsegv-catch-segv1.c @@ -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 diff --git a/tests/test-sigsegv-catch-segv2.c b/tests/test-sigsegv-catch-segv2.c index 397359e344..27320b14a5 100644 --- a/tests/test-sigsegv-catch-segv2.c +++ b/tests/test-sigsegv-catch-segv2.c @@ -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 -- 2.45.2