libc: Add usleep
authorAlan Cox <alan@etchedpixels.co.uk>
Wed, 21 Oct 2015 11:46:09 +0000 (12:46 +0100)
committerAlan Cox <alan@etchedpixels.co.uk>
Wed, 21 Oct 2015 11:46:09 +0000 (12:46 +0100)
It's just another mapping onto _pause()

Library/include/unistd.h
Library/libs/Makefile
Library/libs/Makefile.6502
Library/libs/Makefile.6809
Library/libs/usleep.c [new file with mode: 0644]

index 616d26e..9f34bdc 100644 (file)
@@ -24,6 +24,7 @@ extern int lstat __P((const char *, struct stat *));
 extern int readlink __P((const char *, char *, int));
 
 extern unsigned int sleep __P((unsigned int seconds));
+extern int usleep __P((useconds_t usecs));
 
 extern char **environ;
 
index d5953e9..51f8b87 100644 (file)
@@ -41,7 +41,7 @@ SRC_C += stat.c stdio0.c stime.c
 SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
 SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c strsignal.c
 SRC_C += strtod.c strtol.c system.c time.c tmpfile.c tmpnam.c ttyname.c
-SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c
+SRC_C += tzset.c ungetc.c usleep.c utent.c utimes.c utsname.c
 SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
 SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
 # ctype
index 3a2ddf0..f731c2e 100644 (file)
@@ -52,7 +52,7 @@ SRC_C += stat.c stdio0.c stime.c
 SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
 SRC_C += strnicmp.c strnlen.c strsep.c strsignal.c
 SRC_C += system.c time.c tmpfile.c tmpnam.c ttyname.c
-SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c
+SRC_C += tzset.c ungetc.c usleep.c utent.c utimes.c utsname.c
 SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
 SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
 SRC_C += strtol.c
index 158ac6f..38af7f8 100644 (file)
@@ -33,7 +33,7 @@ SRC_C += stat.c stdio0.c stime.c
 SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
 SRC_C += strnlen.c strnicmp.c strsep.c strsignal.c strxfrm.c strcoll.c
 SRC_C += strtod.c strtol.c system.c time.c tmpfile.c tmpnam.c ttyname.c
-SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c
+SRC_C += tzset.c ungetc.c usleep.c utent.c utimes.c utsname.c
 SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
 SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
 # ctype
diff --git a/Library/libs/usleep.c b/Library/libs/usleep.c
new file mode 100644 (file)
index 0000000..fc13fa6
--- /dev/null
@@ -0,0 +1,11 @@
+/* usleep.c
+ */
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <syscalls.h>
+
+int usleep(useconds_t us)
+{
+       return _pause(us/100000UL);
+}