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"
9 symlink \- make a symbolic link to a file
15 \fBint\fR \fBsymlink\fR(\fBconst char *\fR\fIname1\fR, \fBconst char *\fR\fIname2\fR);
19 \fBint\fR \fBsymlinkat\fR(\fBconst char *\fR\fIname1\fR, \fBint\fR \fIfd\fR, \fBconst char *\fR\fIname2\fR);
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.
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.
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
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
50 The \fBsymlink()\fR and \fBsymlinkat()\fR functions will fail if:
57 Search permission is denied for a component of the path prefix of \fIname2\fR.
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
80 The file referred to by \fIname2\fR already exists.
89 The \fIname1\fR or \fIname2\fR argument points to an illegal address.
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.
108 An I/O error occurs while reading from or writing to the file system.
117 Too many symbolic links are encountered in translating \fIname2\fR.
123 \fB\fBENAMETOOLONG\fR\fR
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
137 A component of the path prefix of \fIname2\fR does not exist.
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.
159 The file system does not support symbolic links.
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.
179 The file \fIname2\fR would reside on a read-only file system.
184 The \fBsymlinkat()\fR function will fail if:
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.
197 See \fBattributes\fR(5) for descriptions of the following attributes:
205 ATTRIBUTE TYPE ATTRIBUTE VALUE
207 Interface Stability Standard
212 \fBcp\fR(1), \fBlink\fR(2), \fBopen\fR(2), \fBreadlink\fR(2), \fBstat\fR(2),
213 \fBunlink\fR(2), \fBattributes\fR(5)