clock_adjtime on x64
tune kernel clock
sys_clock_adjtime(clockid_t which_clock, struct __kernel_timex *tx)
| number | 305 (0x131) |
|---|---|
| abi | common |
| kconfig | CONFIG_POSIX_TIMERS |
| entry point | sys_clock_adjtime |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | clock_adjtime(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 305, the syscall number |
rdi | clockid_t which_clock |
rsi | struct __kernel_timex *tx |
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 343
- arm64 266
- arm 372
- riscv64 266
- ia32 343
- x32 1073742129
- loongarch64 266
- ppc64 347
- ppc 347
- s390x 337
- mips64 5300
- mipsn32 6305
- mipso32 4341
- alpha 499
- arc 266
- blackfin 377, removed in 4.17
- cris 345, removed in 4.17
- csky 266
- hexagon 266
- ia64 1328, removed in 6.7
- m68k 342
- metag 266, removed in 4.17
- microblaze 373
- nds32 266, removed in 5.18
- nios2 266
- openrisc 266
- parisc 324
- score 266, removed in 4.17
- sh 361
- sparc 334
- sparc64 334
- tilegx 266, removed in 4.17
- tilepro 266, removed in 4.17
- xtensa 329
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/clock_adjtime