pwrite64 on x64
read from or write to a file descriptor at a given offset
sys_pwrite64(unsigned int fd, const char *buf, size_t count, loff_t pos)
| number | 18 (0x12) |
|---|---|
| abi | common |
| entry point | sys_pwrite64 |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | pwrite64(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 18, the syscall number |
rdi | unsigned int fd |
rsi | const char *buf |
rdx | size_t count |
r10 | loff_t pos |
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 181
- arm64 68
- arm 181
- riscv64 68
- ia32 181
- x32 1073741842
- loongarch64 68
- ppc64 180
- ppc 180
- s390x 181
- mips64 5017
- mipsn32 6017
- mipso32 4201
- alpha 350
- arc 68
- blackfin 352, removed in 4.17
- cris 181, removed in 4.17
- csky 68
- frv 181, removed in 4.17
- hexagon 68
- ia64 1149, removed in 6.7
- m32r 181, removed in 4.17
- m68k 181
- metag 68, removed in 4.17
- microblaze 181
- mn10300 181, removed in 4.17
- nds32 68, removed in 5.18
- nios2 68
- openrisc 68
- parisc 109
- score 68, removed in 4.17
- sh 181
- sparc 68
- sparc64 68
- tilegx 68, removed in 4.17
- tilepro 68, removed in 4.17
- xtensa 31
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/pwrite64