* [PATCH v3] tools/nolibc: Implement msleep()
@ 2021-05-12 12:32 Mark Brown
2021-05-12 13:21 ` Willy Tarreau
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2021-05-12 12:32 UTC (permalink / raw)
To: Willy Tarreau; +Cc: linux-kernel, Mark Brown
Allow users to implement shorter delays than a full second by implementing
msleep().
Signed-off-by: Mark Brown <broonie@kernel.org>
---
v3:
- Return the number of milliseconds remaining if the delay does not
complete.
v2:
- Support delays of more than a second.
- Return the number of seconds remaining if the delay does not
complete.
tools/include/nolibc/nolibc.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 8b7a9830dd22..ba6b6f1ad846 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -2243,6 +2243,19 @@ unsigned int sleep(unsigned int seconds)
return 0;
}
+static __attribute__((unused))
+int msleep(unsigned int msecs)
+{
+ struct timeval my_timeval = { msecs / 1000, (msecs % 1000) * 1000 };
+
+ if (sys_select(0, 0, 0, 0, &my_timeval) < 0)
+ return (my_timeval.tv_sec * 1000) +
+ (my_timeval.tv_usec / 1000) +
+ !!(my_timeval.tv_usec % 1000);
+ else
+ return 0;
+}
+
static __attribute__((unused))
int stat(const char *path, struct stat *buf)
{
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] tools/nolibc: Implement msleep()
2021-05-12 12:32 [PATCH v3] tools/nolibc: Implement msleep() Mark Brown
@ 2021-05-12 13:21 ` Willy Tarreau
2021-06-22 16:48 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Willy Tarreau @ 2021-05-12 13:21 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel
On Wed, May 12, 2021 at 01:32:15PM +0100, Mark Brown wrote:
> Allow users to implement shorter delays than a full second by implementing
> msleep().
>
> Signed-off-by: Mark Brown <broonie@kernel.org>
Great, now queued, thank you Mark!
Willy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] tools/nolibc: Implement msleep()
2021-05-12 13:21 ` Willy Tarreau
@ 2021-06-22 16:48 ` Mark Brown
2021-06-22 16:51 ` Willy Tarreau
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2021-06-22 16:48 UTC (permalink / raw)
To: Willy Tarreau; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Wed, May 12, 2021 at 03:21:02PM +0200, Willy Tarreau wrote:
> On Wed, May 12, 2021 at 01:32:15PM +0100, Mark Brown wrote:
> > Allow users to implement shorter delays than a full second by implementing
> > msleep().
> >
> > Signed-off-by: Mark Brown <broonie@kernel.org>
> Great, now queued, thank you Mark!
This doesn't seem to be showing up in -next, did it get missed or is the
queue it's in not in -next?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] tools/nolibc: Implement msleep()
2021-06-22 16:48 ` Mark Brown
@ 2021-06-22 16:51 ` Willy Tarreau
0 siblings, 0 replies; 4+ messages in thread
From: Willy Tarreau @ 2021-06-22 16:51 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel
Hi Mark,
On Tue, Jun 22, 2021 at 05:48:04PM +0100, Mark Brown wrote:
> On Wed, May 12, 2021 at 03:21:02PM +0200, Willy Tarreau wrote:
> > On Wed, May 12, 2021 at 01:32:15PM +0100, Mark Brown wrote:
> > > Allow users to implement shorter delays than a full second by implementing
> > > msleep().
> > >
> > > Signed-off-by: Mark Brown <broonie@kernel.org>
>
> > Great, now queued, thank you Mark!
>
> This doesn't seem to be showing up in -next, did it get missed or is the
> queue it's in not in -next?
I planned to send the two patches I have in this branch to Paul
this week, will do so ASAP.
Thanks,
Willy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-22 16:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 12:32 [PATCH v3] tools/nolibc: Implement msleep() Mark Brown
2021-05-12 13:21 ` Willy Tarreau
2021-06-22 16:48 ` Mark Brown
2021-06-22 16:51 ` Willy Tarreau
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 NNTP newsgroup(s).