From: Philip Homburg Date: Mon, 11 Jul 2005 13:08:00 +0000 (+0000) Subject: Usleep implementation based on select. X-Git-Tag: v3.1.0~629 X-Git-Url: http://zhaoyanbai.com/repos/man.named.html?a=commitdiff_plain;h=0cabfc76eeae77a680a6d965818d688caa2b38a0;p=minix.git Usleep implementation based on select. --- 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; +}