MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / posix-timers.h
blobec4910e37c65c5a396057bd62841c64d8ee13698
1 #ifndef _linux_POSIX_TIMERS_H
2 #define _linux_POSIX_TIMERS_H
4 #include <linux/spinlock.h>
5 #include <linux/list.h>
7 struct k_clock_abs {
8 struct list_head list;
9 spinlock_t lock;
11 struct k_clock {
12 int res; /* in nano seconds */
13 struct k_clock_abs *abs_struct;
14 int (*clock_set) (struct timespec * tp);
15 int (*clock_get) (struct timespec * tp);
16 int (*nsleep) (int flags,
17 struct timespec * new_setting,
18 struct itimerspec * old_setting);
19 int (*timer_set) (struct k_itimer * timr, int flags,
20 struct itimerspec * new_setting,
21 struct itimerspec * old_setting);
22 int (*timer_del) (struct k_itimer * timr);
23 void (*timer_get) (struct k_itimer * timr,
24 struct itimerspec * cur_setting);
26 struct now_struct {
27 unsigned long jiffies;
30 #define posix_get_now(now) (now)->jiffies = jiffies;
31 #define posix_time_before(timer, now) \
32 time_before((timer)->expires, (now)->jiffies)
34 #define posix_bump_timer(timr, now) \
35 do { \
36 long delta, orun; \
37 delta = now.jiffies - (timr)->it_timer.expires; \
38 if (delta >= 0) { \
39 orun = 1 + (delta / (timr)->it_incr); \
40 (timr)->it_timer.expires += orun * (timr)->it_incr; \
41 (timr)->it_overrun += orun; \
42 } \
43 }while (0)
44 #endif