accept4 on x64
accept a connection on a socket
sys_accept4(int fd, struct sockaddr *upeer_sockaddr, int *upeer_addrlen, int flags)
| number | 288 (0x120) |
|---|---|
| abi | common |
| entry point | sys_accept4 |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | accept4(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 288, the syscall number |
rdi | int fd |
rsi | struct sockaddr *upeer_sockaddr |
rdx | int *upeer_addrlen |
r10 | int flags |
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 364
- arm64 242
- arm 366
- riscv64 242
- ia32 364
- x32 1073742112
- loongarch64 242
- ppc64 344
- ppc 344
- s390x 364
- mips64 5293
- mipsn32 6297
- mipso32 4334
- alpha 502
- arc 242
- cris 341, removed in 4.17
- csky 242
- hexagon 242
- ia64 1334, removed in 6.7
- m68k 361
- metag 242, removed in 4.17
- microblaze 362
- nds32 242, removed in 5.18
- nios2 242
- openrisc 242
- parisc 320
- score 242, removed in 4.17
- sh 358
- sparc 323
- sparc64 323
- tilegx 242, removed in 4.17
- tilepro 242, removed in 4.17
- xtensa 333
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/accept4