diff options
author | Richard Cochran <richardcochran@gmail.com> | 2011-02-01 08:52:35 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 09:28:20 -0500 |
commit | 0606f422b453f76c31ab2b1bd52943ff06a2dcf2 (patch) | |
tree | 14f4859e8492f01e97140248a28ab98355c415cf /include/linux/posix-timers.h | |
parent | 527087374faa488776a789375a7d6ea74fda6f71 (diff) |
posix clocks: Introduce dynamic clocks
This patch adds support for adding and removing posix clocks. The
clock lifetime cycle is patterned after usb devices. Each clock is
represented by a standard character device. In addition, the driver
may optionally implement custom character device operations.
The posix clock and timer system calls listed below now work with
dynamic posix clocks, as well as the traditional static clocks.
The following system calls are affected:
- clock_adjtime (brand new syscall)
- clock_gettime
- clock_getres
- clock_settime
- timer_create
- timer_delete
- timer_gettime
- timer_settime
[ tglx: Adapted to the posix-timer cleanup. Moved clock_posix_dynamic
to posix-clock.c and made all referenced functions static ]
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Acked-by: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <20110201134420.164172635@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r-- | include/linux/posix-timers.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 9d6ffe2c92e5..d51243ae0726 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -32,7 +32,7 @@ struct cpu_timer_list { | |||
32 | #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) | 32 | #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) |
33 | #define CPUCLOCK_PERTHREAD(clock) \ | 33 | #define CPUCLOCK_PERTHREAD(clock) \ |
34 | (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) | 34 | (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) |
35 | #define CPUCLOCK_PID_MASK 7 | 35 | |
36 | #define CPUCLOCK_PERTHREAD_MASK 4 | 36 | #define CPUCLOCK_PERTHREAD_MASK 4 |
37 | #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) | 37 | #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) |
38 | #define CPUCLOCK_CLOCK_MASK 3 | 38 | #define CPUCLOCK_CLOCK_MASK 3 |
@@ -48,6 +48,9 @@ struct cpu_timer_list { | |||
48 | #define MAKE_THREAD_CPUCLOCK(tid, clock) \ | 48 | #define MAKE_THREAD_CPUCLOCK(tid, clock) \ |
49 | MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) | 49 | MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) |
50 | 50 | ||
51 | #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) | ||
52 | #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) | ||
53 | |||
51 | /* POSIX.1b interval timer structure. */ | 54 | /* POSIX.1b interval timer structure. */ |
52 | struct k_itimer { | 55 | struct k_itimer { |
53 | struct list_head list; /* free/ allocate list */ | 56 | struct list_head list; /* free/ allocate list */ |
@@ -100,6 +103,7 @@ struct k_clock { | |||
100 | }; | 103 | }; |
101 | 104 | ||
102 | extern struct k_clock clock_posix_cpu; | 105 | extern struct k_clock clock_posix_cpu; |
106 | extern struct k_clock clock_posix_dynamic; | ||
103 | 107 | ||
104 | void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock); | 108 | void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock); |
105 | 109 | ||