diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-08-16 03:01:48 +0200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-08-16 03:06:54 +0200 |
| commit | 5711c04f8fd207d9eafb2b6ba525ea940dde8a9b (patch) | |
| tree | 57db69b121fb0a36261aaa0946d1da7192d79a6f /man7/unix.7 | |
| parent | eabf3ae555dd8291faed51e860c01aaaefb1b809 (diff) | |
| download | man-pages-5711c04f8fd207d9eafb2b6ba525ea940dde8a9b.tar.gz | |
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man7/unix.7')
| -rw-r--r-- | man7/unix.7 | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/man7/unix.7 b/man7/unix.7 index 0204a33de2..9cc0bfe6f0 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -39,7 +39,7 @@ 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; @@ -52,7 +52,7 @@ and (since Linux 2.6.4) 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 @@ -76,7 +76,7 @@ field always contains 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), @@ -92,7 +92,7 @@ Some other system calls (for example, and .BR accept (2)) return an argument of this type. - +.PP Three types of address are distinguished in the .I sockaddr_un structure: @@ -104,9 +104,9 @@ filesystem pathname using When the address of a pathname socket is returned (by one of the system calls noted above), its length is - +.IP offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1 - +.IP and .I sun_path contains the null-terminated pathname. @@ -176,7 +176,7 @@ The argument that describes the enclosing .I sockaddr_un structure should have a value of at least: - +.IP .nf offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1 .fi @@ -193,7 +193,7 @@ For example, some (but not all) implementations .\" is 108 bytes append a null terminator if none is present in the supplied .IR sun_path . - +.PP When coding portable applications, keep in mind that some implementations .\" HP-UX @@ -202,7 +202,7 @@ have as short as 92 bytes. .\" Modern BSDs generally have 104, Tru64 and AIX have 104, .\" Solaris and Irix have 108 - +.PP Various system calls .RB ( accept (2), .BR recvfrom (2), @@ -226,7 +226,7 @@ In the Linux implementation, pathname sockets honor the permissions of the directory they are in. Creation of a new socket will fail if the process does not have write and search (execute) permission on the directory in which the socket is created. - +.PP On Linux, connecting to a stream socket object requires write permission on that socket; sending a datagram to a datagram socket likewise @@ -236,13 +236,13 @@ on a socket file, and on some systems (e.g., older BSDs), the socket permissions are ignored. Portable programs should not rely on this feature for security. - +.PP When creating a new socket, the owner and group of the socket file are set according to the usual rules. The socket file has all permissions enabled, other than those that are turned off by the process .BR umask (2). - +.PP The owner, group, and permissions of a pathname socket can be changed (using .BR chown (2) and @@ -259,10 +259,10 @@ and changing the ownership and permissions of the object (via and .BR fchmod (2)) has no effect on the accessibility of the socket. - +.PP Abstract sockets automatically disappear when all open references to the socket are closed. - +.PP The abstract socket namespace is a nonportable Linux extension. .\" .SS Socket options @@ -308,7 +308,7 @@ The change to 5 bytes came in Linux 2.3.15.) .SS Sockets API The following paragraphs describe domain-specific details and unsupported features of the sockets API for UNIX domain sockets on Linux. - +.PP UNIX domain sockets do not support the transmission of out-of-band data (the .B MSG_OOB @@ -316,12 +316,12 @@ flag for .BR send (2) and .BR recv (2)). - +.PP The .BR send (2) .B MSG_MORE flag is not supported by UNIX domain sockets. - +.PP Before Linux 3.4, .\" commit 9f6f9af7694ede6314bed281eec74d588ba9474f the use of @@ -331,7 +331,7 @@ in the argument of .BR recv (2) was not supported by UNIX domain sockets. - +.PP The .B SO_SNDBUF socket option does have an effect for UNIX domain sockets, but the @@ -381,7 +381,7 @@ ancillary message. Thus structure is defined in .I <sys/socket.h> as follows: - +.IP .in +4n .nf struct ucred { @@ -391,14 +391,14 @@ struct ucred { }; .fi .in - +.IP Since glibc 2.8, the .B _GNU_SOURCE feature test macro must be defined (before including .I any header files) in order to obtain the definition of this structure. - +.IP The credentials which the sender specifies are checked by the kernel. A process with effective user ID 0 is allowed to specify values that do not match its own. @@ -553,7 +553,7 @@ An in-flight file descriptor is one that has been sent using .BR sendmsg (2) but has not yet been accepted in the recipient process using .BR recvmsg (2). - +.IP This error is diagnosed since mainline Linux 4.5 (and in some earlier kernel versions where the fix has been backported). .\" commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 @@ -582,7 +582,7 @@ longer needed (using The usual UNIX close-behind semantics apply; the socket can be unlinked at any time and will be finally removed from the filesystem when the last reference to it is closed. - +.PP To pass file descriptors or credentials over a .BR SOCK_STREAM , you need @@ -591,7 +591,7 @@ to send or receive at least one byte of nonancillary data in the same or .BR recvmsg (2) call. - +.PP UNIX domain stream sockets do not support the notion of out-of-band data. .\" .SH BUGS @@ -619,7 +619,7 @@ then the returned address structure .I won't have a null terminator in .IR sun_path . - +.PP In addition, some implementations .\" i.e., traditional BSD don't require a null terminator when binding a socket (the @@ -629,12 +629,12 @@ argument is used to determine the length of and when the socket address is retrieved on these implementations, there is no null terminator in .IR sun_path . - +.PP Applications that retrieve socket addresses can (portably) code to handle the possibility that there is no null terminator in .IR sun_path by respecting the fact that the number of valid bytes in the pathname is: - +.PP strnlen(addr.sun_path, addrlen \- offsetof(sockaddr_un, sun_path)) .\" The following patch to amend kernel behavior was rejected: .\" http://thread.gmane.org/gmane.linux.kernel.api/2437 @@ -646,7 +646,7 @@ by respecting the fact that the number of valid bytes in the pathname is: .\" 2012-04-18 .\" .\" FIXME . Track http://austingroupbugs.net/view.php?id=561 - +.PP Alternatively, an application can retrieve the socket address by allocating a buffer of size .I "sizeof(struct sockaddr_un)+1" @@ -658,7 +658,7 @@ as and the extra zero byte ensures that there will be a null terminator for the string returned in .IR sun_path : - +.PP .nf .in +3 void *addrp; @@ -675,7 +675,7 @@ if (getsockname(sfd, (struct sockaddr *) addrp, &addrlen)) == \-1) printf("sun_path = %s\\n", ((struct sockaddr_un *) addrp)\->sun_path); .in .fi - +.PP This sort of messiness can be avoided if it is guaranteed that the applications that .I create |
