123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #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
- }
|