Commit f916d77e authored by Mark Brown's avatar Mark Brown Committed by Paul E. McKenney

tools/nolibc: Implement msleep()

Allow users to implement shorter delays than a full second by implementing
msleep().
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 9a83f9ae
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment