4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libc / sys / symlink.2
CommitLineData
15715acc
KB
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
1ea523c5 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
88b3ccf2 5.\"
15715acc 6.\" @(#)symlink.2 8.1 (Berkeley) %G%
1ea523c5 7.\"
931b8415
CL
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
1ea523c5 19A symbolic link
931b8415 20.Fa name2
1ea523c5 21is created to
931b8415
CL
22.Fa name1
23.Pf ( Fa name2
24is the name of the
25file created,
26.Fa name1
27is the string
1ea523c5
KM
28used in creating the symbolic link).
29Either name may be an arbitrary path name; the files need not
30be on the same file system.
931b8415 31.Sh RETURN VALUES
1ea523c5 32Upon successful completion, a zero value is returned.
931b8415
CL
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
1ea523c5 48contains a character with the high-order bit set.
931b8415 49.It Bq Er ENAMETOOLONG
b5984ffe
KM
50A component of either pathname exceeded 255 characters,
51or the entire length of either path name exceeded 1023 characters.
931b8415 52.It Bq Er ENOENT
b5984ffe 53The named file does not exist.
931b8415
CL
54.It Bq Er EACCES
55A component of the
56.Fa name2
57path prefix denies search permission.
58.It Bq Er ELOOP
b5984ffe 59Too many symbolic links were encountered in translating the pathname.
931b8415
CL
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
fd690c8b
KM
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.
931b8415 78.It Bq Er ENOSPC
fd690c8b
KM
79The new symbolic link cannot be created because there
80there is no space left on the file
81system that will contain the symbolic link.
931b8415 82.It Bq Er ENOSPC
fd690c8b
KM
83There are no free inodes on the file system on which the
84symbolic link is being created.
931b8415 85.It Bq Er EDQUOT
fd690c8b
KM
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.
931b8415 90.It Bq Er EDQUOT
fd690c8b
KM
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.
931b8415 94.It Bq Er EDQUOT
fd690c8b
KM
95The user's quota of inodes on the file system on
96which the symbolic link is being created has been exhausted.
931b8415 97.It Bq Er EIO
fd690c8b 98An I/O error occurred while making the directory entry or allocating the inode.
931b8415
CL
99.It Bq Er EFAULT
100.Fa Name1
1ea523c5 101or
931b8415 102.Fa name2
1ea523c5 103points outside the process's allocated address space.
931b8415
CL
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 .