From 0cabfc76eeae77a680a6d965818d688caa2b38a0 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Mon, 11 Jul 2005 13:08:00 +0000 Subject: [PATCH] Usleep implementation based on select. --- lib/posix/Makefile | 4 ++++ lib/posix/usleep.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/posix/usleep.c diff --git a/lib/posix/Makefile b/lib/posix/Makefile index 56b0f258a..a985633a7 100755 --- a/lib/posix/Makefile +++ b/lib/posix/Makefile @@ -101,6 +101,7 @@ OBJECTS = \ $(LIBRARY)(priority.o) \ $(LIBRARY)(readlink.o) \ $(LIBRARY)(symlink.o) \ + $(LIBRARY)(usleep.o) \ $(LIBRARY): $(OBJECTS) aal cr $@ *.o @@ -388,3 +389,6 @@ $(LIBRARY)(lstat.o): lstat.c $(LIBRARY)(symlink.o): symlink.c $(CC1) symlink.c +$(LIBRARY)(usleep.o): usleep.c + $(CC1) usleep.c + diff --git a/lib/posix/usleep.c b/lib/posix/usleep.c new file mode 100644 index 000000000..964e2aac8 --- /dev/null +++ b/lib/posix/usleep.c @@ -0,0 +1,18 @@ +/* +lib/posix/usleep.c +*/ + +#include +#include +#include + +int usleep(useconds_t useconds) +{ + int r; + struct timeval tv; + + tv.tv_sec= useconds/1000000; + tv.tv_usec= useconds % 1000000; + r= select(0, NULL, NULL, NULL, &tv); + return r; +} -- 2.44.0