diff options
Diffstat (limited to 'man7/unix.7')
| -rw-r--r-- | man7/unix.7 | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/man7/unix.7 b/man7/unix.7 index 13568ba65d..1cdc335fba 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -9,6 +9,7 @@ .\" Modified, 2004-05-27, Michael Kerrisk, <mtk-manpages@gmx.net> .\" Added SOCK_SEQPACKET .\" +.\" FIXME Section titles and orderings in this page are very inconsistent .TH UNIX 7 2004-05-27 "Linux" "Linux Programmer's Manual" .SH NAME unix, PF_UNIX, AF_UNIX, PF_LOCAL, AF_LOCAL \- Sockets for local @@ -48,7 +49,7 @@ and delivers messages in the order that they were sent. Unix sockets support passing file descriptors or process credentials to other processes using ancillary data. -.SH "ADDRESS FORMAT" +.SS 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 @@ -87,7 +88,7 @@ The socket's address in this namespace is given by the rest of the bytes in .BR sun_path . Note that names in the abstract namespace are not zero-terminated. -.SH "SOCKET OPTIONS" +.SS Socket Options For historical reasons these socket options are specified with a SOL_SOCKET type even though they are PF_UNIX specific. They can be set with @@ -102,7 +103,7 @@ ancillary message. 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" +.SS (Un)supported Features The following paragraphs describe domain-specific details and unsupported features of the sockets API for Unix domain sockets on Linux. @@ -130,7 +131,7 @@ value imposes an upper limit on the size of outgoing datagrams. This limit is calculated as the doubled (see .BR socket (7)) option value less 32 bytes used for overhead. -.SH "ANCILLARY MESSAGES" +.SS Ancillary Messages Ancillary data is sent and received using .BR sendmsg (2) and @@ -186,40 +187,6 @@ To receive a 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 owner, group and their permissions can be changed. -Creation of a new socket will fail if the process does not have write and -search (execute) permission on the directory the socket is created in. -Connecting to the socket object requires read/write permission. -This behavior differs from many BSD-derived systems which -ignore permissions for Unix sockets. -Portable programs should not rely on -this feature for security. - -Binding to a socket with a filename creates a socket -in the file system that must be deleted by the caller when it is no -longer needed (using -.BR unlink (2)). -The usual Unix close-behind semantics apply; the socket can be unlinked -at any time and will be finally removed from the file system when the last -reference to it is closed. - -To pass file descriptors or credentials over a SOCK_STREAM, you need -to send or receive at least one byte of non-ancillary data in the same -.BR sendmsg (2) -or -.BR recvmsg (2) -call. - -Unix domain stream sockets do not support the notion of out-of-band data. .SH ERRORS .TP .B ENOMEM @@ -290,6 +257,40 @@ The sender passed invalid credentials in the Other errors can be generated by the generic socket layer or by the filesystem while generating a filesystem socket object. See the appropriate manual pages for more information. +.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 owner, group and their permissions can be changed. +Creation of a new socket will fail if the process does not have write and +search (execute) permission on the directory the socket is created in. +Connecting to the socket object requires read/write permission. +This behavior differs from many BSD-derived systems which +ignore permissions for Unix sockets. +Portable programs should not rely on +this feature for security. + +Binding to a socket with a filename creates a socket +in the file system that must be deleted by the caller when it is no +longer needed (using +.BR unlink (2)). +The usual Unix close-behind semantics apply; the socket can be unlinked +at any time and will be finally removed from the file system when the last +reference to it is closed. + +To pass file descriptors or credentials over a SOCK_STREAM, you need +to send or receive at least one byte of non-ancillary data in the same +.BR sendmsg (2) +or +.BR recvmsg (2) +call. + +Unix domain stream sockets do not support the notion of out-of-band data. .SH "SEE ALSO" .BR recvmsg (2), .BR sendmsg (2), |
