summaryrefslogtreecommitdiff
path: root/src/time/clock_getcpuclockid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/time/clock_getcpuclockid.c')
-rw-r--r--src/time/clock_getcpuclockid.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/time/clock_getcpuclockid.c b/src/time/clock_getcpuclockid.c
index 723840b0..8a0e2d4c 100644
--- a/src/time/clock_getcpuclockid.c
+++ b/src/time/clock_getcpuclockid.c
@@ -5,7 +5,10 @@
int clock_getcpuclockid(pid_t pid, clockid_t *clk)
{
- if (pid && pid != getpid()) return EPERM;
- *clk = CLOCK_PROCESS_CPUTIME_ID;
+ struct timespec ts;
+ clockid_t id = (-pid-1)*8U + 2;
+ int ret = __syscall(SYS_clock_getres, id, &ts);
+ if (ret) return -ret;
+ *clk = id;
return 0;
}