fallocate on x64
manipulate file space
sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
| number | 285 (0x11d) |
|---|---|
| abi | common |
| entry point | sys_fallocate |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | fallocate(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 285, the syscall number |
rdi | int fd |
rsi | int mode |
rdx | loff_t offset |
r10 | loff_t len |
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 324
- arm64 47
- arm 352
- riscv64 47
- ia32 324
- x32 1073742109
- loongarch64 47
- ppc64 309
- ppc 309
- s390x 314
- mips64 5279
- mipsn32 6283
- mipso32 4320
- alpha 480
- arc 47
- blackfin 356, removed in 4.17
- cris 324, removed in 4.17
- csky 47
- frv 324, removed in 4.17
- hexagon 47
- ia64 1303, removed in 6.7
- m32r 324, removed in 4.17
- m68k 320
- metag 47, removed in 4.17
- microblaze 324
- mn10300 325, removed in 4.17
- nds32 47, removed in 5.18
- nios2 47
- openrisc 47
- parisc 305
- score 47, removed in 4.17
- sh 324
- sparc 314
- sparc64 314
- tilegx 47, removed in 4.17
- tilepro 47, removed in 4.17
- xtensa 62
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/fallocate