From 3f0806aa1fc8c8dc2f294421d558472faec7fd3f Mon Sep 17 00:00:00 2001 From: davidxu Date: Fri, 17 Aug 2012 02:26:31 +0000 Subject: 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 --- lib/libthr/thread/thr_getcpuclockid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libthr') diff --git a/lib/libthr/thread/thr_getcpuclockid.c b/lib/libthr/thread/thr_getcpuclockid.c index 68f88d5..b4ec666 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); } -- cgit v1.1