getsockopt
Partial in Antinomie 0.7.0 · Syscall list
Synopsis
Section titled “Synopsis”long getsockopt(int fd, int level, int optname, char *optval, int *optlen);| Number (x86-64) | 55 |
| ABI | 64 |
| Kernel entry point | sys_getsockopt |
This is the raw kernel prototype from the pinned Linux 6.12.94 schema, not the libc wrapper.
Description
Section titled “Description”Reads an option of a socket or 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 * |
Buffer the kernel fills with the option value. |
optlen (arg4) |
int * |
Pointer to the buffer size; the kernel writes the real size back. |
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 “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 | input value for the few options that also read one | arg3.optval_in |
the option has an input layout |
| ↳ pointee | Exit | the option value; known options use their layout, unknown pairs are raw bytes up to 128 KiB; length is the written length | arg3.optval |
result is 0; “invalid extent” if the written length exceeds the capacity |
optlen (arg4) |
Entry | the pointer itself, as a raw word | args.4, args.raw[4] |
|
| ↳ pointee | Entry and exit | int: the buffer capacity at entry, and the length the kernel wrote at exit |
arg4.optlen |
at exit only when result is 0 |
Family notes
Section titled “Family notes”- Selector:
(level, optname).arg4.optlenis recorded at entry as the capacity, and again at exit with the length the kernel wrote;arg3.optvalis recorded at exit on success, bounded by the written length.
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
tcp_zerocopy_receivebehindoptval(arg3):args.optval.<member>foraddress,copybuf_address,copybuf_len,err,flags,inq,length,msg_control,msg_controllen,msg_flags,recv_skip_hint,reserved. - Structure
wait_statusbehindoptlen(arg4):args.optlen.<member>forvalue.
See Syscall Trace filter for the full syntax.
Known gaps
Section titled “Known gaps”- An unknown
(level, optname)pair recordssockopt.unknown_optionwith the “no decoder” status at entry. - 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.