Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timekeeping: Add minimal posix-timers support for auxiliary clocks

Provide clock_getres(2) and clock_gettime(2) for auxiliary clocks.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20250625183757.932220594@linutronix.de

+25
+3
kernel/time/posix-timers.c
··· 1526 1526 [CLOCK_REALTIME_ALARM] = &alarm_clock, 1527 1527 [CLOCK_BOOTTIME_ALARM] = &alarm_clock, 1528 1528 [CLOCK_TAI] = &clock_tai, 1529 + #ifdef CONFIG_POSIX_AUX_CLOCKS 1530 + [CLOCK_AUX ... CLOCK_AUX_LAST] = &clock_aux, 1531 + #endif 1529 1532 }; 1530 1533 1531 1534 static const struct k_clock *clockid_to_kclock(const clockid_t id)
+1
kernel/time/posix-timers.h
··· 41 41 extern const struct k_clock clock_process; 42 42 extern const struct k_clock clock_thread; 43 43 extern const struct k_clock alarm_clock; 44 + extern const struct k_clock clock_aux; 44 45 45 46 void posix_timer_queue_signal(struct k_itimer *timr); 46 47
+21
kernel/time/timekeeping.c
··· 2655 2655 #endif /* CONFIG_NTP_PPS */ 2656 2656 2657 2657 #ifdef CONFIG_POSIX_AUX_CLOCKS 2658 + #include "posix-timers.h" 2658 2659 2659 2660 /* 2660 2661 * Bitmap for the activated auxiliary timekeepers to allow lockless quick ··· 2749 2748 return true; 2750 2749 } 2751 2750 EXPORT_SYMBOL_GPL(ktime_get_aux_ts64); 2751 + 2752 + static int aux_get_res(clockid_t id, struct timespec64 *tp) 2753 + { 2754 + if (!clockid_aux_valid(id)) 2755 + return -ENODEV; 2756 + 2757 + tp->tv_sec = 0; 2758 + tp->tv_nsec = 1; 2759 + return 0; 2760 + } 2761 + 2762 + static int aux_get_timespec(clockid_t id, struct timespec64 *tp) 2763 + { 2764 + return ktime_get_aux_ts64(id, tp) ? 0 : -ENODEV; 2765 + } 2766 + 2767 + const struct k_clock clock_aux = { 2768 + .clock_getres = aux_get_res, 2769 + .clock_get_timespec = aux_get_timespec, 2770 + }; 2752 2771 2753 2772 static __init void tk_aux_setup(void) 2754 2773 {