about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/time/clock_getcpuclockid.c11
-rw-r--r--src/time/clock_getres.c8
-rw-r--r--src/time/clock_gettime.c1
-rw-r--r--src/time/clock_nanosleep.c8
-rw-r--r--src/time/clock_settime.c8
5 files changed, 36 insertions, 0 deletions
diff --git a/src/time/clock_getcpuclockid.c b/src/time/clock_getcpuclockid.c
new file mode 100644
index 00000000..723840b0
--- /dev/null
+++ b/src/time/clock_getcpuclockid.c
@@ -0,0 +1,11 @@
+#include <time.h>
+#include <errno.h>
+#include <unistd.h>
+#include "syscall.h"
+
+int clock_getcpuclockid(pid_t pid, clockid_t *clk)
+{
+	if (pid && pid != getpid()) return EPERM;
+	*clk = CLOCK_PROCESS_CPUTIME_ID;
+	return 0;
+}
diff --git a/src/time/clock_getres.c b/src/time/clock_getres.c
new file mode 100644
index 00000000..e86a1ee4
--- /dev/null
+++ b/src/time/clock_getres.c
@@ -0,0 +1,8 @@
+#define SYSCALL_RETURN_ERRNO
+#include <time.h>
+#include "syscall.h"
+
+int clock_getres(clockid_t clk, struct timespec *ts)
+{
+	return syscall2(__NR_clock_getres, clk, (long)ts);
+}
diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c
index dab09d50..6b880a06 100644
--- a/src/time/clock_gettime.c
+++ b/src/time/clock_gettime.c
@@ -1,3 +1,4 @@
+#define SYSCALL_RETURN_ERRNO
 #include <time.h>
 #include "syscall.h"
 
diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c
new file mode 100644
index 00000000..c5646de3
--- /dev/null
+++ b/src/time/clock_nanosleep.c
@@ -0,0 +1,8 @@
+#define SYSCALL_RETURN_ERRNO
+#include <time.h>
+#include "syscall.h"
+
+int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
+{
+	return syscall4(__NR_clock_nanosleep, clk, flags, (long)req, (long)rem);
+}
diff --git a/src/time/clock_settime.c b/src/time/clock_settime.c
new file mode 100644
index 00000000..e880fb33
--- /dev/null
+++ b/src/time/clock_settime.c
@@ -0,0 +1,8 @@
+#define SYSCALL_RETURN_ERRNO
+#include <time.h>
+#include "syscall.h"
+
+int clock_settime(clockid_t clk, const struct timespec *ts)
+{
+	return syscall2(__NR_clock_settime, clk, (long)ts);
+}