mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Willy Tarreau <w@1wt.eu>
Cc: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Shuah Khan" <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] tools/nolibc: add support for clock_nanosleep() and nanosleep()
Date: Sun, 6 Jul 2025 10:44:42 +0200	[thread overview]
Message-ID: <a8cf1929-e663-468d-a842-a1a4f4a3b2fe@t-8ch.de> (raw)
In-Reply-To: <20250706062633.GB29601@1wt.eu>

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!

      reply	other threads:[~2025-07-06  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 14:19 Thomas Weißschuh
2025-07-06  6:26 ` Willy Tarreau
2025-07-06  8:44   ` Thomas Weißschuh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8cf1929-e663-468d-a842-a1a4f4a3b2fe@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®