diff options
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r-- | include/linux/posix-timers.h | 90 |
1 files changed, 33 insertions, 57 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index f942e2bad8e3..54faf5236da0 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -42,7 +42,7 @@ struct k_itimer { | |||
42 | timer_t it_id; /* timer id */ | 42 | timer_t it_id; /* timer id */ |
43 | int it_overrun; /* overrun on pending signal */ | 43 | int it_overrun; /* overrun on pending signal */ |
44 | int it_overrun_last; /* overrun on last delivered signal */ | 44 | int it_overrun_last; /* overrun on last delivered signal */ |
45 | int it_requeue_pending; /* waiting to requeue this timer */ | 45 | int it_requeue_pending; /* waiting to requeue this timer */ |
46 | #define REQUEUE_PENDING 1 | 46 | #define REQUEUE_PENDING 1 |
47 | int it_sigev_notify; /* notify word of sigevent struct */ | 47 | int it_sigev_notify; /* notify word of sigevent struct */ |
48 | int it_sigev_signo; /* signo word of sigevent struct */ | 48 | int it_sigev_signo; /* signo word of sigevent struct */ |
@@ -51,10 +51,8 @@ struct k_itimer { | |||
51 | struct sigqueue *sigq; /* signal queue entry. */ | 51 | struct sigqueue *sigq; /* signal queue entry. */ |
52 | union { | 52 | union { |
53 | struct { | 53 | struct { |
54 | struct timer_list timer; | 54 | struct hrtimer timer; |
55 | struct list_head abs_timer_entry; /* clock abs_timer_list */ | 55 | ktime_t interval; |
56 | struct timespec wall_to_prev; /* wall_to_monotonic used when set */ | ||
57 | unsigned long incr; /* interval in jiffies */ | ||
58 | } real; | 56 | } real; |
59 | struct cpu_timer_list cpu; | 57 | struct cpu_timer_list cpu; |
60 | struct { | 58 | struct { |
@@ -66,18 +64,14 @@ struct k_itimer { | |||
66 | } it; | 64 | } it; |
67 | }; | 65 | }; |
68 | 66 | ||
69 | struct k_clock_abs { | ||
70 | struct list_head list; | ||
71 | spinlock_t lock; | ||
72 | }; | ||
73 | struct k_clock { | 67 | struct k_clock { |
74 | int res; /* in nano seconds */ | 68 | int res; /* in nanoseconds */ |
75 | int (*clock_getres) (clockid_t which_clock, struct timespec *tp); | 69 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); |
76 | struct k_clock_abs *abs_struct; | 70 | int (*clock_set) (const clockid_t which_clock, struct timespec * tp); |
77 | int (*clock_set) (clockid_t which_clock, struct timespec * tp); | 71 | int (*clock_get) (const clockid_t which_clock, struct timespec * tp); |
78 | int (*clock_get) (clockid_t which_clock, struct timespec * tp); | ||
79 | int (*timer_create) (struct k_itimer *timer); | 72 | int (*timer_create) (struct k_itimer *timer); |
80 | int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); | 73 | int (*nsleep) (const clockid_t which_clock, int flags, |
74 | struct timespec *, struct timespec __user *); | ||
81 | int (*timer_set) (struct k_itimer * timr, int flags, | 75 | int (*timer_set) (struct k_itimer * timr, int flags, |
82 | struct itimerspec * new_setting, | 76 | struct itimerspec * new_setting, |
83 | struct itimerspec * old_setting); | 77 | struct itimerspec * old_setting); |
@@ -87,53 +81,35 @@ struct k_clock { | |||
87 | struct itimerspec * cur_setting); | 81 | struct itimerspec * cur_setting); |
88 | }; | 82 | }; |
89 | 83 | ||
90 | void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); | 84 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); |
91 | 85 | ||
92 | /* Error handlers for timer_create, nanosleep and settime */ | 86 | /* error handlers for timer_create, nanosleep and settime */ |
93 | int do_posix_clock_notimer_create(struct k_itimer *timer); | 87 | int do_posix_clock_notimer_create(struct k_itimer *timer); |
94 | int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); | 88 | int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *, |
95 | int do_posix_clock_nosettime(clockid_t, struct timespec *tp); | 89 | struct timespec __user *); |
90 | int do_posix_clock_nosettime(const clockid_t, struct timespec *tp); | ||
96 | 91 | ||
97 | /* function to call to trigger timer event */ | 92 | /* function to call to trigger timer event */ |
98 | int posix_timer_event(struct k_itimer *timr, int si_private); | 93 | int posix_timer_event(struct k_itimer *timr, int si_private); |
99 | 94 | ||
100 | struct now_struct { | 95 | int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts); |
101 | unsigned long jiffies; | 96 | int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts); |
102 | }; | 97 | int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts); |
103 | 98 | int posix_cpu_timer_create(struct k_itimer *timer); | |
104 | #define posix_get_now(now) (now)->jiffies = jiffies; | 99 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, |
105 | #define posix_time_before(timer, now) \ | 100 | struct timespec *rqtp, struct timespec __user *rmtp); |
106 | time_before((timer)->expires, (now)->jiffies) | 101 | int posix_cpu_timer_set(struct k_itimer *timer, int flags, |
107 | 102 | struct itimerspec *new, struct itimerspec *old); | |
108 | #define posix_bump_timer(timr, now) \ | 103 | int posix_cpu_timer_del(struct k_itimer *timer); |
109 | do { \ | 104 | void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp); |
110 | long delta, orun; \ | 105 | |
111 | delta = now.jiffies - (timr)->it.real.timer.expires; \ | 106 | void posix_cpu_timer_schedule(struct k_itimer *timer); |
112 | if (delta >= 0) { \ | 107 | |
113 | orun = 1 + (delta / (timr)->it.real.incr); \ | 108 | void run_posix_cpu_timers(struct task_struct *task); |
114 | (timr)->it.real.timer.expires += \ | 109 | void posix_cpu_timers_exit(struct task_struct *task); |
115 | orun * (timr)->it.real.incr; \ | 110 | void posix_cpu_timers_exit_group(struct task_struct *task); |
116 | (timr)->it_overrun += orun; \ | 111 | |
117 | } \ | 112 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, |
118 | }while (0) | 113 | cputime_t *newval, cputime_t *oldval); |
119 | |||
120 | int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *); | ||
121 | int posix_cpu_clock_get(clockid_t which_clock, struct timespec *); | ||
122 | int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp); | ||
123 | int posix_cpu_timer_create(struct k_itimer *); | ||
124 | int posix_cpu_nsleep(clockid_t, int, struct timespec *); | ||
125 | int posix_cpu_timer_set(struct k_itimer *, int, | ||
126 | struct itimerspec *, struct itimerspec *); | ||
127 | int posix_cpu_timer_del(struct k_itimer *); | ||
128 | void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *); | ||
129 | |||
130 | void posix_cpu_timer_schedule(struct k_itimer *); | ||
131 | |||
132 | void run_posix_cpu_timers(struct task_struct *); | ||
133 | void posix_cpu_timers_exit(struct task_struct *); | ||
134 | void posix_cpu_timers_exit_group(struct task_struct *); | ||
135 | |||
136 | void set_process_cpu_timer(struct task_struct *, unsigned int, | ||
137 | cputime_t *, cputime_t *); | ||
138 | 114 | ||
139 | #endif | 115 | #endif |