timer_gettime on x64
arm/disarm and fetch state of POSIX per-process timer
sys_timer_gettime(timer_t timer_id, struct __kernel_itimerspec *setting)
| number | 224 (0xe0) |
|---|---|
| abi | common |
| kconfig | CONFIG_POSIX_TIMERS |
| entry point | sys_timer_gettime |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | timer_gettime(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 224, the syscall number |
rdi | timer_t timer_id |
rsi | struct __kernel_itimerspec *setting |
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 261
- arm64 108
- arm 259
- riscv64 108
- ia32 261
- x32 1073742048
- loongarch64 108
- ppc64 242
- ppc 242
- s390x 256
- mips64 5218
- mipsn32 6222
- mipso32 4259
- alpha 416
- arc 108
- blackfin 262, removed in 4.17
- cris 261, removed in 4.17
- csky 108
- frv 261, removed in 4.17
- hexagon 108
- ia64 1250, removed in 6.7
- m32r 261, removed in 4.17
- m68k 256
- metag 108, removed in 4.17
- microblaze 261
- mn10300 261, removed in 4.17
- nds32 108, removed in 5.18
- nios2 108
- openrisc 108
- parisc 252
- score 108, removed in 4.17
- sh 261
- sparc 263
- sparc64 263
- tilegx 108, removed in 4.17
- tilepro 108, removed in 4.17
- xtensa 251
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/timer_gettime