i386: ulp update for SSE2 --disable-multi-arch configurations
[glibc.git] / sysdeps / unix / sysv / linux / kernel-posix-cpu-timers.h
blobbea1e0e62daa51a823bbe7ca5289c14c3a1451f7
1 /*
2 Parameters for the Linux kernel ABI for CPU clocks, the bit fields within
3 a clockid:
5 - The most significant 29 bits hold either a pid or a file descriptor.
6 - Bit 2 indicates whether a cpu clock refers to a thread or a process.
7 - Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
8 - A clockid is invalid if bits 2, 1, and 0 are all set.
9 */
11 #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
12 #define CPUCLOCK_PERTHREAD(clock) \
13 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
14 #define CPUCLOCK_PID_MASK 7
15 #define CPUCLOCK_PERTHREAD_MASK 4
16 #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
17 #define CPUCLOCK_CLOCK_MASK 3
18 #define CPUCLOCK_PROF 0
19 #define CPUCLOCK_VIRT 1
20 #define CPUCLOCK_SCHED 2
21 #define CPUCLOCK_MAX 3
23 static inline clockid_t
24 make_process_cpuclock (unsigned int pid, clockid_t clock)
26 return ((~pid) << 3) | clock;
29 static inline clockid_t
30 make_thread_cpuclock (unsigned int tid, clockid_t clock)
32 return make_process_cpuclock (tid, clock | CPUCLOCK_PERTHREAD_MASK);
35 #define PROCESS_CLOCK make_process_cpuclock (0, CPUCLOCK_SCHED)
36 #define THREAD_CLOCK make_thread_cpuclock (0, CPUCLOCK_SCHED)