.\" commit ea02f9411d9faa3553ed09ce0ec9f00ceae9885e
.\" Author: Michal Sekletar <msekleta@redhat.com>
.\"
-.TH SOCKET 7 2017-05-03 Linux "Linux Programmer's Manual"
+.TH SOCKET 7 2019-03-06 Linux "Linux Programmer's Manual"
.SH NAME
socket \- Linux socket interface
.SH SYNOPSIS
program to the socket for use as a filter of incoming packets.
A packet will be dropped if the filter program returns zero.
If the filter program returns a
-non-zero value which is less than the packet's data length,
+nonzero value which is less than the packet's data length,
the packet will be truncated to the length returned.
If the value returned by the filter is greater than or equal to the
packet's data length, the packet is allowed to proceed unmodified.
is a file descriptor returned by the
.BR bpf (2)
system call and must refer to a program of type
-.BR BPF_PROG_TYPE_SOCKET_FILTER.
+.BR BPF_PROG_TYPE_SOCKET_FILTER .
.IP
These options may be set multiple times for a given socket,
each time replacing the previous filter program.
and
.BR SO_ATTACH_REUSEPORT_EBPF
takes the same argument type as
-.BR SO_ATTACH_BPF.
+.BR SO_ATTACH_BPF .
.IP
UDP support for this feature is available since Linux 4.5;
TCP support is available since Linux 4.6.
.I optlen
argument should contain the buffer size available
to receive the device name and is recommended to be
-.BR IFNAMSZ
+.BR IFNAMSIZ
bytes.
The real device name length is reported back in the
.I optlen
.in +4n
.EX
int cpu = 1;
-socklen_t len = sizeof(cpu);
-setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, &len);
+setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, sizeof(cpu));
.EE
.in
.IP
When set, this option will prevent
changing the filters associated with the socket.
These filters include any set using the socket options
-.BR SO_ATTACH_FILTER,
-.BR SO_ATTACH_BPF,
-.BR SO_ATTACH_REUSEPORT_CBPF
+.BR SO_ATTACH_FILTER ,
+.BR SO_ATTACH_BPF ,
+.BR SO_ATTACH_REUSEPORT_CBPF ,
and
-.BR SO_ATTACH_REUSEPORT_EPBF .
+.BR SO_ATTACH_REUSEPORT_EBPF .
.IP
The typical use case is for a privileged process to set up a raw socket
(an operation that requires the
control message.
For more information see
.BR unix (7).
-.\" FIXME Document SO_PASSSEC, added in 2.6.18; there is some info
-.\" in the 2.6.18 ChangeLog
+.TP
+.B SO_PASSSEC
+Enable or disable the receiving of the
+.B SCM_SECURITY
+control message.
+For more information see
+.BR unix (7).
.TP
.BR SO_PEEK_OFF " (since Linux 3.4)"
.\" commit ef64a54f6e558155b4f149bb10666b9e914b6c54
.in
.TP
.B SO_PEERCRED
-Return the credentials of the foreign process connected to this socket.
-This is possible only for connected
-.B AF_UNIX
-stream sockets and
-.B AF_UNIX
-stream and datagram socket pairs created using
-.BR socketpair (2);
-see
+Return the credentials of the peer process connected to this socket.
+For further details, see
.BR unix (7).
-The returned credentials are those that were in effect at the time
-of the call to
-.BR connect (2)
-or
-.BR socketpair (2).
-The argument is a
-.I ucred
-structure; define the
-.B _GNU_SOURCE
-feature test macro to obtain the definition of that structure from
-.IR <sys/socket.h> .
-This socket option is read-only.
.TP
.B SO_PRIORITY
Set the protocol-defined priority for all packets to be sent on
.B SO_RCVLOWAT
is changeable
only since Linux 2.4.
-The
-.BR select (2)
+.IP
+Before Linux 2.6.28
+.\" commit c7004482e8dcb7c3c72666395cfa98a216a4fb70
+.BR select (2),
+.BR poll (2),
and
-.BR poll (2)
-system calls currently do not respect the
+.BR epoll (7)
+did not respect the
.B SO_RCVLOWAT
setting on Linux,
-and mark a socket readable when even a single byte of data is available.
-A subsequent read from the socket will block until
+and indicated a socket as readable when even a single byte of data
+was available.
+A subsequent read from the socket would then block until
.B SO_RCVLOWAT
bytes are available.
.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=111049368106984&w=2
.\" commit 3b885787ea4112eaa80945999ea0901bf742707f
Indicates that an unsigned 32-bit value ancillary message (cmsg)
should be attached to received skbs indicating
-the number of packets dropped by the socket between
-the last received packet and this received packet.
+the number of packets dropped by the socket since its creation.
.TP
.B SO_SNDBUF
Sets or gets the maximum socket send buffer in bytes.
.BR setsockopt (2),
.BR socket (2),
.BR pcap (3),
+.BR address_families (7),
.BR capabilities (7),
.BR ddp (7),
.BR ip (7),