diff options
author | David Xu <davidxu@FreeBSD.org> | 2012-08-17 02:26:31 +0000 |
---|---|---|
committer | David Xu <davidxu@FreeBSD.org> | 2012-08-17 02:26:31 +0000 |
commit | d65f1abca754505c13b3af9a6450904cf823bcdc (patch) | |
tree | 0a8a4e31773d219b58db16ff36859c4d3d4eb6cc /lib/libthr | |
parent | ee24d3b8401985c99a4a1755765fe9332daee568 (diff) | |
download | src-d65f1abca754505c13b3af9a6450904cf823bcdc.tar.gz src-d65f1abca754505c13b3af9a6450904cf823bcdc.zip |
Implement syscall clock_getcpuclockid2, so we can get a clock id
for process, thread or others we want to support.
Use the syscall to implement POSIX API clock_getcpuclock and
pthread_getcpuclockid.
PR: 168417
Notes
Notes:
svn path=/head/; revision=239347
Diffstat (limited to 'lib/libthr')
-rw-r--r-- | lib/libthr/thread/thr_getcpuclockid.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_getcpuclockid.c b/lib/libthr/thread/thr_getcpuclockid.c index 68f88d52a7e0..b4ec666930c1 100644 --- a/lib/libthr/thread/thr_getcpuclockid.c +++ b/lib/libthr/thread/thr_getcpuclockid.c @@ -39,9 +39,11 @@ __weak_reference(_pthread_getcpuclockid, pthread_getcpuclockid); int _pthread_getcpuclockid(pthread_t pthread, clockid_t *clock_id) { + if (pthread == NULL) return (EINVAL); - *clock_id = CLOCK_THREAD_CPUTIME_ID; + if (clock_getcpuclockid2(TID(pthread), CPUCLOCK_WHICH_TID, clock_id)) + return (errno); return (0); } |