utimensat on x64
change file timestamps with nanosecond precision
sys_utimensat(int dfd, const char *filename, struct __kernel_timespec *utimes, int flags)
| number | 280 (0x118) |
|---|---|
| abi | common |
| entry point | sys_utimensat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | utimensat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 280, the syscall number |
rdi | int dfd |
rsi | const char *filename |
rdx | struct __kernel_timespec *utimes |
r10 | int flags |
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 320
- arm64 88
- arm 348
- riscv64 88
- ia32 320
- x32 1073742104
- loongarch64 88
- ppc64 304
- ppc 304
- s390x 315
- mips64 5275
- mipsn32 6279
- mipso32 4316
- alpha 475
- arc 88
- blackfin 347, removed in 4.17
- cris 320, removed in 4.17
- csky 88
- frv 320, removed in 4.17
- hexagon 88
- ia64 1306, removed in 6.7
- m32r 320, removed in 4.17
- m68k 316
- metag 88, removed in 4.17
- microblaze 320
- mn10300 321, removed in 4.17
- nds32 88, removed in 5.18
- nios2 88
- openrisc 88
- parisc 301
- score 88, removed in 4.17
- sh 320
- sparc 310
- sparc64 310
- tilegx 88, removed in 4.17
- tilepro 88, removed in 4.17
- xtensa 296
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/utimensat