]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man7/socket.7
socket.7: select()/poll()/epoll honor SO_RCVLOWAT since Linux 2.6.28
[thirdparty/man-pages.git] / man7 / socket.7
index 3af6f3ef6552347f5ac852a4af3d19eba13de681..30b699a071ecb7ac9793fea46c024cb1151ce6cc 100644 (file)
@@ -61,7 +61,7 @@
 .\"    commit ea02f9411d9faa3553ed09ce0ec9f00ceae9885e
 .\"    Author: Michal Sekletar <msekleta@redhat.com>
 .\"
-.TH SOCKET 7 2017-09-15 Linux "Linux Programmer's Manual"
+.TH SOCKET 7 2019-03-06 Linux "Linux Programmer's Manual"
 .SH NAME
 socket \- Linux socket interface
 .SH SYNOPSIS
@@ -345,7 +345,7 @@ The argument for
 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.
@@ -397,7 +397,7 @@ takes the same argument type as
 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.
@@ -499,8 +499,7 @@ Expects an integer flag.
 .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
@@ -568,11 +567,11 @@ it always lingers in the background.
 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
@@ -624,8 +623,13 @@ Enable or disable the receiving of 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
@@ -692,27 +696,9 @@ recv(fd, buf, 2, MSG_PEEK);  // Peeks "ee"; offset set to 8
 .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
@@ -778,15 +764,19 @@ fails with the error
 .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
@@ -1162,6 +1152,7 @@ program is designed to always set this option.
 .BR setsockopt (2),
 .BR socket (2),
 .BR pcap (3),
+.BR address_families (7),
 .BR capabilities (7),
 .BR ddp (7),
 .BR ip (7),