On 2025-07-06 08:26:33+0200, Willy Tarreau wrote:
On Fri, Jul 04, 2025 at 04:19:48PM +0200, Thomas Weißschuh wrote:
+static __attribute__((unused)) +int sys_clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp,
struct timespec *rmtp)
+{ +#if defined(__NR_clock_nanosleep)
- return my_syscall4(__NR_clock_nanosleep, clockid, flags, rqtp, rmtp);
+#elif defined(__NR_clock_nanosleep_time64)
- struct __kernel_timespec krqtp, krmtp;
- int ret;
- __nolibc_timespec_user_to_kernel(rqtp, &krqtp);
- ret = my_syscall4(__NR_clock_nanosleep_time64, clockid, flags, &krqtp, &krmtp);
- if (rmtp)
__nolibc_timespec_kernel_to_user(&krmtp, rmtp);
- return ret;
+#else
- return __nolibc_enosys(__func__, clockid, flags, rqtp, rmtp);
+#endif
I don't know which archs do not have clock_nanosleep, but if it becomes needed on some of them, we could probably fall back to pslelect() if available, of course, and ignore the clockid.
No architecture should ever run into the #else. It is mostly for completeness and consistency with other architectures. As for falling back to pselect(), the clockid is indeed important :-)
Acked-by: Willy Tarreau w@1wt.eu
Thanks!