rmdir on x64
delete a directory
sys_rmdir(const char *pathname)
| number | 84 (0x54) |
|---|---|
| abi | common |
| entry point | sys_rmdir |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | rmdir(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 84, the syscall number |
rdi | const char *pathname |
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 40
- arm 40
- ia32 40
- x32 1073741908
- ppc64 40
- ppc 40
- s390x 40
- mips64 5082
- mipsn32 6082
- mipso32 4040
- alpha 137
- blackfin 40, removed in 4.17
- cris 40, removed in 4.17
- frv 40, removed in 4.17
- ia64 1056, removed in 6.7
- m32r 40, removed in 4.17
- m68k 40
- microblaze 40
- mn10300 40, removed in 4.17
- parisc 40
- score 1031, removed in 4.17
- sh 40
- sparc 137
- sparc64 137
- xtensa 39
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/rmdir