1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)symlink.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt SYMLINK 2 10.Os BSD 4.2 11.Sh NAME 12.Nm symlink 13.Nd make symbolic link to a file 14.Sh SYNOPSIS 15.Fd #include <unistd.h> 16.Ft int 17.Fn symlink "const char *name1" "const char *name2" 18.Sh DESCRIPTION 19A symbolic link 20.Fa name2 21is created to 22.Fa name1 23.Pf ( Fa name2 24is the name of the 25file created, 26.Fa name1 27is the string 28used in creating the symbolic link). 29Either name may be an arbitrary path name; the files need not 30be on the same file system. 31.Sh RETURN VALUES 32Upon successful completion, a zero value is returned. 33If an error occurs, the error code is stored in 34.Va errno 35and a -1 value is returned. 36.Sh ERRORS 37The symbolic link succeeds unless: 38.Bl -tag -width ENAMETOO 39.It Bq Er ENOTDIR 40A component of the 41.Fa name2 42prefix is not a directory. 43.It Bq Er EINVAL 44Either 45.Fa name1 46or 47.Fa name2 48contains a character with the high-order bit set. 49.It Bq Er ENAMETOOLONG 50A component of either pathname exceeded 255 characters, 51or the entire length of either path name exceeded 1023 characters. 52.It Bq Er ENOENT 53The named file does not exist. 54.It Bq Er EACCES 55A component of the 56.Fa name2 57path prefix denies search permission. 58.It Bq Er ELOOP 59Too many symbolic links were encountered in translating the pathname. 60.It Bq Er EEXIST 61.Fa Name2 62already exists. 63.It Bq Er EIO 64An I/O error occurred while making the directory entry for 65.Fa name2 , 66or allocating the inode for 67.Fa name2 , 68or writing out the link contents of 69.Fa name2 . 70.It Bq Er EROFS 71The file 72.Fa name2 73would reside on a read-only file system. 74.It Bq Er ENOSPC 75The directory in which the entry for the new symbolic link is being placed 76cannot be extended because there is no space left on the file 77system containing the directory. 78.It Bq Er ENOSPC 79The new symbolic link cannot be created because there 80there is no space left on the file 81system that will contain the symbolic link. 82.It Bq Er ENOSPC 83There are no free inodes on the file system on which the 84symbolic link is being created. 85.It Bq Er EDQUOT 86The directory in which the entry for the new symbolic link 87is being placed cannot be extended because the 88user's quota of disk blocks on the file system 89containing the directory has been exhausted. 90.It Bq Er EDQUOT 91The new symbolic link cannot be created because the user's 92quota of disk blocks on the file system that will 93contain the symbolic link has been exhausted. 94.It Bq Er EDQUOT 95The user's quota of inodes on the file system on 96which the symbolic link is being created has been exhausted. 97.It Bq Er EIO 98An I/O error occurred while making the directory entry or allocating the inode. 99.It Bq Er EFAULT 100.Fa Name1 101or 102.Fa name2 103points outside the process's allocated address space. 104.El 105.Sh SEE ALSO 106.Xr link 2 , 107.Xr ln 1 , 108.Xr unlink 2 109.Sh HISTORY 110The 111.Nm 112function call appeared in 113.Bx 4.2 . 114