diff options
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r-- | include/linux/posix-timers.h | 105 |
1 files changed, 47 insertions, 58 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 8c1e43ab14a9..29f1b7f09ced 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/timex.h> | 7 | #include <linux/timex.h> |
8 | #include <linux/alarmtimer.h> | 8 | #include <linux/alarmtimer.h> |
9 | 9 | ||
10 | struct siginfo; | ||
10 | 11 | ||
11 | struct cpu_timer_list { | 12 | struct cpu_timer_list { |
12 | struct list_head entry; | 13 | struct list_head entry; |
@@ -48,81 +49,69 @@ struct cpu_timer_list { | |||
48 | #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) | 49 | #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) |
49 | #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) | 50 | #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) |
50 | 51 | ||
51 | /* POSIX.1b interval timer structure. */ | ||
52 | struct k_itimer { | ||
53 | struct list_head list; /* free/ allocate list */ | ||
54 | struct hlist_node t_hash; | ||
55 | spinlock_t it_lock; | ||
56 | clockid_t it_clock; /* which timer type */ | ||
57 | timer_t it_id; /* timer id */ | ||
58 | int it_overrun; /* overrun on pending signal */ | ||
59 | int it_overrun_last; /* overrun on last delivered signal */ | ||
60 | int it_requeue_pending; /* waiting to requeue this timer */ | ||
61 | #define REQUEUE_PENDING 1 | 52 | #define REQUEUE_PENDING 1 |
62 | int it_sigev_notify; /* notify word of sigevent struct */ | 53 | |
63 | struct signal_struct *it_signal; | 54 | /** |
55 | * struct k_itimer - POSIX.1b interval timer structure. | ||
56 | * @list: List head for binding the timer to signals->posix_timers | ||
57 | * @t_hash: Entry in the posix timer hash table | ||
58 | * @it_lock: Lock protecting the timer | ||
59 | * @kclock: Pointer to the k_clock struct handling this timer | ||
60 | * @it_clock: The posix timer clock id | ||
61 | * @it_id: The posix timer id for identifying the timer | ||
62 | * @it_active: Marker that timer is active | ||
63 | * @it_overrun: The overrun counter for pending signals | ||
64 | * @it_overrun_last: The overrun at the time of the last delivered signal | ||
65 | * @it_requeue_pending: Indicator that timer waits for being requeued on | ||
66 | * signal delivery | ||
67 | * @it_sigev_notify: The notify word of sigevent struct for signal delivery | ||
68 | * @it_interval: The interval for periodic timers | ||
69 | * @it_signal: Pointer to the creators signal struct | ||
70 | * @it_pid: The pid of the process/task targeted by the signal | ||
71 | * @it_process: The task to wakeup on clock_nanosleep (CPU timers) | ||
72 | * @sigq: Pointer to preallocated sigqueue | ||
73 | * @it: Union representing the various posix timer type | ||
74 | * internals. Also used for rcu freeing the timer. | ||
75 | */ | ||
76 | struct k_itimer { | ||
77 | struct list_head list; | ||
78 | struct hlist_node t_hash; | ||
79 | spinlock_t it_lock; | ||
80 | const struct k_clock *kclock; | ||
81 | clockid_t it_clock; | ||
82 | timer_t it_id; | ||
83 | int it_active; | ||
84 | int it_overrun; | ||
85 | int it_overrun_last; | ||
86 | int it_requeue_pending; | ||
87 | int it_sigev_notify; | ||
88 | ktime_t it_interval; | ||
89 | struct signal_struct *it_signal; | ||
64 | union { | 90 | union { |
65 | struct pid *it_pid; /* pid of process to send signal to */ | 91 | struct pid *it_pid; |
66 | struct task_struct *it_process; /* for clock_nanosleep */ | 92 | struct task_struct *it_process; |
67 | }; | 93 | }; |
68 | struct sigqueue *sigq; /* signal queue entry. */ | 94 | struct sigqueue *sigq; |
69 | union { | 95 | union { |
70 | struct { | 96 | struct { |
71 | struct hrtimer timer; | 97 | struct hrtimer timer; |
72 | ktime_t interval; | ||
73 | } real; | 98 | } real; |
74 | struct cpu_timer_list cpu; | 99 | struct cpu_timer_list cpu; |
75 | struct { | 100 | struct { |
76 | unsigned int clock; | 101 | struct alarm alarmtimer; |
77 | unsigned int node; | ||
78 | unsigned long incr; | ||
79 | unsigned long expires; | ||
80 | } mmtimer; | ||
81 | struct { | ||
82 | struct alarm alarmtimer; | ||
83 | ktime_t interval; | ||
84 | } alarm; | 102 | } alarm; |
85 | struct rcu_head rcu; | 103 | struct rcu_head rcu; |
86 | } it; | 104 | } it; |
87 | }; | 105 | }; |
88 | 106 | ||
89 | struct k_clock { | ||
90 | int (*clock_getres) (const clockid_t which_clock, struct timespec64 *tp); | ||
91 | int (*clock_set) (const clockid_t which_clock, | ||
92 | const struct timespec64 *tp); | ||
93 | int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp); | ||
94 | int (*clock_adj) (const clockid_t which_clock, struct timex *tx); | ||
95 | int (*timer_create) (struct k_itimer *timer); | ||
96 | int (*nsleep) (const clockid_t which_clock, int flags, | ||
97 | struct timespec64 *, struct timespec __user *); | ||
98 | long (*nsleep_restart) (struct restart_block *restart_block); | ||
99 | int (*timer_set) (struct k_itimer *timr, int flags, | ||
100 | struct itimerspec64 *new_setting, | ||
101 | struct itimerspec64 *old_setting); | ||
102 | int (*timer_del) (struct k_itimer *timr); | ||
103 | #define TIMER_RETRY 1 | ||
104 | void (*timer_get) (struct k_itimer *timr, | ||
105 | struct itimerspec64 *cur_setting); | ||
106 | }; | ||
107 | |||
108 | extern struct k_clock clock_posix_cpu; | ||
109 | extern struct k_clock clock_posix_dynamic; | ||
110 | |||
111 | void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock); | ||
112 | |||
113 | /* function to call to trigger timer event */ | ||
114 | int posix_timer_event(struct k_itimer *timr, int si_private); | ||
115 | |||
116 | void posix_cpu_timer_schedule(struct k_itimer *timer); | ||
117 | |||
118 | void run_posix_cpu_timers(struct task_struct *task); | 107 | void run_posix_cpu_timers(struct task_struct *task); |
119 | void posix_cpu_timers_exit(struct task_struct *task); | 108 | void posix_cpu_timers_exit(struct task_struct *task); |
120 | void posix_cpu_timers_exit_group(struct task_struct *task); | 109 | void posix_cpu_timers_exit_group(struct task_struct *task); |
121 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, | 110 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, |
122 | u64 *newval, u64 *oldval); | 111 | u64 *newval, u64 *oldval); |
123 | 112 | ||
124 | long clock_nanosleep_restart(struct restart_block *restart_block); | ||
125 | |||
126 | void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new); | 113 | void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new); |
127 | 114 | ||
115 | void posixtimer_rearm(struct siginfo *info); | ||
116 | |||
128 | #endif | 117 | #endif |