diff options
author | John Stultz <john.stultz@linaro.org> | 2011-02-15 13:52:57 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2011-02-21 15:53:09 -0500 |
commit | 7fdd7f89006dd5a4c702fa0ce0c272345fa44ae0 (patch) | |
tree | 737c69613d51165c791609d5545de8635df99b3c /kernel | |
parent | 70a08cca1227dc31c784ec930099a4417a06e7d0 (diff) |
timers: Export CLOCK_BOOTTIME via the posix timers interface
This patch exports CLOCK_BOOTTIME through the posix timers interface
CC: Jamie Lokier <jamie@shareable.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Alexander Shishkin <virtuoso@slind.org>
CC: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/posix-timers.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 44fcff131b3..4c0124919f9 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -187,7 +187,7 @@ static int posix_ktime_get_ts(clockid_t which_clock, struct timespec *tp) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | /* | 189 | /* |
190 | * Get monotonic time for posix timers | 190 | * Get monotonic-raw time for posix timers |
191 | */ | 191 | */ |
192 | static int posix_get_monotonic_raw(clockid_t which_clock, struct timespec *tp) | 192 | static int posix_get_monotonic_raw(clockid_t which_clock, struct timespec *tp) |
193 | { | 193 | { |
@@ -214,6 +214,14 @@ static int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp | |||
214 | *tp = ktime_to_timespec(KTIME_LOW_RES); | 214 | *tp = ktime_to_timespec(KTIME_LOW_RES); |
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | |||
218 | static int posix_get_boottime(const clockid_t which_clock, struct timespec *tp) | ||
219 | { | ||
220 | get_monotonic_boottime(tp); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | |||
217 | /* | 225 | /* |
218 | * Initialize everything, well, just everything in Posix clocks/timers ;) | 226 | * Initialize everything, well, just everything in Posix clocks/timers ;) |
219 | */ | 227 | */ |
@@ -253,12 +261,23 @@ static __init int init_posix_timers(void) | |||
253 | .clock_getres = posix_get_coarse_res, | 261 | .clock_getres = posix_get_coarse_res, |
254 | .clock_get = posix_get_monotonic_coarse, | 262 | .clock_get = posix_get_monotonic_coarse, |
255 | }; | 263 | }; |
264 | struct k_clock clock_boottime = { | ||
265 | .clock_getres = hrtimer_get_res, | ||
266 | .clock_get = posix_get_boottime, | ||
267 | .nsleep = common_nsleep, | ||
268 | .nsleep_restart = hrtimer_nanosleep_restart, | ||
269 | .timer_create = common_timer_create, | ||
270 | .timer_set = common_timer_set, | ||
271 | .timer_get = common_timer_get, | ||
272 | .timer_del = common_timer_del, | ||
273 | }; | ||
256 | 274 | ||
257 | posix_timers_register_clock(CLOCK_REALTIME, &clock_realtime); | 275 | posix_timers_register_clock(CLOCK_REALTIME, &clock_realtime); |
258 | posix_timers_register_clock(CLOCK_MONOTONIC, &clock_monotonic); | 276 | posix_timers_register_clock(CLOCK_MONOTONIC, &clock_monotonic); |
259 | posix_timers_register_clock(CLOCK_MONOTONIC_RAW, &clock_monotonic_raw); | 277 | posix_timers_register_clock(CLOCK_MONOTONIC_RAW, &clock_monotonic_raw); |
260 | posix_timers_register_clock(CLOCK_REALTIME_COARSE, &clock_realtime_coarse); | 278 | posix_timers_register_clock(CLOCK_REALTIME_COARSE, &clock_realtime_coarse); |
261 | posix_timers_register_clock(CLOCK_MONOTONIC_COARSE, &clock_monotonic_coarse); | 279 | posix_timers_register_clock(CLOCK_MONOTONIC_COARSE, &clock_monotonic_coarse); |
280 | posix_timers_register_clock(CLOCK_BOOTTIME, &clock_boottime); | ||
262 | 281 | ||
263 | posix_timers_cache = kmem_cache_create("posix_timers_cache", | 282 | posix_timers_cache = kmem_cache_create("posix_timers_cache", |
264 | sizeof (struct k_itimer), 0, SLAB_PANIC, | 283 | sizeof (struct k_itimer), 0, SLAB_PANIC, |