Expand description
timerfd – Timer notification file descriptor
Provides file descriptors that deliver timer expiration notifications, integrable with epoll/poll. Used by Qt6 for frame pacing and event loop timeouts, and by KWin for compositor frame scheduling.
§Syscall Interface
timerfd_create(clockid, flags) -> fd(syscall 331)timerfd_settime(fd, flags, new, old) -> 0(syscall 332)timerfd_gettime(fd, curr) -> 0(syscall 333)- Read via standard
read(2)on returned fd
§Semantics
- read: Returns the number of expirations since last read as a u64. Returns EAGAIN if no expirations and non-blocking, otherwise blocks.
- Timer resolution is based on kernel uptime (TSC-derived).
Structs§
- Itimerspec
- Timer interval specification matching
struct itimerspec. - Timer
FdNode - VfsNode wrapper around a timerfd instance.
- Timespec
- Time specification matching
struct timespeclayout.
Constants§
- CLOCK_
MONOTONIC - CLOCK_
REALTIME - Clock IDs (subset of POSIX clocks).
- TFD_
CLOEXEC - TFD_CLOEXEC: Set close-on-exec.
- TFD_
NONBLOCK - TFD_NONBLOCK: Return EAGAIN instead of blocking.
- TFD_
TIMER_ ABSTIME - TFD_TIMER_ABSTIME: Interpret new_value.it_value as absolute time.
Functions§
- is_
readable - Query whether a timerfd is readable (timer has expired). Used by epoll to check readiness without consuming data.
- timerfd_
close - Close (destroy) a timerfd instance.
- timerfd_
create - Create a new timerfd.
- timerfd_
gettime - Get the current timer specification.
- timerfd_
read - Read from a timerfd – returns number of expirations since last read.
- timerfd_
settime - Arm or disarm a timerfd.