mirror of https://github.com/mkerrisk/man-pages
unix.7: Fix description of abstract socket names
As reported by Lennart Poettering: The part about "abstract" sockets is misleading as it suggests that the sockaddr returned by getsockname() would necessarily have the size of sizeof(struct sockaddr), which however is not the case: getsockname() returns exactly the sockaddr size that was passed in on bind(). In particular, two sockets that are bound to the same sockaddr but different sizes are completely independent. See https://bugzilla.kernel.org/show_bug.cgi?id=19812 Reported-by: Lennart Poettering <mzxreary@0pointer.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
6074c3e6f8
commit
156a0e0d7e
26
man7/unix.7
26
man7/unix.7
|
@ -12,7 +12,7 @@
|
|||
.\" address that can appear in the sockaddr_un structure: pathname,
|
||||
.\" unnamed, and abstract.
|
||||
.\"
|
||||
.TH UNIX 7 2010-09-10 "Linux" "Linux Programmer's Manual"
|
||||
.TH UNIX 7 2010-10-10 "Linux" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
unix, AF_UNIX, AF_LOCAL \- Sockets for local
|
||||
interprocess communication
|
||||
|
@ -109,24 +109,26 @@ should not be inspected.
|
|||
an abstract socket address is distinguished by the fact that
|
||||
.IR sun_path[0]
|
||||
is a null byte ('\\0').
|
||||
All of the remaining bytes in
|
||||
.I sun_path
|
||||
define the "name" of the socket.
|
||||
The socket's address in this namespace is given by the additional
|
||||
bytes in
|
||||
.IR sun_path
|
||||
that are covered by the specified length of the address structure.
|
||||
(Null bytes in the name have no special significance.)
|
||||
The name has no connection with file system pathnames.
|
||||
The socket's address in this namespace is given by the rest of the
|
||||
bytes in
|
||||
.IR sun_path .
|
||||
When the address of an abstract socket is returned by
|
||||
.BR getsockname (2),
|
||||
.BR getpeername (2),
|
||||
and
|
||||
.BR accept (2),
|
||||
its length is
|
||||
.IR "sizeof(struct sockaddr_un)" ,
|
||||
and
|
||||
.I sun_path
|
||||
contains the abstract name.
|
||||
the returned
|
||||
.I addrlen
|
||||
is greater than
|
||||
.IR "sizeof(sa_family_t)"
|
||||
(i.e., greater than 2), and the name of the socket is contained in
|
||||
the first
|
||||
.IR "(addrlen \- sizeof(sa_family_t))"
|
||||
bytes of
|
||||
.IR sun_path .
|
||||
The abstract socket namespace is a nonportable Linux extension.
|
||||
.SS Socket Options
|
||||
For historical reasons these socket options are specified with a
|
||||
|
|
Loading…
Reference in New Issue