| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #define TIMER_RETRY 1 |
| 3 | |
| 4 | enum posix_timer_state { |
| 5 | POSIX_TIMER_DISARMED, |
| 6 | POSIX_TIMER_ARMED, |
| 7 | POSIX_TIMER_REQUEUE_PENDING, |
| 8 | }; |
| 9 | |
| 10 | struct k_clock { |
| 11 | int (*clock_getres)(const clockid_t which_clock, |
| 12 | struct timespec64 *tp); |
| 13 | int (*clock_set)(const clockid_t which_clock, |
| 14 | const struct timespec64 *tp); |
| 15 | /* Returns the clock value in the current time namespace. */ |
| 16 | int (*clock_get_timespec)(const clockid_t which_clock, |
| 17 | struct timespec64 *tp); |
| 18 | /* Returns the clock value in the root time namespace. */ |
| 19 | ktime_t (*clock_get_ktime)(const clockid_t which_clock); |
| 20 | int (*clock_adj)(const clockid_t which_clock, struct __kernel_timex *tx); |
| 21 | int (*timer_create)(struct k_itimer *timer); |
| 22 | int (*nsleep)(const clockid_t which_clock, int flags, |
| 23 | const struct timespec64 *); |
| 24 | int (*timer_set)(struct k_itimer *timr, int flags, |
| 25 | struct itimerspec64 *new_setting, |
| 26 | struct itimerspec64 *old_setting); |
| 27 | int (*timer_del)(struct k_itimer *timr); |
| 28 | void (*timer_get)(struct k_itimer *timr, |
| 29 | struct itimerspec64 *cur_setting); |
| 30 | void (*timer_rearm)(struct k_itimer *timr); |
| 31 | s64 (*timer_forward)(struct k_itimer *timr, ktime_t now); |
| 32 | ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now); |
| 33 | int (*timer_try_to_cancel)(struct k_itimer *timr); |
| 34 | void (*timer_arm)(struct k_itimer *timr, ktime_t expires, |
| 35 | bool absolute, bool sigev_none); |
| 36 | void (*timer_wait_running)(struct k_itimer *timr); |
| 37 | }; |
| 38 | |
| 39 | extern const struct k_clock clock_posix_cpu; |
| 40 | extern const struct k_clock clock_posix_dynamic; |
| 41 | extern const struct k_clock clock_process; |
| 42 | extern const struct k_clock clock_thread; |
| 43 | extern const struct k_clock alarm_clock; |
| 44 | extern const struct k_clock clock_aux; |
| 45 | |
| 46 | void posix_timer_queue_signal(struct k_itimer *timr); |
| 47 | |
| 48 | void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting); |
| 49 | int common_timer_set(struct k_itimer *timr, int flags, |
| 50 | struct itimerspec64 *new_setting, |
| 51 | struct itimerspec64 *old_setting); |
| 52 | void posix_timer_set_common(struct k_itimer *timer, struct itimerspec64 *new_setting); |
| 53 | int common_timer_del(struct k_itimer *timer); |
| 54 | |