From 470ff37c8d17b7f3c46d6140e809d2e7062d6140 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 8 Jan 2025 22:24:13 +0100 Subject: [PATCH] sys_select-h: Update for POSIX:2024. * lib/sys_select.in.h (rpl_fd_isset): Change type of second parameter to 'const fd_set *'. * tests/test-sys_select-h.c: Check for some more types and for FD_SETSIZE. (FD_ISSET): Expect type of second parameter to be 'const fd_set *'. --- ChangeLog | 9 +++++++++ lib/sys_select.in.h | 2 +- tests/test-sys_select-h.c | 18 +++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7c964d776..f19baf6d87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-01-08 Bruno Haible + + sys_select-h: Update for POSIX:2024. + * lib/sys_select.in.h (rpl_fd_isset): Change type of second parameter to + 'const fd_set *'. + * tests/test-sys_select-h.c: Check for some more types and for + FD_SETSIZE. + (FD_ISSET): Expect type of second parameter to be 'const fd_set *'. + 2025-01-08 Bruno Haible doc: Document the previous change. diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index fd3e28fd8e..f55687b571 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -170,7 +170,7 @@ /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ static int -rpl_fd_isset (SOCKET fd, fd_set * set) +rpl_fd_isset (SOCKET fd, const fd_set * set) { u_int i; if (set == NULL) diff --git a/tests/test-sys_select-h.c b/tests/test-sys_select-h.c index 2d70fcb0e3..08aa83e000 100644 --- a/tests/test-sys_select-h.c +++ b/tests/test-sys_select-h.c @@ -18,6 +18,7 @@ #include +/* Specification. */ #include /* Check that the 'struct timeval' type is defined. */ @@ -30,6 +31,21 @@ typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; /* Check that sigset_t is defined. */ sigset_t t2; +/* Check that time_t, suseconds_t are defined. */ +time_t t3; +suseconds_t t4; + +/* Check that the 'struct timespec' type is defined. */ +struct timespec t5; + +/* Check that the 'fd_set' type is defined. */ +fd_set t6; + +/* Check that FD_SETSIZE is defined. */ +#if !FD_SETSIZE +# error "FD_SETSIZE not positive" +#endif + #include "signature.h" /* The following may be macros without underlying functions, so only @@ -38,7 +54,7 @@ sigset_t t2; SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *)); #endif #ifndef FD_ISSET -SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *)); +SIGNATURE_CHECK (FD_ISSET, void, (int, const fd_set *)); #endif #ifndef FD_SET SIGNATURE_CHECK (FD_SET, int, (int, fd_set *)); -- 2.39.5