nuttx/drivers/timers
dongjiuzhu1 3c486b98dd fs/timerfd: implement TFD_TIMER_CANCEL_ON_SET to detect clock changes
Implement Linux-compatible TFD_TIMER_CANCEL_ON_SET flag for timerfd to
allow applications to detect discontinuous changes to CLOCK_REALTIME.

Background:
According to Linux timerfd_create(2) man page, when a timerfd is created
with CLOCK_REALTIME and TFD_TIMER_CANCEL_ON_SET flag is specified, the
read() operation should fail with ECANCELED if the real-time clock
undergoes a discontinuous change. This allows applications to detect
and respond to system time changes.

Implementation:
1. Add clock notifier infrastructure (clock_notifier.h/c) to notify
   interested parties when system time changes
2. Implement TFD_TIMER_CANCEL_ON_SET flag support in timerfd
3. Register timerfd with clock notifier when flag is set
4. Cancel timer and return ECANCELED when clock change is detected
5. Notify clock changes in:
   - clock_settime()
   - clock_initialize()
   - clock_timekeeping_set_wall_time()
   - rpmsg_rtc time synchronization

Changes include:
- New files: include/nuttx/clock_notifier.h, sched/clock/clock_notifier.c
- Modified: fs/vfs/fs_timerfd.c to handle TFD_TIMER_CANCEL_ON_SET
- Modified: clock subsystem to call notifier chain on time changes
- Modified: rpmsg_rtc to notify time changes during sync

Use case example:
Applications using timerfd with absolute time can now detect when
system time is adjusted (e.g., NTP sync, manual time change) and
take appropriate action such as recalculating timeouts or updating
scheduled events.

Reference: https://man7.org/linux/man-pages/man2/timerfd_create.2.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-30 17:20:24 +08:00
..
arch_alarm.c sched/sched: add hrtimer support to drive the scheduler 2026-01-20 06:55:15 +08:00
arch_rtc.c rtc_time:set zero rtc_time struct 2025-12-19 01:58:44 +01:00
arch_timer.c drivers/timers: check CONFIG_BOARD_LOOPSPERMSEC != 0 at runtime 2026-01-15 22:57:19 +08:00
capture.c drivers/timers/capture: fix typo in capture.h 2026-01-22 00:06:45 +08:00
CMakeLists.txt timer: add timer wdog 2026-01-29 09:25:07 -03:00
cs2100-cp.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
ds3231.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
ds3231.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
fake_capture.c drivers/capture: add fake capture driver for testing and development 2026-01-02 07:46:52 -03:00
goldfish_timer.c driver/timers: Simplify Goldfish timer driver. 2025-11-24 19:43:07 +08:00
Kconfig timer: add timer wdog 2026-01-29 09:25:07 -03:00
Make.defs timer: add timer wdog 2026-01-29 09:25:07 -03:00
mcp794xx.c sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
mcp794xx.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
oneshot.c drivers/timers: Fix oneshot callback arg. 2025-11-24 19:43:07 +08:00
pcf85263.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pcf85263.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pl031.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
ptp_clock.c drivers/ptp: add set/get statistics interface for driver 2025-12-30 10:22:09 -03:00
ptp_clock_dummy.c drivers/timers/ptp: support ptp clock dummy driver 2025-12-30 10:22:09 -03:00
pwm.c drivers/pwm : remove critical section and mutex. 2026-01-27 17:59:07 +08:00
rpmsg_rtc.c fs/timerfd: implement TFD_TIMER_CANCEL_ON_SET to detect clock changes 2026-01-30 17:20:24 +08:00
rtc.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rx8010.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rx8010.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
timer.c drivers/timer : remove critical section. 2026-01-27 17:59:07 +08:00
timer_wdog.c timers/timer_wdog: Remove the wd_start_period. 2026-01-29 09:25:07 -03:00
watchdog.c timers/oneshot: Remove all callback and args. 2025-11-18 13:02:29 +01:00