5479 Need missing *at family manual pages
[illumos-gate.git] / usr / src / man / man2 / symlink.2
blob4bb9b4f5a6b293b3929754dbaafeaade5cf3768a
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SYMLINK 2 "May 18, 2007"
8 .SH NAME
9 symlink \- make a symbolic link to a file
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <unistd.h>
15 \fBint\fR \fBsymlink\fR(\fBconst char *\fR\fIname1\fR, \fBconst char *\fR\fIname2\fR);
16 .fi
17 .LP
18 .nf
19 \fBint\fR \fBsymlinkat\fR(\fBconst char *\fR\fIname1\fR, \fBint\fR \fIfd\fR, \fBconst char *\fR\fIname2\fR);
20 .fi
22 .SH DESCRIPTION
23 .LP
24 The \fBsymlink()\fR function creates a symbolic link \fIname2\fR to the file
25 \fIname1\fR. Either name may be an arbitrary pathname, the files need not be on
26 the same file system, and \fIname1\fR may be nonexistent.
27 .sp
28 .LP
29 The file to which the symbolic link points is used when an \fBopen\fR(2)
30 operation is performed on the link. A \fBstat()\fR operation performed on a
31 symbolic link returns the linked-to file, while an \fBlstat()\fR operation
32 returns information about the link itself.  See \fBstat\fR(2). Unexpected
33 results may occur when a symbolic link is made to a directory. To avoid
34 confusion in applications, the \fBreadlink\fR(2) call can be used to read the
35 contents of a symbolic link.
36 .sp
37 .LP
38 The \fBsymlinkat()\fR function behaves similarly to \fBsymlink()\fR; however,
39 when \fIpath2\fR is a relative path, then it will be looked up relative to the
40 directory specified by the file descriptor \fIfd\fR. To look up something in the
41 current working directory, the special value \fBAT_FDCWD\fR may be passed into
42 \fIfd\fR.
43 .SH RETURN VALUES
44 .LP
45 Upon successful completion, \fB0\fR is returned.  Otherwise, \fB\(mi1\fR is
46 returned, \fBerrno\fR is set to indicate the error, and the symbolic link is
47 not made.
48 .SH ERRORS
49 .LP
50 The \fBsymlink()\fR and \fBsymlinkat()\fR functions will fail if:
51 .sp
52 .ne 2
53 .na
54 \fB\fBEACCES\fR\fR
55 .ad
56 .RS 16n
57 Search permission is denied for a component of the path prefix of \fIname2\fR.
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fBEDQUOT\fR\fR
64 .ad
65 .RS 16n
66 The directory where the entry for the new symbolic link is being placed cannot
67 be extended because the user's quota of disk blocks on that file system has
68 been exhausted; the new symbolic link cannot be created because the user's
69 quota of disk blocks on that file system has been exhausted; or the user's
70 quota of inodes on the file system where the file is being created has been
71 exhausted.
72 .RE
74 .sp
75 .ne 2
76 .na
77 \fB\fBEEXIST\fR\fR
78 .ad
79 .RS 16n
80 The file referred to by \fIname2\fR already exists.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fB\fBEFAULT\fR\fR
87 .ad
88 .RS 16n
89 The \fIname1\fR or \fIname2\fR argument points to an illegal address.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fBEILSEQ\fR\fR
96 .ad
97 .RS 16n
98 The path argument includes non-UTF8 characters and the file system accepts only
99 file names where all characters are part of the UTF-8 character codeset.
103 .ne 2
105 \fB\fBEIO\fR\fR
107 .RS 16n
108 An I/O error occurs while reading from or writing to the file system.
112 .ne 2
114 \fB\fBELOOP\fR\fR
116 .RS 16n
117 Too many symbolic links are encountered in translating \fIname2\fR.
121 .ne 2
123 \fB\fBENAMETOOLONG\fR\fR
125 .RS 16n
126 The length of the \fIname2\fR argument exceeds \fBPATH_MAX\fR, or the length of
127 a \fIname2\fR component exceeds \fBNAME_MAX\fR while \fB_POSIX_NO_TRUNC\fR is
128 in effect.
132 .ne 2
134 \fB\fBENOENT\fR\fR
136 .RS 16n
137 A component of the path prefix of \fIname2\fR does not exist.
141 .ne 2
143 \fB\fBENOSPC\fR\fR
145 .RS 16n
146 The directory in which the entry for the new symbolic link is being placed
147 cannot be extended because no space is left on the file system containing the
148 directory; the new symbolic link cannot be created because no space is left on
149 the file system which will contain the link; or there are no free inodes on the
150 file system on which the file is being created.
154 .ne 2
156 \fB\fBENOSYS\fR\fR
158 .RS 16n
159 The file system does not support symbolic links.
163 .ne 2
165 \fB\fBENOTDIR\fR\fR
167 .RS 16n
168 A component of the path prefix of \fIname2\fR is not a directory. For
169 \fBsymlinkat()\fR, if \fIpath2\fR refers to a relative path and \fIfd\fR is a
170 valid file descriptor that is not a directory.
174 .ne 2
176 \fB\fBEROFS\fR\fR
178 .RS 16n
179 The file \fIname2\fR would reside on a read-only file system.
184 The \fBsymlinkat()\fR function will fail if:
186 .ne 2
188 .B EBADF
190 .RS 16n
191 The \fIpath2\fR argument is a relative path, and \fIfd\fR is not a valid, open
192 file descriptor or the special value \fBAT_FDCWD\fR.
195 .SH ATTRIBUTES
197 See \fBattributes\fR(5) for descriptions of the following attributes:
202 box;
203 c | c
204 l | l .
205 ATTRIBUTE TYPE  ATTRIBUTE VALUE
207 Interface Stability     Standard
210 .SH SEE ALSO
212 \fBcp\fR(1), \fBlink\fR(2), \fBopen\fR(2), \fBreadlink\fR(2), \fBstat\fR(2),
213 \fBunlink\fR(2), \fBattributes\fR(5)