summaryrefslogtreecommitdiffstats
path: root/include/linux/posix-timers.h
diff options
context:
space:
mode:
authorRichard Cochran <richard.cochran@omicron.at>2011-02-01 13:52:32 +0000
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 15:28:19 +0100
commit81e294cba2596f5f10848bbe19d98b344c2a2d5c (patch)
tree4334ced22eff475275a81f7e62f1f5e9df43a433 /include/linux/posix-timers.h
parentce26efdefa5e8f22d933df72d7f7482725091d6d (diff)
downloadtalos-obmc-linux-81e294cba2596f5f10848bbe19d98b344c2a2d5c.tar.gz
talos-obmc-linux-81e294cba2596f5f10848bbe19d98b344c2a2d5c.zip
posix-timers: Add support for fd based clocks
Extend the negative clockids which are currently used by posix cpu timers to encode the PID with a file descriptor based type which encodes the fd in the upper bits. Originally-from: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <johnstul@us.ibm.com> LKML-Reference: <20110201134420.062860200@linutronix.de>
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r--include/linux/posix-timers.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 79a1cea7f6ed..88b9256169f8 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -18,6 +18,17 @@ struct cpu_timer_list {
int firing;
};
+/*
+ * Bit fields within a clockid:
+ *
+ * The most significant 29 bits hold either a pid or a file descriptor.
+ *
+ * Bit 2 indicates whether a cpu clock refers to a thread or a process.
+ *
+ * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
+ *
+ * A clockid is invalid if bits 2, 1, and 0 are all set.
+ */
#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
#define CPUCLOCK_PERTHREAD(clock) \
(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
@@ -29,6 +40,8 @@ struct cpu_timer_list {
#define CPUCLOCK_VIRT 1
#define CPUCLOCK_SCHED 2
#define CPUCLOCK_MAX 3
+#define CLOCKFD CPUCLOCK_MAX
+#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
OpenPOWER on IntegriCloud