sendto on x64
send a message on a socket
sys_sendto(int fd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
| number | 44 (0x2c) |
|---|---|
| abi | common |
| entry point | sys_sendto |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | sendto(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 44, the syscall number |
rdi | int fd |
rsi | void *buff |
rdx | size_t len |
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 369
- arm64 206
- arm 290
- riscv64 206
- ia32 369
- x32 1073741868
- loongarch64 206
- ppc64 335
- ppc 335
- s390x 369
- mips64 5043
- mipsn32 6043
- mipso32 4180
- alpha 133
- arc 206
- blackfin 326, removed in 4.17
- csky 206
- hexagon 206
- ia64 1199, removed in 6.7
- m68k 366
- metag 206, removed in 4.17
- microblaze 353
- nds32 206, removed in 5.18
- nios2 206
- openrisc 206
- parisc 82
- score 206, removed in 4.17
- sh 349
- sparc 133
- sparc64 133
- tilegx 206, removed in 4.17
- tilepro 206, removed in 4.17
- xtensa 110
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/sendto