nptl: Fix tst-cancel30 on kernels without ppoll_time64 support

Fall back to ppoll if ppoll_time64 fails with ENOSYS.
Fixes commit 370da8a121 ("nptl: Fix
tst-cancel30 on sparc64").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer 2024-04-23 21:16:32 +02:00
parent 16c8dfba14
commit f4724843ad

View File

@ -18,6 +18,7 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <support/check.h> #include <support/check.h>
#include <support/xstdio.h> #include <support/xstdio.h>
#include <support/xthread.h> #include <support/xthread.h>
@ -46,13 +47,19 @@ tf (void *arg)
/* Wait indefinitely for cancellation, which only works if asynchronous /* Wait indefinitely for cancellation, which only works if asynchronous
cancellation is enabled. */ cancellation is enabled. */
#if defined SYS_ppoll || defined SYS_ppoll_time64 #ifdef SYS_ppoll_time64
# ifndef SYS_ppoll_time64 long int ret = syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
# define SYS_ppoll_time64 SYS_ppoll (void) ret;
# ifdef SYS_ppoll
if (ret == -1 && errno == ENOSYS)
syscall (SYS_ppoll, NULL, 0, NULL, NULL);
# endif # endif
syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
#else #else
# ifdef SYS_ppoll
syscall (SYS_ppoll, NULL, 0, NULL, NULL);
# else
for (;;); for (;;);
# endif
#endif #endif
return 0; return 0;