recvfrom on x64
receive a message from a socket
sys_recvfrom(int fd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
| number | 45 (0x2d) |
|---|---|
| abi | 64 |
| entry point | sys_recvfrom |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | recvfrom(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 45, the syscall number |
rdi | int fd |
rsi | void *ubuf |
rdx | size_t size |
r10 | unsigned int flags |
r8 | struct sockaddr *addr |
r9 | int *addr_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 371
- arm64 207
- arm 292
- riscv64 207
- ia32 371
- x32 1073742341
- loongarch64 207
- ppc64 337
- ppc 337
- s390x 371
- mips64 5044
- mipsn32 6044
- mipso32 4176
- alpha 125
- arc 207
- blackfin 322, removed in 4.17
- csky 207
- hexagon 207
- ia64 1201, removed in 6.7
- m68k 368
- metag 207, removed in 4.17
- microblaze 355
- nds32 207, removed in 5.18
- nios2 207
- openrisc 207
- parisc 123
- score 207, removed in 4.17
- sh 351
- sparc 125
- sparc64 125
- tilegx 207, removed in 4.17
- tilepro 207, removed in 4.17
- xtensa 111
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/recvfrom