[PATCH] timerfd: Support CLOCK_TAI
From: Chris Down
Date: Thu Mar 19 2026 - 02:13:10 EST
Despite hrtimer and POSIX timers both accepting CLOCK_TAI,
timerfd_create() rejects it. This usually corners userspace into one of
two bad options:
1. Convert TAI deadlines through CLOCK_REALTIME, which reintroduces the
leap second exposure the application was trying to avoid in the first
place.
2. Abandon timerfd entirely and use POSIX timers or busy wait approaches
that do not compose well with epoll based event loops.
Avoid these bad outcomes by allowing timerfd to support CLOCK_TAI. The
underlying hrtimer and k_clock infrastructure already supports this.
With this, epoll based applications can arm TAI based file descriptor
timers natively.
Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
---
fs/timerfd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 73104f36bcae..278ad4ab65c8 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -404,6 +404,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
(clockid != CLOCK_MONOTONIC &&
clockid != CLOCK_REALTIME &&
clockid != CLOCK_REALTIME_ALARM &&
+ clockid != CLOCK_TAI &&
clockid != CLOCK_BOOTTIME &&
clockid != CLOCK_BOOTTIME_ALARM))
return -EINVAL;
base-commit: a989fde763f4f24209e4702f50a45be572340e68
--
2.53.0