setsockopt
Partial in Antinomie 0.7.0 · Syscall list
Synopsis
Section titled “Synopsis”long setsockopt(int fd, int level, int optname, char *optval, int optlen);| Number (x86-64) | 54 |
| ABI | 64 |
| Kernel entry point | sys_setsockopt |
This is the raw kernel prototype from the pinned Linux 6.12.94 schema, not the libc wrapper.
Description
Section titled “Description”Sets an option on a socket or on a protocol layer, identified by a level and an option name.
Arguments
Section titled “Arguments”| Name | Type | Meaning |
|---|---|---|
fd (arg0) |
int |
File descriptor to operate on. |
level (arg1) |
int |
Protocol level, SOL_SOCKET (1) or a protocol number such as IPPROTO_TCP (6). |
optname (arg2) |
int |
Option name within the level. |
optval (arg3) |
char * |
Pointer to the option value. |
optlen (arg4) |
int |
Size of the option value in bytes. |
Return value
Section titled “Return value”On success: 0.
In an Antinomie trace the Return column and the ret filter field show the raw kernel return value. On failure that is the negative errno, for example -2 for ENOENT, not the -1 plus errno that the libc wrapper gives. syscall.errno holds the positive errno and syscall.success is false.
Common errors
Section titled “Common errors”| Raw return | Name | Meaning |
|---|---|---|
-9 |
EBADF |
A file descriptor is not valid for this operation. |
-22 |
EINVAL |
An argument is invalid. |
-92 |
ENOPROTOOPT |
The protocol does not support this option. |
Man page
Section titled “Man page”Captured by Antinomie
Section titled “Captured by Antinomie”Coverage mark: Partial. Known (level, option) pairs decode their value. An unknown pair records the raw bytes (up to 128 KiB) together with a sockopt.unknown_option “no decoder” gap, and a few nested structures are left raw.
Every call is recorded as an Entry record (the six argument words and the pointees copied at entry) and an Exit record (the return value and the pointees copied at exit).
Arguments
Section titled “Arguments”| Argument | When | How | Recorded field key | Condition |
|---|---|---|---|---|
fd (arg0) |
Entry | raw scalar word | args.0, args.fd |
|
level (arg1) |
Entry | raw scalar word | args.1, args.level |
|
optname (arg2) |
Entry | raw scalar word | args.2, args.optname |
|
optval (arg3) |
Entry | the pointer itself, as a raw word | args.3, args.raw[3] |
|
| ↳ pointee | Entry | the option value; known options use their layout (integers, linger, timeouts, interface names, congestion control names, membership structures); unknown (level, optname) pairs are raw bytes up to 128 KiB |
arg3.optval |
length from optlen (arg4); “invalid extent” on a size mismatch |
| ↳ pointee | Entry | array of sock_filter instructions (8 bytes each) |
arg3.optval.filter |
SO_ATTACH_FILTER or SO_ATTACH_REUSEPORT_CBPF; “invalid extent” if the length is 0 or above 4,096 |
optlen (arg4) |
Entry | raw scalar word | args.4, args.optlen |
Family notes
Section titled “Family notes”- Selector:
(level, optname). The value is recorded at entry asarg3.optval, with a known layout for known options (integers,linger, timeouts, socket filters with their instruction array, interface names, congestion control names).
Filter fields
Section titled “Filter fields”- Result:
ret,syscall.errno,syscall.success,syscall.duration_ns. - Argument words:
args.fd(arg0),args.level(arg1),args.optname(arg2),args.optval(arg3),args.optlen(arg4);args.0toargs.5by position. - Structure
sock_fprogbehindoptval(arg3):args.optval.<member>forfilter,len.
See Syscall Trace filter for the full syntax.
Known gaps
Section titled “Known gaps”- An unknown
(level, optname)pair also recordssockopt.unknown_optionwith the “no decoder” status; a few nested structures (netfilter table replacement, multicast source lists) keep only their top-level bytes. - See the coverage mark above for the code paths that record a gap.
For what the capture statuses mean, see Capture statuses. For what is never recorded, see Known gaps.