.fi
.SH DESCRIPTION
The sock_diag netlink subsystem provides a mechanism for obtaining
-information about sockets of various protocol families from the kernel.
+information about sockets of various address families from the kernel.
This subsystem can be used to obtain information about individual
sockets or request a list of sockets.
-In the request the caller can specify an additional information it would
-like to obtain about the socket, e.g. memory information or
-family-specific stuff.
+In the request, the caller can specify additional information it would
+like to obtain about the socket, for example, memory information or
+information specific to the address family.
When requesting a list of sockets, the caller can specify filters that
would be applied by the kernel to select a subset of sockets to report.
-For now there is only an ability to filter sockets by state (connected,
-listening, etc.)
+For now, there is only the ability to filter sockets by state (connected,
+listening, and so on.)
-Note that sock_diag reports only those sockets that have a name,
-i.e. either bound explicitly with
+Note that sock_diag reports only those sockets that have a name;
+that is, either sockets bound explicitly with
.BR bind (2)
or sockets that were automatically bound to an address (e.g., by
.BR connect (2)).
.IR /proc/net/unix ,
.IR /proc/net/tcp ,
.IR /proc/net/udp ,
-etc.
-
+and so on.
+.\"
.SS Request
-The request starts with
+The request starts with a
.I "struct nlmsghdr"
header described in
.BR netlink (7)
.I nlmsg_type
field set to
.BR SOCK_DIAG_BY_FAMILY .
-It is followed by a protocol family specific header that starts with
-a common part shared by all protocol families:
+It is followed by a header specific to the address family that starts with
+a common part shared by all address families:
.in +4n
.nf
The fields of this structure are as follows:
.TP
.I sdiag_family
-A protocol family.
+An address family.
It should be set to the appropriate
.B AF_*
constant.
.BR AF_INET6,
and to 0 otherwise.
.PP
-If
+If the
.I nlmsg_flags
field of the
.I "struct nlmsghdr"
-header has
+header has the
.BR NLM_F_DUMP
-flag set, it means that a list of sockets is being requested,
+flag set, it means that a list of sockets is being requested;
otherwise it is a query about an individual socket.
-
+.\"
.SS Response
-The response starts with
+The response starts with a
.I "struct nlmsghdr"
-header and is followed by an array of family-specific objects.
+header and is followed by an array of objects specific to the address family.
The array is to be accessed with the standard
.B NLMSG_*
-macros from
+macros from the
.BR netlink (3)
API.
.PP
The fields of this structure are as follows:
.TP
.I sdiag_family
-The protocol family, it should be set to
+The address family, it should be set to
.BR AF_UNIX .
.PP
.I sdiag_protocol
described below in "Socket memory information" subsection.
.TP
.B INET_DIAG_INFO
-The payload associated with this attribute is protocol specific.
-For TCP sockets it is an object of type
+The payload associated with this attribute is specific to the address family.
+For TCP sockets, it is an object of type
.IR "struct tcp_info" .
.TP
.B INET_DIAG_CONG