pread64 on x64
read from or write to a file descriptor at a given offset
sys_pread64(unsigned int fd, char *buf, size_t count, loff_t pos)
| number | 17 (0x11) |
|---|---|
| abi | common |
| entry point | sys_pread64 |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | pread64(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 17, the syscall number |
rdi | unsigned int fd |
rsi | 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 180
- arm64 67
- arm 180
- riscv64 67
- ia32 180
- x32 1073741841
- loongarch64 67
- ppc64 179
- ppc 179
- s390x 180
- mips64 5016
- mipsn32 6016
- mipso32 4200
- alpha 349
- arc 67
- blackfin 351, removed in 4.17
- cris 180, removed in 4.17
- csky 67
- frv 180, removed in 4.17
- hexagon 67
- ia64 1148, removed in 6.7
- m32r 180, removed in 4.17
- m68k 180
- metag 67, removed in 4.17
- microblaze 180
- mn10300 180, removed in 4.17
- nds32 67, removed in 5.18
- nios2 67
- openrisc 67
- parisc 108
- score 67, removed in 4.17
- sh 180
- sparc 67
- sparc64 67
- tilegx 67, removed in 4.17
- tilepro 67, removed in 4.17
- xtensa 30
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/pread64