18269e767SBrooks Davis.\" Copyright (c) 1983, 1991, 1993 28269e767SBrooks Davis.\" The Regents of the University of California. All rights reserved. 38269e767SBrooks Davis.\" 48269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 58269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 68269e767SBrooks Davis.\" are met: 78269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 88269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 98269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 108269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 118269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 128269e767SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors 138269e767SBrooks Davis.\" may be used to endorse or promote products derived from this software 148269e767SBrooks Davis.\" without specific prior written permission. 158269e767SBrooks Davis.\" 168269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 178269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 188269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 208269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 218269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 238269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 258269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 268269e767SBrooks Davis.\" SUCH DAMAGE. 278269e767SBrooks Davis.\" 288269e767SBrooks Davis.Dd March 30, 2020 298269e767SBrooks Davis.Dt SYMLINK 2 308269e767SBrooks Davis.Os 318269e767SBrooks Davis.Sh NAME 328269e767SBrooks Davis.Nm symlink , 338269e767SBrooks Davis.Nm symlinkat 348269e767SBrooks Davis.Nd make symbolic link to a file 358269e767SBrooks Davis.Sh LIBRARY 368269e767SBrooks Davis.Lb libc 378269e767SBrooks Davis.Sh SYNOPSIS 388269e767SBrooks Davis.In unistd.h 398269e767SBrooks Davis.Ft int 408269e767SBrooks Davis.Fn symlink "const char *name1" "const char *name2" 418269e767SBrooks Davis.Ft int 428269e767SBrooks Davis.Fn symlinkat "const char *name1" "int fd" "const char *name2" 438269e767SBrooks Davis.Sh DESCRIPTION 448269e767SBrooks DavisA symbolic link 458269e767SBrooks Davis.Fa name2 468269e767SBrooks Davisis created to 478269e767SBrooks Davis.Fa name1 488269e767SBrooks Davis.Fa ( name2 498269e767SBrooks Davisis the name of the 508269e767SBrooks Davisfile created, 518269e767SBrooks Davis.Fa name1 528269e767SBrooks Davisis the string 538269e767SBrooks Davisused in creating the symbolic link). 548269e767SBrooks DavisEither name may be an arbitrary path name; the files need not 558269e767SBrooks Davisbe on the same file system. 568269e767SBrooks Davis.Pp 578269e767SBrooks DavisThe 588269e767SBrooks Davis.Fn symlinkat 598269e767SBrooks Davissystem call is equivalent to 608269e767SBrooks Davis.Fn symlink 618269e767SBrooks Davisexcept in the case where 628269e767SBrooks Davis.Fa name2 638269e767SBrooks Davisspecifies a relative path. 648269e767SBrooks DavisIn this case the symbolic link is created relative to the directory 658269e767SBrooks Davisassociated with the file descriptor 668269e767SBrooks Davis.Fa fd 678269e767SBrooks Davisinstead of the current working directory. 688269e767SBrooks DavisIf 698269e767SBrooks Davis.Fn symlinkat 708269e767SBrooks Davisis passed the special value 718269e767SBrooks Davis.Dv AT_FDCWD 728269e767SBrooks Davisin the 738269e767SBrooks Davis.Fa fd 748269e767SBrooks Davisparameter, the current working directory is used and the behavior is 758269e767SBrooks Davisidentical to a call to 768269e767SBrooks Davis.Fn symlink . 778269e767SBrooks Davis.Sh RETURN VALUES 788269e767SBrooks Davis.Rv -std symlink 798269e767SBrooks Davis.Sh ERRORS 808269e767SBrooks DavisThe symbolic link succeeds unless: 818269e767SBrooks Davis.Bl -tag -width Er 828269e767SBrooks Davis.It Bq Er ENOTDIR 838269e767SBrooks DavisA component of the 848269e767SBrooks Davis.Fa name2 858269e767SBrooks Davispath prefix is not a directory. 868269e767SBrooks Davis.It Bq Er ENAMETOOLONG 878269e767SBrooks DavisA component of the 888269e767SBrooks Davis.Fa name2 898269e767SBrooks Davispathname exceeded 255 characters, 908269e767SBrooks Davisor the entire length of either path name exceeded 1023 characters. 918269e767SBrooks Davis.It Bq Er ENOENT 928269e767SBrooks DavisA component of the 938269e767SBrooks Davis.Fa name2 948269e767SBrooks Davispath prefix does not exist. 958269e767SBrooks Davis.It Bq Er EACCES 968269e767SBrooks DavisA component of the 978269e767SBrooks Davis.Fa name2 988269e767SBrooks Davispath prefix denies search permission, or write permission is denied on the 998269e767SBrooks Davisparent directory of the file to be created. 1008269e767SBrooks Davis.It Bq Er ELOOP 1018269e767SBrooks DavisToo many symbolic links were encountered in translating the 1028269e767SBrooks Davis.Fa name2 1038269e767SBrooks Davispath name. 1048269e767SBrooks Davis.It Bq Er EEXIST 1058269e767SBrooks DavisThe path name pointed at by the 1068269e767SBrooks Davis.Fa name2 1078269e767SBrooks Davisargument 1088269e767SBrooks Davisalready exists. 1098269e767SBrooks Davis.It Bq Er EPERM 1108269e767SBrooks DavisThe parent directory of the file named by 1118269e767SBrooks Davis.Fa name2 1128269e767SBrooks Davishas its immutable flag set, see the 1138269e767SBrooks Davis.Xr chflags 2 1148269e767SBrooks Davismanual page for more information. 1158269e767SBrooks Davis.It Bq Er EIO 1168269e767SBrooks DavisAn I/O error occurred while making the directory entry for 1178269e767SBrooks Davis.Fa name2 , 1188269e767SBrooks Davisallocating the inode for 1198269e767SBrooks Davis.Fa name2 , 1208269e767SBrooks Davisor writing out the link contents of 1218269e767SBrooks Davis.Fa name2 . 1228269e767SBrooks Davis.It Bq Er EROFS 1238269e767SBrooks DavisThe file 1248269e767SBrooks Davis.Fa name2 1258269e767SBrooks Daviswould reside on a read-only file system. 1268269e767SBrooks Davis.It Bq Er ENOSPC 1278269e767SBrooks DavisThe directory in which the entry for the new symbolic link is being placed 1288269e767SBrooks Daviscannot be extended because there is no space left on the file 1298269e767SBrooks Davissystem containing the directory. 1308269e767SBrooks Davis.It Bq Er ENOSPC 1318269e767SBrooks DavisThe new symbolic link cannot be created because 1328269e767SBrooks Davisthere is no space left on the file 1338269e767SBrooks Davissystem that will contain the symbolic link. 1348269e767SBrooks Davis.It Bq Er ENOSPC 1358269e767SBrooks DavisThere are no free inodes on the file system on which the 1368269e767SBrooks Davissymbolic link is being created. 1378269e767SBrooks Davis.It Bq Er EDQUOT 1388269e767SBrooks DavisThe directory in which the entry for the new symbolic link 1398269e767SBrooks Davisis being placed cannot be extended because the 1408269e767SBrooks Davisuser's quota of disk blocks on the file system 1418269e767SBrooks Daviscontaining the directory has been exhausted. 1428269e767SBrooks Davis.It Bq Er EDQUOT 1438269e767SBrooks DavisThe new symbolic link cannot be created because the user's 1448269e767SBrooks Davisquota of disk blocks on the file system that will 1458269e767SBrooks Daviscontain the symbolic link has been exhausted. 1468269e767SBrooks Davis.It Bq Er EDQUOT 1478269e767SBrooks DavisThe user's quota of inodes on the file system on 1488269e767SBrooks Daviswhich the symbolic link is being created has been exhausted. 1498269e767SBrooks Davis.It Bq Er EINTEGRITY 1508269e767SBrooks DavisCorrupted data was detected while reading from the file system. 1518269e767SBrooks Davis.It Bq Er EFAULT 1528269e767SBrooks DavisThe 1538269e767SBrooks Davis.Fa name1 1548269e767SBrooks Davisor 1558269e767SBrooks Davis.Fa name2 1568269e767SBrooks Davisargument 1578269e767SBrooks Davispoints outside the process's allocated address space. 1588269e767SBrooks Davis.El 1598269e767SBrooks Davis.Pp 1608269e767SBrooks DavisIn addition to the errors returned by the 1618269e767SBrooks Davis.Fn symlink , 1628269e767SBrooks Davisthe 1638269e767SBrooks Davis.Fn symlinkat 1648269e767SBrooks Davismay fail if: 1658269e767SBrooks Davis.Bl -tag -width Er 1668269e767SBrooks Davis.It Bq Er EBADF 1678269e767SBrooks DavisThe 1688269e767SBrooks Davis.Fa name2 1698269e767SBrooks Davisargument does not specify an absolute path and the 1708269e767SBrooks Davis.Fa fd 1718269e767SBrooks Davisargument is neither 1728269e767SBrooks Davis.Dv AT_FDCWD 1738269e767SBrooks Davisnor a valid file descriptor open for searching. 1748269e767SBrooks Davis.It Bq Er ENOTDIR 1758269e767SBrooks DavisThe 1768269e767SBrooks Davis.Fa name2 1778269e767SBrooks Davisargument is not an absolute path and 1788269e767SBrooks Davis.Fa fd 1798269e767SBrooks Davisis neither 1808269e767SBrooks Davis.Dv AT_FDCWD 1818269e767SBrooks Davisnor a file descriptor associated with a directory. 1828269e767SBrooks Davis.El 1838269e767SBrooks Davis.Sh SEE ALSO 1848269e767SBrooks Davis.Xr ln 1 , 1858269e767SBrooks Davis.Xr chflags 2 , 1868269e767SBrooks Davis.Xr link 2 , 1878269e767SBrooks Davis.Xr lstat 2 , 1888269e767SBrooks Davis.Xr readlink 2 , 1898269e767SBrooks Davis.Xr unlink 2 , 1908269e767SBrooks Davis.Xr symlink 7 1918269e767SBrooks Davis.Sh STANDARDS 1928269e767SBrooks DavisThe 1938269e767SBrooks Davis.Fn symlinkat 1948269e767SBrooks Davissystem call follows The Open Group Extended API Set 2 specification. 1958269e767SBrooks Davis.Sh HISTORY 1968269e767SBrooks DavisThe 1978269e767SBrooks Davis.Fn symlink 1988269e767SBrooks Davissystem call appeared in 1998269e767SBrooks Davis.Bx 4.2 . 2008269e767SBrooks DavisThe 2018269e767SBrooks Davis.Fn symlinkat 2028269e767SBrooks Davissystem call appeared in 2038269e767SBrooks Davis.Fx 8.0 . 204