getitimer on x64
get or set value of an interval timer
sys_getitimer(int which, struct __kernel_old_itimerval *value)
| number | 36 (0x24) |
|---|---|
| abi | common |
| kconfig | CONFIG_POSIX_TIMERS |
| entry point | sys_getitimer |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | getitimer(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 36, the syscall number |
rdi | int which |
rsi | struct __kernel_old_itimerval *value |
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 105
- arm64 102
- arm 105
- riscv64 102
- ia32 105
- x32 1073741860
- loongarch64 102
- ppc64 105
- ppc 105
- s390x 105
- mips64 5035
- mipsn32 6035
- mipso32 4105
- alpha 361
- arc 102
- blackfin 105, removed in 4.17
- cris 105, removed in 4.17
- csky 102
- frv 105, removed in 4.17
- hexagon 102
- ia64 1119, removed in 6.7
- m32r 105, removed in 4.17
- m68k 105
- metag 102, removed in 4.17
- microblaze 105
- mn10300 105, removed in 4.17
- nds32 102, removed in 5.18
- nios2 102
- openrisc 102
- parisc 105
- score 102, removed in 4.17
- sh 105
- sparc 86
- sparc64 86
- tilegx 102, removed in 4.17
- tilepro 102, removed in 4.17
- xtensa 135
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/getitimer