timerfd_gettime on x64
timers that notify via file descriptors
sys_timerfd_gettime(int ufd, struct __kernel_itimerspec *otmr)
| number | 287 (0x11f) |
|---|---|
| abi | common |
| kconfig | CONFIG_TIMERFD |
| entry point | sys_timerfd_gettime |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | timerfd_gettime(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 287, the syscall number |
rdi | int ufd |
rsi | struct __kernel_itimerspec *otmr |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 326
- arm64 87
- arm 354
- riscv64 87
- ia32 326
- x32 1073742111
- loongarch64 87
- ppc64 312
- ppc 312
- s390x 321
- mips64 5281
- mipsn32 6285
- mipso32 4322
- alpha 483
- arc 87
- blackfin 359, removed in 4.17
- cris 326, removed in 4.17
- csky 87
- frv 326, removed in 4.17
- hexagon 87
- ia64 1312, removed in 6.7
- m68k 322
- metag 87, removed in 4.17
- microblaze 327
- mn10300 327, removed in 4.17
- nds32 87, removed in 5.18
- nios2 87
- openrisc 87
- parisc 308
- score 87, removed in 4.17
- sh 326
- sparc 316
- sparc64 316
- tilegx 87, removed in 4.17
- tilepro 87, removed in 4.17
- xtensa 314
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/timerfd_gettime