diff options
Diffstat (limited to 'lib/libc/sys/connect.2')
-rw-r--r-- | lib/libc/sys/connect.2 | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/lib/libc/sys/connect.2 b/lib/libc/sys/connect.2 index eb38ab3..446fab5 100644 --- a/lib/libc/sys/connect.2 +++ b/lib/libc/sys/connect.2 @@ -68,6 +68,30 @@ only once; datagram sockets may use multiple times to change their association. Datagram sockets may dissolve the association by connecting to an invalid address, such as a null address. +.Sh IMPLEMENTATION NOTES +.Pp +In the non-threaded library +.Fn connect +is implemented as the +.Va connect +syscall. +.Pp +In the threaded library, the +.Va connect +syscall is assembled to +.Fn _thread_sys_connect +and +.Fn connect +is implemented as a function which locks +.Va s +for read and write, then calls +.Fn _thread_sys_connect . +If the call to +.Fn _thread_sys_connect +would block, a context switch is performed. Before returning, +.Fn connect +unlocks +.Va s . .Sh RETURN VALUES If the connection or binding succeeds, 0 is returned. Otherwise a -1 is returned, and a more specific error @@ -79,10 +103,10 @@ The call fails if: .Bl -tag -width EADDRNOTAVAILABB .It Bq Er EBADF -.Fa S +.Fa s is not a valid descriptor. .It Bq Er ENOTSOCK -.Fa S +.Fa s is a descriptor for a file, not a socket. .It Bq Er EADDRNOTAVAIL The specified address is not available on this machine. @@ -121,8 +145,6 @@ These errors may not apply in future versions of the UNIX IPC domain. .Bl -tag -width EADDRNOTAVAILABB .It Bq Er ENOTDIR A component of the path prefix is not a directory. -.It Bq Er EINVAL -The pathname contains a character with the high-order bit set. .It Bq Er ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters. @@ -137,11 +159,11 @@ Too many symbolic links were encountered in translating the pathname. .El .Sh SEE ALSO .Xr accept 2 , +.Xr getsockname 2 , .Xr select 2 , -.Xr socket 2 , -.Xr getsockname 2 +.Xr socket 2 .Sh HISTORY The -.Nm +.Fn connect function call appeared in .Bx 4.2 . |