* [PATCH v2] nptl: Fix tst-cancel30 on kernels without ppoll_time64 support
@ 2024-04-19 11:47 Florian Weimer
2024-04-23 19:03 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2024-04-19 11:47 UTC (permalink / raw)
To: libc-alpha
Fall back to ppoll if ppoll_time64 fails with ENOSYS.
Fixes commit 370da8a121c3ba9eeb2f13da15fc0f21f4136b25 ("nptl: Fix
tst-cancel30 on sparc64").
---
v2: Fix build failure on 32-bit RISC-V.
sysdeps/pthread/tst-cancel30.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/sysdeps/pthread/tst-cancel30.c b/sysdeps/pthread/tst-cancel30.c
index 3030660e5f..94ad6281bc 100644
--- a/sysdeps/pthread/tst-cancel30.c
+++ b/sysdeps/pthread/tst-cancel30.c
@@ -18,6 +18,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <errno.h>
#include <support/check.h>
#include <support/xstdio.h>
#include <support/xthread.h>
@@ -46,13 +47,19 @@ tf (void *arg)
/* Wait indefinitely for cancellation, which only works if asynchronous
cancellation is enabled. */
-#if defined SYS_ppoll || defined SYS_ppoll_time64
-# ifndef SYS_ppoll_time64
-# define SYS_ppoll_time64 SYS_ppoll
+#ifdef SYS_ppoll_time64
+ long int ret = syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
+ (void) ret;
+# ifdef SYS_ppoll
+ if (ret == -1 && errno == ENOSYS)
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
# endif
- syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
#else
+# ifdef SYS_ppoll
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
+# else
for (;;);
+# endif
#endif
return 0;
base-commit: 0997c3d0c87433ac8c78043aaa9b6b7e91df2882
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] nptl: Fix tst-cancel30 on kernels without ppoll_time64 support
2024-04-19 11:47 [PATCH v2] nptl: Fix tst-cancel30 on kernels without ppoll_time64 support Florian Weimer
@ 2024-04-23 19:03 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2024-04-23 19:03 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 19/04/24 08:47, Florian Weimer wrote:
> Fall back to ppoll if ppoll_time64 fails with ENOSYS.
> Fixes commit 370da8a121c3ba9eeb2f13da15fc0f21f4136b25 ("nptl: Fix
> tst-cancel30 on sparc64").
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> ---
> v2: Fix build failure on 32-bit RISC-V.
> sysdeps/pthread/tst-cancel30.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/sysdeps/pthread/tst-cancel30.c b/sysdeps/pthread/tst-cancel30.c
> index 3030660e5f..94ad6281bc 100644
> --- a/sysdeps/pthread/tst-cancel30.c
> +++ b/sysdeps/pthread/tst-cancel30.c
> @@ -18,6 +18,7 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> +#include <errno.h>
> #include <support/check.h>
> #include <support/xstdio.h>
> #include <support/xthread.h>
> @@ -46,13 +47,19 @@ tf (void *arg)
>
> /* Wait indefinitely for cancellation, which only works if asynchronous
> cancellation is enabled. */
> -#if defined SYS_ppoll || defined SYS_ppoll_time64
> -# ifndef SYS_ppoll_time64
> -# define SYS_ppoll_time64 SYS_ppoll
> +#ifdef SYS_ppoll_time64
> + long int ret = syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
> + (void) ret;
> +# ifdef SYS_ppoll
> + if (ret == -1 && errno == ENOSYS)
> + syscall (SYS_ppoll, NULL, 0, NULL, NULL);
> # endif
> - syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
> #else
> +# ifdef SYS_ppoll
> + syscall (SYS_ppoll, NULL, 0, NULL, NULL);
> +# else
> for (;;);
> +# endif
> #endif
>
> return 0;
>
> base-commit: 0997c3d0c87433ac8c78043aaa9b6b7e91df2882
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-23 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 11:47 [PATCH v2] nptl: Fix tst-cancel30 on kernels without ppoll_time64 support Florian Weimer
2024-04-23 19:03 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).