fsync on x64
synchronize a file's in-core state with storage device
sys_fsync(unsigned int fd)
| number | 74 (0x4a) |
|---|---|
| abi | common |
| entry point | sys_fsync |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | fsync(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 74, the syscall number |
rdi | unsigned int fd |
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 118
- arm64 82
- arm 118
- riscv64 82
- ia32 118
- x32 1073741898
- loongarch64 82
- ppc64 118
- ppc 118
- s390x 118
- mips64 5072
- mipsn32 6072
- mipso32 4118
- alpha 95
- arc 82
- blackfin 118, removed in 4.17
- cris 118, removed in 4.17
- csky 82
- frv 118, removed in 4.17
- hexagon 82
- ia64 1051, removed in 6.7
- m32r 118, removed in 4.17
- m68k 118
- metag 82, removed in 4.17
- microblaze 118
- mn10300 118, removed in 4.17
- nds32 82, removed in 5.18
- nios2 82
- openrisc 82
- parisc 118
- score 82, removed in 4.17
- sh 118
- sparc 95
- sparc64 95
- tilegx 82, removed in 4.17
- tilepro 82, removed in 4.17
- xtensa 26
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/fsync