1 #ifndef _linux_POSIX_TIMERS_H
2 #define _linux_POSIX_TIMERS_H
4 #include <linux/spinlock.h>
5 #include <linux/list.h>
7 /* POSIX.1b interval timer structure. */
9 struct list_head list; /* free/ allocate list */
11 clockid_t it_clock; /* which timer type */
12 timer_t it_id; /* timer id */
13 int it_overrun; /* overrun on pending signal */
14 int it_overrun_last; /* overrun on last delivered signal */
15 int it_requeue_pending; /* waiting to requeue this timer */
16 int it_sigev_notify; /* notify word of sigevent struct */
17 int it_sigev_signo; /* signo word of sigevent struct */
18 sigval_t it_sigev_value; /* value word of sigevent struct */
19 unsigned long it_incr; /* interval specified in jiffies */
20 struct task_struct *it_process; /* process to send signal to */
21 struct timer_list it_timer;
22 struct sigqueue *sigq; /* signal queue entry. */
23 struct list_head abs_timer_entry; /* clock abs_timer_list */
24 struct timespec wall_to_prev; /* wall_to_monotonic used when set */
28 struct list_head list;
32 int res; /* in nano seconds */
33 struct k_clock_abs *abs_struct;
34 int (*clock_set) (struct timespec * tp);
35 int (*clock_get) (struct timespec * tp);
36 int (*timer_create) (struct k_itimer *timer);
37 int (*nsleep) (int which_clock, int flags,
39 int (*timer_set) (struct k_itimer * timr, int flags,
40 struct itimerspec * new_setting,
41 struct itimerspec * old_setting);
42 int (*timer_del) (struct k_itimer * timr);
43 void (*timer_get) (struct k_itimer * timr,
44 struct itimerspec * cur_setting);
47 void register_posix_clock(int clock_id, struct k_clock *new_clock);
49 /* Error handlers for timer_create, nanosleep and settime */
50 int do_posix_clock_notimer_create(struct k_itimer *timer);
51 int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec * t);
52 int do_posix_clock_nosettime(struct timespec *tp);
54 /* function to call to trigger timer event */
55 int posix_timer_event(struct k_itimer *timr, int si_private);
58 unsigned long jiffies;
61 #define posix_get_now(now) (now)->jiffies = jiffies;
62 #define posix_time_before(timer, now) \
63 time_before((timer)->expires, (now)->jiffies)
65 #define posix_bump_timer(timr, now) \
68 delta = now.jiffies - (timr)->it_timer.expires; \
70 orun = 1 + (delta / (timr)->it_incr); \
71 (timr)->it_timer.expires += orun * (timr)->it_incr; \
72 (timr)->it_overrun += orun; \