[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220207162354.14293-39-w@1wt.eu>
Date: Mon, 7 Feb 2022 17:23:50 +0100
From: Willy Tarreau <w@....eu>
To: "Paul E . McKenney" <paulmck@...nel.org>
Cc: Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org,
Willy Tarreau <w@....eu>
Subject: [PATCH 38/42] tools/nolibc/unistd: add usleep()
This call is trivial to implement based on select() to complete sleep()
and msleep(), let's add it.
Signed-off-by: Willy Tarreau <w@....eu>
---
tools/include/nolibc/unistd.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h
index 87b448ff2191..1c25e20ee360 100644
--- a/tools/include/nolibc/unistd.h
+++ b/tools/include/nolibc/unistd.h
@@ -37,6 +37,14 @@ unsigned int sleep(unsigned int seconds)
return 0;
}
+static __attribute__((unused))
+int usleep(unsigned int usecs)
+{
+ struct timeval my_timeval = { usecs / 1000000, usecs % 1000000 };
+
+ return sys_select(0, 0, 0, 0, &my_timeval);
+}
+
static __attribute__((unused))
int tcsetpgrp(int fd, pid_t pid)
{
--
2.35.1
Powered by blists - more mailing lists