blob: f32a2ebba9b8b212e2b71ae0f34a129c367bd3cf [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Thomas Gleixnerbab0aae2017-05-30 23:15:41 +02002#define TIMER_RETRY 1
3
4struct k_clock {
Thomas Gleixner30802942017-05-30 23:15:45 +02005 int (*clock_getres)(const clockid_t which_clock,
6 struct timespec64 *tp);
7 int (*clock_set)(const clockid_t which_clock,
8 const struct timespec64 *tp);
Andrei Vagin9c71a2e2019-11-12 01:26:58 +00009 /* Returns the clock value in the current time namespace. */
Andrei Vagin819a95f2019-11-12 01:26:54 +000010 int (*clock_get_timespec)(const clockid_t which_clock,
11 struct timespec64 *tp);
Andrei Vagin9c71a2e2019-11-12 01:26:58 +000012 /* Returns the clock value in the root time namespace. */
13 ktime_t (*clock_get_ktime)(const clockid_t which_clock);
Deepa Dinamaniead25412018-07-02 22:44:21 -070014 int (*clock_adj)(const clockid_t which_clock, struct __kernel_timex *tx);
Thomas Gleixner30802942017-05-30 23:15:45 +020015 int (*timer_create)(struct k_itimer *timer);
16 int (*nsleep)(const clockid_t which_clock, int flags,
Thomas Gleixner938e7cf2017-06-13 23:34:33 +020017 const struct timespec64 *);
Thomas Gleixner30802942017-05-30 23:15:45 +020018 int (*timer_set)(struct k_itimer *timr, int flags,
19 struct itimerspec64 *new_setting,
20 struct itimerspec64 *old_setting);
21 int (*timer_del)(struct k_itimer *timr);
22 void (*timer_get)(struct k_itimer *timr,
23 struct itimerspec64 *cur_setting);
24 void (*timer_rearm)(struct k_itimer *timr);
Thomas Gleixner6fec64e2018-06-26 15:21:31 +020025 s64 (*timer_forward)(struct k_itimer *timr, ktime_t now);
Thomas Gleixner63841b22017-05-30 23:15:49 +020026 ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now);
Thomas Gleixner525b8ed2017-05-30 23:15:52 +020027 int (*timer_try_to_cancel)(struct k_itimer *timr);
28 void (*timer_arm)(struct k_itimer *timr, ktime_t expires,
29 bool absolute, bool sigev_none);
Thomas Gleixnerec8f9542019-08-02 07:35:59 +020030 void (*timer_wait_running)(struct k_itimer *timr);
Thomas Gleixnerbab0aae2017-05-30 23:15:41 +020031};
32
33extern const struct k_clock clock_posix_cpu;
34extern const struct k_clock clock_posix_dynamic;
35extern const struct k_clock clock_process;
36extern const struct k_clock clock_thread;
37extern const struct k_clock alarm_clock;
38
39int posix_timer_event(struct k_itimer *timr, int si_private);
Thomas Gleixnerf2c45802017-05-30 23:15:59 +020040
41void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting);
42int common_timer_set(struct k_itimer *timr, int flags,
43 struct itimerspec64 *new_setting,
44 struct itimerspec64 *old_setting);
45int common_timer_del(struct k_itimer *timer);