text
stringlengths
0
234
and the latest version of this page,
can be found at
\%https://www.kernel.org/doc/man\-pages/.
.so man3/des_crypt.3
.\" this man page is copyright (c) 1999 andi kleen <[email protected]>,
.\" copyright (c) 2008-2014, michael kerrisk <[email protected]>,
.\" and copyright (c) 2016, heinrich schuchardt <[email protected]>
.\"
.\" %%%license_start(verbatim_one_para)
.\" permission is granted to distribute possibly modified copies
.\" of this page provided the header is included verbatim,
.\" and in case of nontrivial modification author and date
.\" of the modification is added to the header.
.\" %%%license_end
.\"
.\" modified, 2003-12-02, michael kerrisk, <[email protected]>
.\" modified, 2003-09-23, adam langley
.\" modified, 2004-05-27, michael kerrisk, <[email protected]>
.\" added sock_seqpacket
.\" 2008-05-27, mtk, provide a clear description of the three types of
.\" address that can appear in the sockaddr_un structure: pathname,
.\" unnamed, and abstract.
.\"
.th unix 7 2021-03-22 "linux" "linux programmer's manual"
.sh name
unix \- sockets for local interprocess communication
.sh synopsis
.nf
.b #include <sys/socket.h>
.b #include <sys/un.h>
.pp
.ib unix_socket " = socket(af_unix, type, 0);"
.ib error " = socketpair(af_unix, type, 0, int *" sv ");"
.fi
.sh description
the
.b af_unix
(also known as
.br af_local )
socket family is used to communicate between processes on the same machine
efficiently.
traditionally, unix domain sockets can be either unnamed,
or bound to a filesystem pathname (marked as being of type socket).
linux also supports an abstract namespace which is independent of the
filesystem.
.pp
valid socket types in the unix domain are:
.br sock_stream ,
for a stream-oriented socket;
.br sock_dgram ,
for a datagram-oriented socket that preserves message boundaries
(as on most unix implementations, unix domain datagram
sockets are always reliable and don't reorder datagrams);
and (since linux 2.6.4)
.br sock_seqpacket ,
for a sequenced-packet socket that is connection-oriented,
preserves message boundaries,
and delivers messages in the order that they were sent.
.pp
unix domain sockets support passing file descriptors or process credentials
to other processes using ancillary data.
.ss address format
a unix domain socket address is represented in the following structure:
.pp
.in +4n
.ex
.\" #define unix_path_max 108
.\"
struct sockaddr_un {
sa_family_t sun_family; /* af_unix */
char sun_path[108]; /* pathname */
};
.ee
.in
.pp
the
.i sun_family
field always contains
.br af_unix .
on linux,
.i sun_path
is 108 bytes in size; see also notes, below.
.pp
various systems calls (for example,
.br bind (2),
.br connect (2),
and
.br sendto (2))
take a
.i sockaddr_un
argument as input.
some other system calls (for example,
.br getsockname (2),
.br getpeername (2),
.br recvfrom (2),
and
.br accept (2))
return an argument of this type.