[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a8cf1929-e663-468d-a842-a1a4f4a3b2fe@t-8ch.de>
Date: Sun, 6 Jul 2025 10:44:42 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Willy Tarreau <w@....eu>
Cc: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH] tools/nolibc: add support for clock_nanosleep() and
nanosleep()
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@....eu>
Thanks!
Powered by blists - more mailing lists