1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2bab0aae9SThomas Gleixner #define TIMER_RETRY 1 3bab0aae9SThomas Gleixner 4bab0aae9SThomas Gleixner struct k_clock { 530802945SThomas Gleixner int (*clock_getres)(const clockid_t which_clock, 630802945SThomas Gleixner struct timespec64 *tp); 7bab0aae9SThomas Gleixner int (*clock_set)(const clockid_t which_clock, 8bab0aae9SThomas Gleixner const struct timespec64 *tp); 9*9c71a2e8SAndrei Vagin /* Returns the clock value in the current time namespace. */ 10819a95feSAndrei Vagin int (*clock_get_timespec)(const clockid_t which_clock, 1130802945SThomas Gleixner struct timespec64 *tp); 12*9c71a2e8SAndrei Vagin /* Returns the clock value in the root time namespace. */ 13*9c71a2e8SAndrei Vagin ktime_t (*clock_get_ktime)(const clockid_t which_clock); 14ead25417SDeepa Dinamani int (*clock_adj)(const clockid_t which_clock, struct __kernel_timex *tx); 15bab0aae9SThomas Gleixner int (*timer_create)(struct k_itimer *timer); 16bab0aae9SThomas Gleixner int (*nsleep)(const clockid_t which_clock, int flags, 17938e7cf2SThomas Gleixner const struct timespec64 *); 18bab0aae9SThomas Gleixner int (*timer_set)(struct k_itimer *timr, int flags, 19bab0aae9SThomas Gleixner struct itimerspec64 *new_setting, 20bab0aae9SThomas Gleixner struct itimerspec64 *old_setting); 21bab0aae9SThomas Gleixner int (*timer_del)(struct k_itimer *timr); 22bab0aae9SThomas Gleixner void (*timer_get)(struct k_itimer *timr, 23bab0aae9SThomas Gleixner struct itimerspec64 *cur_setting); 2430802945SThomas Gleixner void (*timer_rearm)(struct k_itimer *timr); 256fec64e1SThomas Gleixner s64 (*timer_forward)(struct k_itimer *timr, ktime_t now); 2663841b2aSThomas Gleixner ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now); 27525b8ed9SThomas Gleixner int (*timer_try_to_cancel)(struct k_itimer *timr); 28525b8ed9SThomas Gleixner void (*timer_arm)(struct k_itimer *timr, ktime_t expires, 29525b8ed9SThomas Gleixner bool absolute, bool sigev_none); 30ec8f954aSThomas Gleixner void (*timer_wait_running)(struct k_itimer *timr); 31bab0aae9SThomas Gleixner }; 32bab0aae9SThomas Gleixner 33bab0aae9SThomas Gleixner extern const struct k_clock clock_posix_cpu; 34bab0aae9SThomas Gleixner extern const struct k_clock clock_posix_dynamic; 35bab0aae9SThomas Gleixner extern const struct k_clock clock_process; 36bab0aae9SThomas Gleixner extern const struct k_clock clock_thread; 37bab0aae9SThomas Gleixner extern const struct k_clock alarm_clock; 38bab0aae9SThomas Gleixner 39bab0aae9SThomas Gleixner int posix_timer_event(struct k_itimer *timr, int si_private); 40f2c45807SThomas Gleixner 41f2c45807SThomas Gleixner void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting); 42f2c45807SThomas Gleixner int common_timer_set(struct k_itimer *timr, int flags, 43f2c45807SThomas Gleixner struct itimerspec64 *new_setting, 44f2c45807SThomas Gleixner struct itimerspec64 *old_setting); 45f2c45807SThomas Gleixner int common_timer_del(struct k_itimer *timer); 46