swapoff on x64
start/stop swapping to file/device
sys_swapoff(const char *specialfile)
| number | 168 (0xa8) |
|---|---|
| abi | common |
| kconfig | CONFIG_SWAP |
| entry point | sys_swapoff |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | swapoff(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 168, the syscall number |
rdi | const char *specialfile |
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 115
- arm64 225
- arm 115
- riscv64 225
- ia32 115
- x32 1073741992
- loongarch64 225
- ppc64 115
- ppc 115
- s390x 115
- mips64 5163
- mipsn32 6163
- mipso32 4115
- alpha 304
- arc 225
- cris 115, removed in 4.17
- csky 225
- frv 115, removed in 4.17
- hexagon 225
- ia64 1095, removed in 6.7
- m32r 115, removed in 4.17
- m68k 115
- metag 225, removed in 4.17
- microblaze 115
- mn10300 115, removed in 4.17
- nds32 225, removed in 5.18
- nios2 225
- openrisc 225
- parisc 115
- score 225, removed in 4.17
- sh 115
- sparc 213
- sparc64 213
- tilegx 225, removed in 4.17
- tilepro 225, removed in 4.17
- xtensa 177
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/swapoff