Files
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

140 lines
3.1 KiB
Groff

.\" @(#)symlink.2 1.1 94/10/31 SMI; from UCB 4.2
.TH SYMLINK 2 "21 January 1990"
.SH NAME
symlink \- make symbolic link to a file
.SH SYNOPSIS
.nf
.ft B
int symlink(name1, name2)
char *name1, *name2;
.ft R
.fi
.IX symlink() "" \fLsymlink()\fP
.IX "file system" symlink() "" \fLsymlink()\fP
.IX "create" "symbolic link \(em \fLsymlink()\fR"
.IX "symbolic link" create
.IX link "make symbolic"
.SH DESCRIPTION
.LP
A symbolic link
.I name2
is created to
.I name1
.RI ( name2
is the name of the file created,
.I name1
is the string
used in creating the symbolic link).
Either name may be an arbitrary path name; the files need not
be on the same file system.
.LP
The file that the symbolic link points to is
used when an
.BR open (2V)
operation is performed on the link. A
.BR stat (2V),
on a symbolic link returns the linked-to file, while an
.B lstat(\|)
(refer to
.BR stat (2V))
returns information about the link itself. This can lead to
surprising
results when a symbolic link is made to a directory.
To avoid confusion in programs, the
.BR readlink (2)
call can be used to read the contents of a symbolic link.
.SH RETURN VALUES
.LP
.B symlink(\|)
returns:
.TP
0
on success.
.TP
\-1
on failure and sets
.B errno
to indicate the error.
.SH ERRORS
.LP
The symbolic link is made unless one or more of the following are true:
.TP 20
.SM EACCES
Search permission is denied for a component of the path prefix of
.IR name2 .
.TP
.SM EDQUOT
The directory in which the entry for the new symbolic
link is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
.IP
The new symbolic link cannot be created because the
user's quota of disk blocks on the file system which
will contain the link has been exhausted.
.IP
The user's quota of inodes on the file system on
which the file is being created has been exhausted.
.TP
.SM EEXIST
The file referred to by
.I name2
already exists.
.TP
.SM EFAULT
.I name1
or
.I name2
points outside the process's allocated address space.
.TP
.SM EIO
An I/O error occurred while reading from or writing to the file system.
.TP
.SM ELOOP
Too many symbolic links were encountered in translating
.IR name2 .
.TP
.SM ENAMETOOLONG
The length of the path argument exceeds
.SM {PATH_MAX}\s0.
.IP
A pathname component is longer than
.SM {NAME_MAX}
(see
.BR sysconf (2V))
while
.SM {_POSIX_NO_TRUNC}
is in effect
(see
.BR pathconf (2V)).
.TP
.SM ENOENT
A component of the path prefix of
.I name2
does not exist.
.TP
.SM ENOSPC
The directory in which the entry for the new symbolic link is being placed
cannot be extended because there is no space left on the file system
containing the directory.
.IP
The new symbolic link cannot be created because there
is no space left on the file system which will contain the link.
.IP
There are no free inodes on the file system on which the file is being created.
.TP
.SM ENOTDIR
A component of the path prefix of
.I name2
is not a directory.
.TP
.SM EROFS
The file
.I name2
would reside on a read-only file system.
.SH "SEE ALSO"
.BR ln (1V),
.BR link (2V),
.BR readlink (2),
.BR unlink (2V)