setitimer on x64
get or set value of an interval timer
sys_setitimer(int which, struct __kernel_old_itimerval *value, struct __kernel_old_itimerval *ovalue)
| number | 38 (0x26) |
|---|---|
| abi | common |
| kconfig | CONFIG_POSIX_TIMERS |
| entry point | sys_setitimer |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setitimer(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 38, the syscall number |
rdi | int which |
rsi | struct __kernel_old_itimerval *value |
rdx | struct __kernel_old_itimerval *ovalue |
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 104
- arm64 103
- arm 104
- riscv64 103
- ia32 104
- x32 1073741862
- loongarch64 103
- ppc64 104
- ppc 104
- s390x 104
- mips64 5036
- mipsn32 6036
- mipso32 4104
- alpha 362
- arc 103
- blackfin 104, removed in 4.17
- cris 104, removed in 4.17
- csky 103
- frv 104, removed in 4.17
- hexagon 103
- ia64 1118, removed in 6.7
- m32r 104, removed in 4.17
- m68k 104
- metag 103, removed in 4.17
- microblaze 104
- mn10300 104, removed in 4.17
- nds32 103, removed in 5.18
- nios2 103
- openrisc 103
- parisc 104
- score 103, removed in 4.17
- sh 104
- sparc 83
- sparc64 83
- tilegx 103, removed in 4.17
- tilepro 103, removed in 4.17
- xtensa 134
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setitimer