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@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Willy Tarreau 2022-02-07 17:23:50 +01:00 committed by Paul E. McKenney
parent 4619de3446
commit 180a9797b0
1 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,14 @@ unsigned int sleep(unsigned int seconds)
return 0; 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)) static __attribute__((unused))
int tcsetpgrp(int fd, pid_t pid) int tcsetpgrp(int fd, pid_t pid)
{ {