⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module timerfd

Module timerfd 

Source
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.
TimerFdNode
VfsNode wrapper around a timerfd instance.
Timespec
Time specification matching struct timespec layout.

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.