diff options
Diffstat (limited to 'include/linux/posix-timers.h')
| -rw-r--r-- | include/linux/posix-timers.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 672c4f32311e..c85704fcdbd2 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
| @@ -42,13 +42,26 @@ struct cpu_timer_list { | |||
| 42 | #define CLOCKFD CPUCLOCK_MAX | 42 | #define CLOCKFD CPUCLOCK_MAX |
| 43 | #define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK) | 43 | #define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK) |
| 44 | 44 | ||
| 45 | #define MAKE_PROCESS_CPUCLOCK(pid, clock) \ | 45 | static inline clockid_t make_process_cpuclock(const unsigned int pid, |
| 46 | ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) | 46 | const clockid_t clock) |
| 47 | #define MAKE_THREAD_CPUCLOCK(tid, clock) \ | 47 | { |
| 48 | MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) | 48 | return ((~pid) << 3) | clock; |
| 49 | } | ||
| 50 | static inline clockid_t make_thread_cpuclock(const unsigned int tid, | ||
| 51 | const clockid_t clock) | ||
| 52 | { | ||
| 53 | return make_process_cpuclock(tid, clock | CPUCLOCK_PERTHREAD_MASK); | ||
| 54 | } | ||
| 49 | 55 | ||
| 50 | #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) | 56 | static inline clockid_t fd_to_clockid(const int fd) |
| 51 | #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) | 57 | { |
| 58 | return make_process_cpuclock((unsigned int) fd, CLOCKFD); | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline int clockid_to_fd(const clockid_t clk) | ||
| 62 | { | ||
| 63 | return ~(clk >> 3); | ||
| 64 | } | ||
| 52 | 65 | ||
| 53 | #define REQUEUE_PENDING 1 | 66 | #define REQUEUE_PENDING 1 |
| 54 | 67 | ||
