fix broken lseek on mipsn32 with offsets larger than LONG_MAX
[musl] / src / time / clock_nanosleep.c
index 721e794..32f0c07 100644 (file)
@@ -1,12 +1,9 @@
 #include <time.h>
+#include <errno.h>
 #include "syscall.h"
-#include "libc.h"
 
 int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
 {
-       int ret;
-       CANCELPT_BEGIN;
-       ret = -__syscall(__NR_clock_nanosleep, clk, flags, req, rem);
-       CANCELPT_END;
-       return ret;
+       int r = -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem);
+       return clk == CLOCK_THREAD_CPUTIME_ID ? EINVAL : r;
 }