accept on x64
accept a connection on a socket
sys_accept(int fd, struct sockaddr *upeer_sockaddr, int *upeer_addrlen)
| number | 43 (0x2b) |
|---|---|
| abi | common |
| entry point | sys_accept |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | accept(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 43, the syscall number |
rdi | int fd |
rsi | struct sockaddr *upeer_sockaddr |
rdx | int *upeer_addrlen |
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
- arm64 202
- arm 285
- riscv64 202
- x32 1073741867
- loongarch64 202
- ppc64 330
- ppc 330
- mips64 5042
- mipsn32 6042
- mipso32 4168
- alpha 99
- arc 202
- blackfin 314, removed in 4.17
- csky 202
- hexagon 202
- ia64 1194, removed in 6.7
- metag 202, removed in 4.17
- microblaze 349
- nds32 202, removed in 5.18
- nios2 202
- openrisc 202
- parisc 35
- score 202, removed in 4.17
- sh 344
- sparc 99
- sparc64 99
- tilegx 202, removed in 4.17
- tilepro 202, removed in 4.17
- xtensa 103
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/accept