]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/connect.2
user_namespaces.7: Minor wording fix to recently added text
[thirdparty/man-pages.git] / man2 / connect.2
index 5d6140540efa59f731c338f20ddc8b4349a178b6..679b0fec5035773f11b1f529c03205a09d2f087a 100644 (file)
@@ -64,7 +64,7 @@
 .\" Modified 1998, 1999 by Andi Kleen
 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
-.TH CONNECT 2 2014-09-06 "Linux" "Linux Programmer's Manual"
+.TH CONNECT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
 .SH NAME
 connect \- initiate a connection on a socket
 .SH SYNOPSIS
@@ -72,7 +72,7 @@ connect \- initiate a connection on a socket
 .BR "#include <sys/types.h>" "          /* See NOTES */"
 .br
 .B #include <sys/socket.h>
-.sp
+.PP
 .BI "int connect(int " sockfd ", const struct sockaddr *" addr ,
 .BI "            socklen_t " addrlen );
 .fi
@@ -94,7 +94,7 @@ is determined by the address space of the socket
 see
 .BR socket (2)
 for further details.
-
+.PP
 If the socket
 .I sockfd
 is of type
@@ -168,24 +168,31 @@ The passed address didn't have the correct address family in its
 field.
 .TP
 .B EAGAIN
-Insufficient entries in the routing cache.
+For nonblocking UNIX domain sockets, the socket is nonblocking, and the
+connection cannot be completed immediately.
+For other socket families, there are insufficient entries in the routing cache.
 .TP
 .B EALREADY
 The socket is nonblocking and a previous connection attempt has not yet
 been completed.
 .TP
 .B EBADF
-The file descriptor is not a valid index in the descriptor table.
+.I sockfd
+is not a valid open file descriptor.
 .TP
 .B ECONNREFUSED
-No-one listening on the remote address.
+A
+.BR connect ()
+on a stream socket found no one listening on the remote address.
 .TP
 .B EFAULT
 The socket structure address is outside the user's address space.
 .TP
 .B EINPROGRESS
-The socket is nonblocking and the connection cannot be completed
-immediately.
+The socket is nonblocking and the connection cannot be completed immediately.
+(UNIX domain sockets failed with
+.BR EAGAIN
+instead.)
 It is possible to
 .BR select (2)
 or
@@ -221,7 +228,9 @@ The socket is already connected.
 Network is unreachable.
 .TP
 .B ENOTSOCK
-The file descriptor is not associated with a socket.
+The file descriptor
+.I sockfd
+does not refer to a socket.
 .TP
 .B EPROTOTYPE
 The socket type does not support the requested communications protocol.
@@ -235,9 +244,9 @@ busy to accept new connections.
 Note that for IP sockets the timeout may
 be very long when syncookies are enabled on the server.
 .SH CONFORMING TO
-SVr4, 4.4BSD, (the
-.BR connect ()
-function first appeared in 4.2BSD), POSIX.1-2001.
+POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD,
+.RB (connect ()
+first appeared in 4.2BSD).
 .\" SVr4 documents the additional
 .\" general error codes
 .\" .BR EADDRNOTAVAIL ,
@@ -251,23 +260,17 @@ function first appeared in 4.2BSD), POSIX.1-2001.
 .\" It also
 .\" documents many additional error conditions not described here.
 .SH NOTES
-POSIX.1-2001 does not require the inclusion of
+POSIX.1 does not require the inclusion of
 .IR <sys/types.h> ,
 and this header file is not required on Linux.
 However, some historical (BSD) implementations required this header
 file, and portable applications are probably wise to include it.
-
-The third argument of
-.BR connect ()
-is in reality an
-.I int
-(and this is what 4.x BSD and libc4 and libc5 have).
-Some POSIX confusion resulted in the present
-.IR socklen_t ,
-also used by glibc.
-See also
+.PP
+For background on the
+.I socklen_t
+type, see
 .BR accept (2).
-
+.PP
 If
 .BR connect ()
 fails, consider the state of the socket as unspecified.