aboutsummaryrefslogtreecommitdiff
path: root/src/thread/pthread_getcpuclockid.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-06-08 11:36:41 -0400
committerRich Felker <dalias@aerifal.cx>2013-06-08 11:36:41 -0400
commitea200e38bd79723054c7ad97cbf87911eac5b7f5 (patch)
treeb4e065a5ed23be930dcf3ca33cf08d3f9a7ce023 /src/thread/pthread_getcpuclockid.c
parentprng: make rand_r have 2^32 period instead of 2^31 (diff)
downloadgrovel-ea200e38bd79723054c7ad97cbf87911eac5b7f5.tar.gz
grovel-ea200e38bd79723054c7ad97cbf87911eac5b7f5.tar.xz
support cputime clocks for processes/threads other than self
apparently these features have been in Linux for a while now, so it makes sense to support them. the bit twiddling seems utterly illogical and wasteful, especially the negation, but that's how the kernel folks chose to encode pids/tids into the clock id.
Diffstat (limited to 'src/thread/pthread_getcpuclockid.c')
-rw-r--r--src/thread/pthread_getcpuclockid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/thread/pthread_getcpuclockid.c b/src/thread/pthread_getcpuclockid.c
index cf3d2b84..9df14fb6 100644
--- a/src/thread/pthread_getcpuclockid.c
+++ b/src/thread/pthread_getcpuclockid.c
@@ -2,5 +2,6 @@
int pthread_getcpuclockid(pthread_t t, clockid_t *clockid)
{
- return ENOSYS;
+ *clockid = (-t->tid-1)*8U + 6;
+ return 0;
}