setsockopt on x32
get and set options on sockets
x32 has 2 syscalls called setsockopt, each with its own number.
setsockopt #1073741878 (common ABI)
sys_setsockopt(int fd, int level, int optname, char *optval, int optlen)
This syscall was removed in Linux 3.6.
| number | 1073741878 (0x40000036) |
|---|---|
| abi | common |
| entry point | sys_setsockopt |
| since | Linux 3.4 or earlier (3.4 is the first release scanned for x32) |
| removed in | Linux 3.6 |
| man page | setsockopt(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 1073741878, the syscall number |
rdi | int fd |
rsi | int level |
rdx | int optname |
r10 | char *optval |
r8 | int optlen |
rax | the return value |
Then run syscall to enter the kernel.
setsockopt #1073742365 (x32 ABI)
sys_setsockopt(int fd, int level, int optname, char *optval, int optlen)
| number | 1073742365 (0x4000021d) |
|---|---|
| abi | x32 |
| entry point | sys_setsockopt |
| since | Linux 3.6 |
| man page | setsockopt(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 1073742365, the syscall number |
rdi | int fd |
rsi | int level |
rdx | int optname |
r10 | char *optval |
r8 | int optlen |
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.
Every number in the x32 table already includes the x32 bit (0x40000000), and x32 specific syscalls start at 512.
Same syscall on other architectures
- x64 54
- x86 366
- arm64 208
- arm 294
- riscv64 208
- ia32 366
- loongarch64 208
- ppc64 339
- ppc 339
- s390x 366
- mips64 5053
- mipsn32 6053
- mipso32 4181
- alpha 105
- arc 208
- blackfin 327, removed in 4.17
- csky 208
- hexagon 208
- ia64 1203, removed in 6.7
- m68k 363
- metag 208, removed in 4.17
- microblaze 357
- nds32 208, removed in 5.18
- nios2 208
- openrisc 208
- parisc 181
- score 208, removed in 4.17
- sh 353
- sparc 355
- sparc64 355
- tilegx 208, removed in 4.17
- tilepro 208, removed in 4.17
- xtensa 97
Get this as JSON: https://api.syscall.sh/v2/syscalls/x32/setsockopt