.IB unix_socket " = socket(PF_UNIX, type, 0);"
.br
.IB error " = socketpair(PF_UNIX, type, 0, int *" sv ");"
-
.SH DESCRIPTION
The
.B PF_UNIX
Unix sockets support passing file descriptors or process credentials
to other processes using ancillary data.
-
.SH "ADDRESS FORMAT"
A Unix address is defined as a filename in the filesystem or
as a unique string in the abstract namespace. Sockets created by
bytes in
.BR sun_path .
Note that names in the abstract namespace are not zero-terminated.
-
.SH "SOCKET OPTIONS"
For historical reasons these socket options are specified with a
SOL_SOCKET type even though they are PF_UNIX specific.
When this option is set and the socket is not yet connected
a unique name in the abstract namespace will be generated automatically.
Expects an integer boolean flag.
-
.SH "(UN)SUPPORTED FEATURES"
The following paragraphs describe domain-specific details and
unsupported features of the sockets API for Unix domain sockets on Linux.
This limit is calculated as the doubled (see
.BR socket (7))
option value less 32 bytes used for overhead.
-
.SH "ANCILLARY MESSAGES"
Ancillary data is sent and received using
.BR sendmsg (2)
.B cmsg_type
field to the type. For more information see
.BR cmsg (3).
-
.TP
.B SCM_RIGHTS
Send or receive a set of open file descriptors from another process.
The data portion contains an integer array of the file descriptors.
The passed file descriptors behave as though they have been created with
.BR dup (2).
-
.TP
.B SCM_CREDENTIALS
Send or receive Unix credentials. This can be used for authentication.
message the
.B SO_PASSCRED
option must be enabled on the socket.
-
.SH VERSIONS
.B SCM_CREDENTIALS
and the abstract namespace were introduced with Linux 2.2 and should not
be used in portable programs.
(Some BSD-derived systems also support credential passing,
but the implementation details differ.)
-
.SH NOTES
In the Linux implementation, sockets which are visible in the
filesystem honour the permissions of the directory they are in. Their