1*8269e767SBrooks Davis.\" Copyright (c) 2013 The FreeBSD Foundation 2*8269e767SBrooks Davis.\" 3*8269e767SBrooks Davis.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from 4*8269e767SBrooks Davis.\" the FreeBSD Foundation. 5*8269e767SBrooks Davis.\" 6*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 7*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 8*8269e767SBrooks Davis.\" are met: 9*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 10*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 11*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 12*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 13*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 14*8269e767SBrooks Davis.\" 15*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 16*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 19*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*8269e767SBrooks Davis.\" SUCH DAMAGE. 26*8269e767SBrooks Davis.\" 27*8269e767SBrooks Davis.Dd February 13, 2013 28*8269e767SBrooks Davis.Dt CONNECTAT 2 29*8269e767SBrooks Davis.Os 30*8269e767SBrooks Davis.Sh NAME 31*8269e767SBrooks Davis.Nm connectat 32*8269e767SBrooks Davis.Nd initiate a connection on a socket 33*8269e767SBrooks Davis.Sh LIBRARY 34*8269e767SBrooks Davis.Lb libc 35*8269e767SBrooks Davis.Sh SYNOPSIS 36*8269e767SBrooks Davis.In sys/types.h 37*8269e767SBrooks Davis.In sys/socket.h 38*8269e767SBrooks Davis.Pp 39*8269e767SBrooks Davis.In fcntl.h 40*8269e767SBrooks Davis.Ft int 41*8269e767SBrooks Davis.Fn connectat "int fd" "int s" "const struct sockaddr *name" "socklen_t namelen" 42*8269e767SBrooks Davis.Sh DESCRIPTION 43*8269e767SBrooks DavisThe 44*8269e767SBrooks Davis.Fn connectat 45*8269e767SBrooks Davissystem call initiates a connection on the socket 46*8269e767SBrooks Davis.Fa s . 47*8269e767SBrooks DavisWhen passed the special value 48*8269e767SBrooks Davis.Dv AT_FDCWD 49*8269e767SBrooks Davisin the 50*8269e767SBrooks Davis.Fa fd 51*8269e767SBrooks Davisparameter, the behavior is identical to a call to 52*8269e767SBrooks Davis.Xr connect 2 . 53*8269e767SBrooks DavisOtherwise, 54*8269e767SBrooks Davis.Fn connectat 55*8269e767SBrooks Davisworks like the 56*8269e767SBrooks Davis.Xr connect 2 57*8269e767SBrooks Davissystem call with two exceptions: 58*8269e767SBrooks Davis.Pp 59*8269e767SBrooks Davis.Bl -enum -offset indent -compact 60*8269e767SBrooks Davis.It 61*8269e767SBrooks DavisIt is limited to sockets in the PF_LOCAL domain. 62*8269e767SBrooks Davis.Pp 63*8269e767SBrooks Davis.It 64*8269e767SBrooks DavisIf the file path stored in the 65*8269e767SBrooks Davis.Fa sun_path 66*8269e767SBrooks Davisfield of the sockaddr_un structure is a relative path, it is located relative 67*8269e767SBrooks Davisto the directory associated with the file descriptor 68*8269e767SBrooks Davis.Fa fd . 69*8269e767SBrooks Davis.El 70*8269e767SBrooks Davis.Sh RETURN VALUES 71*8269e767SBrooks Davis.Rv -std connectat 72*8269e767SBrooks Davis.Sh ERRORS 73*8269e767SBrooks DavisThe 74*8269e767SBrooks Davis.Fn connectat 75*8269e767SBrooks Davissystem call may fail with the same errors as the 76*8269e767SBrooks Davis.Xr connect 2 77*8269e767SBrooks Davissystem call or with the following errors: 78*8269e767SBrooks Davis.Bl -tag -width Er 79*8269e767SBrooks Davis.It Bq Er EBADF 80*8269e767SBrooks DavisThe 81*8269e767SBrooks Davis.Fa sun_path 82*8269e767SBrooks Davisfield does not specify an absolute path and the 83*8269e767SBrooks Davis.Fa fd 84*8269e767SBrooks Davisargument is neither 85*8269e767SBrooks Davis.Dv AT_FDCWD 86*8269e767SBrooks Davisnor a valid file descriptor. 87*8269e767SBrooks Davis.It Bq Er ENOTDIR 88*8269e767SBrooks DavisThe 89*8269e767SBrooks Davis.Fa sun_path 90*8269e767SBrooks Davisfield is not an absolute path and 91*8269e767SBrooks Davis.Fa fd 92*8269e767SBrooks Davisis neither 93*8269e767SBrooks Davis.Dv AT_FDCWD 94*8269e767SBrooks Davisnor a file descriptor associated with a directory. 95*8269e767SBrooks Davis.El 96*8269e767SBrooks Davis.Sh SEE ALSO 97*8269e767SBrooks Davis.Xr bindat 2 , 98*8269e767SBrooks Davis.Xr connect 2 , 99*8269e767SBrooks Davis.Xr socket 2 , 100*8269e767SBrooks Davis.Xr unix 4 101*8269e767SBrooks Davis.Sh AUTHORS 102*8269e767SBrooks DavisThe 103*8269e767SBrooks Davis.Nm 104*8269e767SBrooks Daviswas developed by 105*8269e767SBrooks Davis.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net 106*8269e767SBrooks Davisunder sponsorship from the FreeBSD Foundation. 107