1*8269e767SBrooks Davis.\" Copyright (c) 1983, 1991, 1993 2*8269e767SBrooks Davis.\" The Regents of the University of California. All rights reserved. 3*8269e767SBrooks Davis.\" 4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 6*8269e767SBrooks Davis.\" are met: 7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 12*8269e767SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors 13*8269e767SBrooks Davis.\" may be used to endorse or promote products derived from this software 14*8269e767SBrooks Davis.\" without specific prior written permission. 15*8269e767SBrooks Davis.\" 16*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*8269e767SBrooks Davis.\" SUCH DAMAGE. 27*8269e767SBrooks Davis.\" 28*8269e767SBrooks Davis.Dd March 30, 2020 29*8269e767SBrooks Davis.Dt SYMLINK 2 30*8269e767SBrooks Davis.Os 31*8269e767SBrooks Davis.Sh NAME 32*8269e767SBrooks Davis.Nm symlink , 33*8269e767SBrooks Davis.Nm symlinkat 34*8269e767SBrooks Davis.Nd make symbolic link to a file 35*8269e767SBrooks Davis.Sh LIBRARY 36*8269e767SBrooks Davis.Lb libc 37*8269e767SBrooks Davis.Sh SYNOPSIS 38*8269e767SBrooks Davis.In unistd.h 39*8269e767SBrooks Davis.Ft int 40*8269e767SBrooks Davis.Fn symlink "const char *name1" "const char *name2" 41*8269e767SBrooks Davis.Ft int 42*8269e767SBrooks Davis.Fn symlinkat "const char *name1" "int fd" "const char *name2" 43*8269e767SBrooks Davis.Sh DESCRIPTION 44*8269e767SBrooks DavisA symbolic link 45*8269e767SBrooks Davis.Fa name2 46*8269e767SBrooks Davisis created to 47*8269e767SBrooks Davis.Fa name1 48*8269e767SBrooks Davis.Fa ( name2 49*8269e767SBrooks Davisis the name of the 50*8269e767SBrooks Davisfile created, 51*8269e767SBrooks Davis.Fa name1 52*8269e767SBrooks Davisis the string 53*8269e767SBrooks Davisused in creating the symbolic link). 54*8269e767SBrooks DavisEither name may be an arbitrary path name; the files need not 55*8269e767SBrooks Davisbe on the same file system. 56*8269e767SBrooks Davis.Pp 57*8269e767SBrooks DavisThe 58*8269e767SBrooks Davis.Fn symlinkat 59*8269e767SBrooks Davissystem call is equivalent to 60*8269e767SBrooks Davis.Fn symlink 61*8269e767SBrooks Davisexcept in the case where 62*8269e767SBrooks Davis.Fa name2 63*8269e767SBrooks Davisspecifies a relative path. 64*8269e767SBrooks DavisIn this case the symbolic link is created relative to the directory 65*8269e767SBrooks Davisassociated with the file descriptor 66*8269e767SBrooks Davis.Fa fd 67*8269e767SBrooks Davisinstead of the current working directory. 68*8269e767SBrooks DavisIf 69*8269e767SBrooks Davis.Fn symlinkat 70*8269e767SBrooks Davisis passed the special value 71*8269e767SBrooks Davis.Dv AT_FDCWD 72*8269e767SBrooks Davisin the 73*8269e767SBrooks Davis.Fa fd 74*8269e767SBrooks Davisparameter, the current working directory is used and the behavior is 75*8269e767SBrooks Davisidentical to a call to 76*8269e767SBrooks Davis.Fn symlink . 77*8269e767SBrooks Davis.Sh RETURN VALUES 78*8269e767SBrooks Davis.Rv -std symlink 79*8269e767SBrooks Davis.Sh ERRORS 80*8269e767SBrooks DavisThe symbolic link succeeds unless: 81*8269e767SBrooks Davis.Bl -tag -width Er 82*8269e767SBrooks Davis.It Bq Er ENOTDIR 83*8269e767SBrooks DavisA component of the 84*8269e767SBrooks Davis.Fa name2 85*8269e767SBrooks Davispath prefix is not a directory. 86*8269e767SBrooks Davis.It Bq Er ENAMETOOLONG 87*8269e767SBrooks DavisA component of the 88*8269e767SBrooks Davis.Fa name2 89*8269e767SBrooks Davispathname exceeded 255 characters, 90*8269e767SBrooks Davisor the entire length of either path name exceeded 1023 characters. 91*8269e767SBrooks Davis.It Bq Er ENOENT 92*8269e767SBrooks DavisA component of the 93*8269e767SBrooks Davis.Fa name2 94*8269e767SBrooks Davispath prefix does not exist. 95*8269e767SBrooks Davis.It Bq Er EACCES 96*8269e767SBrooks DavisA component of the 97*8269e767SBrooks Davis.Fa name2 98*8269e767SBrooks Davispath prefix denies search permission, or write permission is denied on the 99*8269e767SBrooks Davisparent directory of the file to be created. 100*8269e767SBrooks Davis.It Bq Er ELOOP 101*8269e767SBrooks DavisToo many symbolic links were encountered in translating the 102*8269e767SBrooks Davis.Fa name2 103*8269e767SBrooks Davispath name. 104*8269e767SBrooks Davis.It Bq Er EEXIST 105*8269e767SBrooks DavisThe path name pointed at by the 106*8269e767SBrooks Davis.Fa name2 107*8269e767SBrooks Davisargument 108*8269e767SBrooks Davisalready exists. 109*8269e767SBrooks Davis.It Bq Er EPERM 110*8269e767SBrooks DavisThe parent directory of the file named by 111*8269e767SBrooks Davis.Fa name2 112*8269e767SBrooks Davishas its immutable flag set, see the 113*8269e767SBrooks Davis.Xr chflags 2 114*8269e767SBrooks Davismanual page for more information. 115*8269e767SBrooks Davis.It Bq Er EIO 116*8269e767SBrooks DavisAn I/O error occurred while making the directory entry for 117*8269e767SBrooks Davis.Fa name2 , 118*8269e767SBrooks Davisallocating the inode for 119*8269e767SBrooks Davis.Fa name2 , 120*8269e767SBrooks Davisor writing out the link contents of 121*8269e767SBrooks Davis.Fa name2 . 122*8269e767SBrooks Davis.It Bq Er EROFS 123*8269e767SBrooks DavisThe file 124*8269e767SBrooks Davis.Fa name2 125*8269e767SBrooks Daviswould reside on a read-only file system. 126*8269e767SBrooks Davis.It Bq Er ENOSPC 127*8269e767SBrooks DavisThe directory in which the entry for the new symbolic link is being placed 128*8269e767SBrooks Daviscannot be extended because there is no space left on the file 129*8269e767SBrooks Davissystem containing the directory. 130*8269e767SBrooks Davis.It Bq Er ENOSPC 131*8269e767SBrooks DavisThe new symbolic link cannot be created because 132*8269e767SBrooks Davisthere is no space left on the file 133*8269e767SBrooks Davissystem that will contain the symbolic link. 134*8269e767SBrooks Davis.It Bq Er ENOSPC 135*8269e767SBrooks DavisThere are no free inodes on the file system on which the 136*8269e767SBrooks Davissymbolic link is being created. 137*8269e767SBrooks Davis.It Bq Er EDQUOT 138*8269e767SBrooks DavisThe directory in which the entry for the new symbolic link 139*8269e767SBrooks Davisis being placed cannot be extended because the 140*8269e767SBrooks Davisuser's quota of disk blocks on the file system 141*8269e767SBrooks Daviscontaining the directory has been exhausted. 142*8269e767SBrooks Davis.It Bq Er EDQUOT 143*8269e767SBrooks DavisThe new symbolic link cannot be created because the user's 144*8269e767SBrooks Davisquota of disk blocks on the file system that will 145*8269e767SBrooks Daviscontain the symbolic link has been exhausted. 146*8269e767SBrooks Davis.It Bq Er EDQUOT 147*8269e767SBrooks DavisThe user's quota of inodes on the file system on 148*8269e767SBrooks Daviswhich the symbolic link is being created has been exhausted. 149*8269e767SBrooks Davis.It Bq Er EINTEGRITY 150*8269e767SBrooks DavisCorrupted data was detected while reading from the file system. 151*8269e767SBrooks Davis.It Bq Er EFAULT 152*8269e767SBrooks DavisThe 153*8269e767SBrooks Davis.Fa name1 154*8269e767SBrooks Davisor 155*8269e767SBrooks Davis.Fa name2 156*8269e767SBrooks Davisargument 157*8269e767SBrooks Davispoints outside the process's allocated address space. 158*8269e767SBrooks Davis.El 159*8269e767SBrooks Davis.Pp 160*8269e767SBrooks DavisIn addition to the errors returned by the 161*8269e767SBrooks Davis.Fn symlink , 162*8269e767SBrooks Davisthe 163*8269e767SBrooks Davis.Fn symlinkat 164*8269e767SBrooks Davismay fail if: 165*8269e767SBrooks Davis.Bl -tag -width Er 166*8269e767SBrooks Davis.It Bq Er EBADF 167*8269e767SBrooks DavisThe 168*8269e767SBrooks Davis.Fa name2 169*8269e767SBrooks Davisargument does not specify an absolute path and the 170*8269e767SBrooks Davis.Fa fd 171*8269e767SBrooks Davisargument is neither 172*8269e767SBrooks Davis.Dv AT_FDCWD 173*8269e767SBrooks Davisnor a valid file descriptor open for searching. 174*8269e767SBrooks Davis.It Bq Er ENOTDIR 175*8269e767SBrooks DavisThe 176*8269e767SBrooks Davis.Fa name2 177*8269e767SBrooks Davisargument is not an absolute path and 178*8269e767SBrooks Davis.Fa fd 179*8269e767SBrooks Davisis neither 180*8269e767SBrooks Davis.Dv AT_FDCWD 181*8269e767SBrooks Davisnor a file descriptor associated with a directory. 182*8269e767SBrooks Davis.El 183*8269e767SBrooks Davis.Sh SEE ALSO 184*8269e767SBrooks Davis.Xr ln 1 , 185*8269e767SBrooks Davis.Xr chflags 2 , 186*8269e767SBrooks Davis.Xr link 2 , 187*8269e767SBrooks Davis.Xr lstat 2 , 188*8269e767SBrooks Davis.Xr readlink 2 , 189*8269e767SBrooks Davis.Xr unlink 2 , 190*8269e767SBrooks Davis.Xr symlink 7 191*8269e767SBrooks Davis.Sh STANDARDS 192*8269e767SBrooks DavisThe 193*8269e767SBrooks Davis.Fn symlinkat 194*8269e767SBrooks Davissystem call follows The Open Group Extended API Set 2 specification. 195*8269e767SBrooks Davis.Sh HISTORY 196*8269e767SBrooks DavisThe 197*8269e767SBrooks Davis.Fn symlink 198*8269e767SBrooks Davissystem call appeared in 199*8269e767SBrooks Davis.Bx 4.2 . 200*8269e767SBrooks DavisThe 201*8269e767SBrooks Davis.Fn symlinkat 202*8269e767SBrooks Davissystem call appeared in 203*8269e767SBrooks Davis.Fx 8.0 . 204