[PATCH] tools/nolibc: Implement msleep()

From: Mark Brown
Date: Tue May 11 2021 - 07:03:45 EST


Allow users to implement shorter delays than a full second by implementing
msleep().

Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
tools/include/nolibc/nolibc.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 8b7a9830dd22..d045d8bb5f0a 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -2243,6 +2243,14 @@ unsigned int sleep(unsigned int seconds)
return 0;
}

+static __attribute__((unused))
+void msleep(unsigned int msecs)
+{
+ struct timeval my_timeval = { 0, msecs * 1000 };
+
+ sys_select(0, 0, 0, 0, &my_timeval);
+}
+
static __attribute__((unused))
int stat(const char *path, struct stat *buf)
{
--
2.20.1