posix-timers.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #define TIMER_RETRY 1
  3. struct k_clock {
  4. int (*clock_getres)(const clockid_t which_clock,
  5. struct timespec64 *tp);
  6. int (*clock_set)(const clockid_t which_clock,
  7. const struct timespec64 *tp);
  8. int (*clock_get)(const clockid_t which_clock,
  9. struct timespec64 *tp);
  10. int (*clock_adj)(const clockid_t which_clock, struct timex *tx);
  11. int (*timer_create)(struct k_itimer *timer);
  12. int (*nsleep)(const clockid_t which_clock, int flags,
  13. const struct timespec64 *);
  14. int (*timer_set)(struct k_itimer *timr, int flags,
  15. struct itimerspec64 *new_setting,
  16. struct itimerspec64 *old_setting);
  17. int (*timer_del)(struct k_itimer *timr);
  18. void (*timer_get)(struct k_itimer *timr,
  19. struct itimerspec64 *cur_setting);
  20. void (*timer_rearm)(struct k_itimer *timr);
  21. s64 (*timer_forward)(struct k_itimer *timr, ktime_t now);
  22. ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now);
  23. int (*timer_try_to_cancel)(struct k_itimer *timr);
  24. void (*timer_arm)(struct k_itimer *timr, ktime_t expires,
  25. bool absolute, bool sigev_none);
  26. };
  27. extern const struct k_clock clock_posix_cpu;
  28. extern const struct k_clock clock_posix_dynamic;
  29. extern const struct k_clock clock_process;
  30. extern const struct k_clock clock_thread;
  31. extern const struct k_clock alarm_clock;
  32. int posix_timer_event(struct k_itimer *timr, int si_private);
  33. void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting);
  34. int common_timer_set(struct k_itimer *timr, int flags,
  35. struct itimerspec64 *new_setting,
  36. struct itimerspec64 *old_setting);
  37. int common_timer_del(struct k_itimer *timer);