renameat on x64
change the name or location of a file
sys_renameat(int olddfd, const char *oldname, int newdfd, const char *newname)
| number | 264 (0x108) |
|---|---|
| abi | common |
| entry point | sys_renameat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | renameat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 264, the syscall number |
rdi | int olddfd |
rsi | const char *oldname |
rdx | int newdfd |
r10 | const char *newname |
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 302
- arm64 38
- arm 329
- ia32 302
- x32 1073742088
- ppc64 293
- ppc 293
- s390x 295
- mips64 5254
- mipsn32 6258
- mipso32 4295
- alpha 457
- arc 38
- blackfin 302, removed in 4.17
- cris 302, removed in 4.17
- frv 302, removed in 4.17
- hexagon 38
- ia64 1288, removed in 6.7
- m32r 302, removed in 4.17
- m68k 295
- metag 38, removed in 4.17
- microblaze 302
- mn10300 303, removed in 4.17
- nios2 38
- openrisc 38
- parisc 282
- score 38, removed in 4.17
- sh 302
- sparc 291
- sparc64 291
- tilegx 38, removed in 4.17
- tilepro 38, removed in 4.17
- xtensa 292
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/renameat