sync_file_range on x64
sync a file segment with disk
sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, unsigned int flags)
| number | 277 (0x115) |
|---|---|
| abi | common |
| entry point | sys_sync_file_range |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | sync_file_range(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 277, the syscall number |
rdi | int fd |
rsi | loff_t offset |
rdx | loff_t nbytes |
r10 | unsigned int flags |
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 314
- arm64 84
- riscv64 84
- ia32 314
- x32 1073742101
- loongarch64 84
- s390x 307
- mips64 5264
- mipsn32 6268
- mipso32 4305
- alpha 469
- arc 84
- blackfin 343, removed in 4.17
- cris 314, removed in 4.17
- csky 84
- frv 314, removed in 4.17
- hexagon 84
- ia64 1300, removed in 6.7
- m32r 314, removed in 4.17
- m68k 307
- metag 84, removed in 4.17
- microblaze 314
- mn10300 315, removed in 4.17
- nios2 84
- openrisc 84
- parisc 292
- score 84, removed in 4.17
- sh 314
- sparc 255
- sparc64 255
- tilegx 84, removed in 4.17
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/sync_file_range