]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/accept.2
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man2 / accept.2
index 54b25502341697bfeff48c75e4dfeb2fb61382fe..f120cc2132dc30a3c7b8860fd0db28d3c5cf854b 100644 (file)
@@ -69,7 +69,7 @@ and is listening for connections after a
 
 The argument
 .I addr
-is a pointer to a 
+is a pointer to a
 .I sockaddr
 structure.
 This structure is filled in with the address of the peer socket,
@@ -77,7 +77,7 @@ as known to the communications layer.
 The exact format of the address returned
 .I addr
 is determined by the socket's address family (see
-.BR socket (2) 
+.BR socket (2)
 and the respective protocol man pages).
 The
 .I addrlen
@@ -85,7 +85,8 @@ argument is a value-result argument: it should initially contain the
 size of the structure pointed to by
 .IR addr ;
 on return it will contain the actual length (in bytes) of the address
-returned. When 
+returned.
+When
 .I addr
 is NULL nothing is filled in.
 .PP
@@ -93,10 +94,11 @@ If no pending
 connections are present on the queue, and the socket is not marked as
 non-blocking,
 .BR accept ()
-blocks the caller until a connection is present.  If the socket is marked
+blocks the caller until a connection is present.
+If the socket is marked
 non-blocking and no pending connections are present on the queue,
 .BR accept ()
-fails with the error EAGAIN. 
+fails with the error EAGAIN.
 .PP
 In order to be notified of incoming connections on a socket, you can use
 .BR select (2)
@@ -105,8 +107,8 @@ or
 A readable event will be delivered when a new connection is attempted and you
 may then call
 .BR accept ()
-to get a socket for that connection.  Alternatively, you can set the socket
-to deliver
+to get a socket for that connection.
+Alternatively, you can set the socket to deliver
 .B SIGIO
 when activity occurs on a socket; see
 .BR socket (7)
@@ -117,11 +119,13 @@ such as
 DECNet,
 .BR accept ()
 can be thought of as merely dequeuing the next connection request and not
-implying confirmation.  Confirmation can be implied by
+implying confirmation.
+Confirmation can be implied by
 a normal read or write on the new file descriptor, and rejection can be
-implied by closing the new socket. Currently only 
-DECNet 
-has these semantics on Linux. 
+implied by closing the new socket.
+Currently only
+DECNet
+has these semantics on Linux.
 .SH NOTES
 There may not always be a connection waiting after a
 .B SIGIO
@@ -152,19 +156,21 @@ On error, \-1 is returned, and
 .I errno
 is set appropriately.
 .SH "ERROR HANDLING"
-Linux 
+Linux
 .BR accept ()
-passes already-pending network errors on the new socket 
-as an error code from 
-.BR accept (). 
+passes already-pending network errors on the new socket
+as an error code from
+.BR accept ().
 This behaviour differs from other BSD socket
-implementations. For reliable operation the application should detect
-the network errors defined for the protocol after 
+implementations.
+For reliable operation the application should detect
+the network errors defined for the protocol after
 .BR accept ()
 and treat
-them like 
+them like
 .BR EAGAIN
-by retrying. In case of TCP/IP these are
+by retrying.
+In case of TCP/IP these are
 .BR ENETDOWN ,
 .BR EPROTO ,
 .BR ENOPROTOOPT ,
@@ -190,7 +196,7 @@ A connection has been aborted.
 .TP
 .B EINTR
 The system call was interrupted by a signal that was caught
-before a valid connection arrived. 
+before a valid connection arrived.
 .TP
 .B EINVAL
 Socket is not listening for connections, or
@@ -208,7 +214,7 @@ The descriptor references a file, not a socket.
 .TP
 .B EOPNOTSUPP
 The referenced socket is not of type
-.BR SOCK_STREAM . 
+.BR SOCK_STREAM .
 .PP
 .BR accept ()
 may fail if:
@@ -219,7 +225,7 @@ The
 argument is not in a writable part of the user address space.
 .TP
 .B ENOBUFS, ENOMEM
-Not enough free memory.  
+Not enough free memory.
 This often means that the memory allocation is limited by the socket buffer
 limits, not by the system memory.
 .TP
@@ -234,7 +240,8 @@ may fail if:
 Firewall rules forbid connection.
 .PP
 In addition, network errors for the new socket and as defined
-for the protocol may be returned. Various Linux kernels can
+for the protocol may be returned.
+Various Linux kernels can
 return other errors such as
 .BR ENOSR ,
 .BR ESOCKTNOSUPPORT ,
@@ -244,18 +251,18 @@ The value
 .B ERESTARTSYS
 may be seen during a trace.
 .SH "CONFORMING TO"
-SVr4, 4.4BSD, 
+SVr4, 4.4BSD,
 .RB ( accept ()
-first appeared in 4.2BSD), POSIX.1-2001.  
+first appeared in 4.2BSD), POSIX.1-2001.
 .\" The BSD man page documents five possible error returns
 .\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
-.\" POSIX.1-2001 documents errors 
+.\" POSIX.1-2001 documents errors
 .\" EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
-.\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK. 
+.\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK.
 .\" In addition, SUSv2 documents EFAULT and ENOSR.
 .LP
 On Linux, the new socket returned by
-.BR accept () 
+.BR accept ()
 does \fInot\fP inherit file status flags such as
 .BR O_NONBLOCK
 and
@@ -264,9 +271,9 @@ from the listening socket.
 This behaviour differs from the canonical BSD sockets implementation.
 .\" Some testing seems to show that Tru64 5.1 and HP-UX 11 also
 .\" do not inherit file status flags -- MTK Jun 05
-Portable programs should not rely on inheritance or non-inheritance 
-of file status flags and always explicitly set all required flags on 
-the socket returned from 
+Portable programs should not rely on inheritance or non-inheritance
+of file status flags and always explicitly set all required flags on
+the socket returned from
 .BR accept ().
 .SH NOTE
 The third argument of
@@ -281,14 +288,16 @@ Quoting Linus Torvalds:
 
 .\" .I fails: only italicizes a single line
 "_Any_ sane library _must_ have "socklen_t" be the same size
-as int.  Anything else breaks any BSD socket layer stuff.
+as int.
+Anything else breaks any BSD socket layer stuff.
 POSIX initially \fIdid\fP make it a size_t, and I (and hopefully others, but
-obviously not too many) complained to them very loudly indeed.  Making
-it a size_t is completely broken, exactly because size_t very seldom is
-the same size as "int" on 64-bit architectures, for example.  And it
+obviously not too many) complained to them very loudly indeed.
+Making it a size_t is completely broken, exactly because size_t very
+seldom is the same size as "int" on 64-bit architectures, for example.
+And it
 \fIhas\fP to be the same size as "int" because that's what the BSD socket
-interface is. 
-Anyway, the POSIX people eventually got a clue, and created "socklen_t". 
+interface is.
+Anyway, the POSIX people eventually got a clue, and created "socklen_t".
 They shouldn't have touched it in the first place, but once they did
 they felt it had to have a named type for some unfathomable reason
 (probably somebody didn't like losing face over having done the original