unlinkat on x64
delete a name and possibly the file it refers to
sys_unlinkat(int dfd, const char *pathname, int flag)
| number | 263 (0x107) |
|---|---|
| abi | common |
| entry point | sys_unlinkat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | unlinkat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 263, the syscall number |
rdi | int dfd |
rsi | const char *pathname |
rdx | int flag |
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 301
- arm64 35
- arm 328
- riscv64 35
- ia32 301
- x32 1073742087
- loongarch64 35
- ppc64 292
- ppc 292
- s390x 294
- mips64 5253
- mipsn32 6257
- mipso32 4294
- alpha 456
- arc 35
- blackfin 301, removed in 4.17
- cris 301, removed in 4.17
- csky 35
- frv 301, removed in 4.17
- hexagon 35
- ia64 1287, removed in 6.7
- m32r 301, removed in 4.17
- m68k 294
- metag 35, removed in 4.17
- microblaze 301
- mn10300 302, removed in 4.17
- nds32 35, removed in 5.18
- nios2 35
- openrisc 35
- parisc 281
- score 35, removed in 4.17
- sh 301
- sparc 290
- sparc64 290
- tilegx 35, removed in 4.17
- tilepro 35, removed in 4.17
- xtensa 291
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/unlinkat