1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include <errno.h>
- #include <pthreadP.h>
- #include <sys/time.h>
- #include <tls.h>
- int
- pthread_getcpuclockid (
- pthread_t threadid,
- clockid_t *clockid)
- {
- struct pthread *pd = (struct pthread *) threadid;
-
- if (INVALID_TD_P (pd))
-
- return ESRCH;
- #ifdef CLOCK_THREAD_CPUTIME_ID
-
- if (pd->tid >= 1 << (8 * sizeof (*clockid) - CLOCK_IDFIELD_SIZE))
- return ERANGE;
-
- *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE);
- return 0;
- #else
-
- return ENOENT;
- #endif
- }
|