clock_getres on x64
clock and time functions
sys_clock_getres(clockid_t which_clock, struct __kernel_timespec *tp)
| number | 229 (0xe5) |
|---|---|
| abi | common |
| entry point | sys_clock_getres |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | clock_getres(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 229, the syscall number |
rdi | clockid_t which_clock |
rsi | struct __kernel_timespec *tp |
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 266
- arm64 114
- arm 264
- riscv64 114
- ia32 266
- x32 1073742053
- loongarch64 114
- ppc64 247
- ppc 247
- s390x 261
- mips64 5223
- mipsn32 6227
- mipso32 4264
- alpha 421
- arc 114
- blackfin 267, removed in 4.17
- cris 266, removed in 4.17
- csky 114
- frv 266, removed in 4.17
- hexagon 114
- ia64 1255, removed in 6.7
- m32r 266, removed in 4.17
- m68k 261
- metag 114, removed in 4.17
- microblaze 266
- mn10300 266, removed in 4.17
- nds32 114, removed in 5.18
- nios2 114
- openrisc 114
- parisc 257
- score 114, removed in 4.17
- sh 266
- sparc 258
- sparc64 258
- tilegx 114, removed in 4.17
- tilepro 114, removed in 4.17
- xtensa 246
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/clock_getres