summaryrefslogtreecommitdiffstats
path: root/usr/klibc/clock_nanosleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/clock_nanosleep.c')
-rw-r--r--usr/klibc/clock_nanosleep.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr/klibc/clock_nanosleep.c b/usr/klibc/clock_nanosleep.c
new file mode 100644
index 0000000..b4fd1e2
--- /dev/null
+++ b/usr/klibc/clock_nanosleep.c
@@ -0,0 +1,17 @@
+#include <time.h>
+#include <sys/time.h>
+#include <sys/syscall.h>
+
+extern int __clock_nanosleep(clockid_t, int,
+ const struct timespec *, struct timespec *);
+
+/*
+ * POSIX says this has to return a positive error code, but the system
+ * call returns error codes in the usual way.
+ */
+int clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *request, struct timespec *remain)
+{
+ return __clock_nanosleep(clock_id, flags, request, remain) ?
+ errno : 0;
+}