BSD 4_3_Tahoe development
[unix-history] / usr / man / cat2 / link.0
LINK(2) UNIX Programmer's Manual LINK(2)
N\bNA\bAM\bME\bE
link - make a hard link to a file
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
l\bli\bin\bnk\bk(\b(n\bna\bam\bme\be1\b1,\b, n\bna\bam\bme\be2\b2)\b)
c\bch\bha\bar\br *\b*n\bna\bam\bme\be1\b1,\b, *\b*n\bna\bam\bme\be2\b2;\b;
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
A hard link to _\bn_\ba_\bm_\be_\b1 is created; the link has the name
_\bn_\ba_\bm_\be_\b2. _\bN_\ba_\bm_\be_\b1 must exist.
With hard links, both _\bn_\ba_\bm_\be_\b1 and _\bn_\ba_\bm_\be_\b2 must be in the same
file system. Unless the caller is the super-user, _\bn_\ba_\bm_\be_\b1
must not be a directory. Both the old and the new _\bl_\bi_\bn_\bk
share equal access and rights to the underlying object.
R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bE
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and _\be_\br_\br_\bn_\bo is set to indi-
cate the error.
E\bER\bRR\bRO\bOR\bRS\bS
_\bL_\bi_\bn_\bk will fail and no link will be created if one or more of
the following are true:
[ENOTDIR] A component of either path prefix is not a
directory.
[EINVAL] Either pathname contains a character with the
high-order bit set.
[ENAMETOOLONG] A component of either pathname exceeded 255
characters, or entire length of either path
name exceeded 1023 characters.
[ENOENT] A component of either path prefix does not
exist.
[EACCES] A component of either path prefix denies
search permission.
[EACCES] The requested link requires writing in a
directory with a mode that denies write per-
mission.
[ELOOP] Too many symbolic links were encountered in
translating one of the pathnames.
[ENOENT] The file named by _\bn_\ba_\bm_\be_\b1 does not exist.
[EEXIST] The link named by _\bn_\ba_\bm_\be_\b2 does exist.
Printed 7/9/88 August 26, 1985 1
LINK(2) UNIX Programmer's Manual LINK(2)
[EPERM] The file named by _\bn_\ba_\bm_\be_\b1 is a directory and
the effective user ID is not super-user.
[EXDEV] The link named by _\bn_\ba_\bm_\be_\b2 and the file named by
_\bn_\ba_\bm_\be_\b1 are on different file systems.
[ENOSPC] The directory in which the entry for the new
link is being placed cannot be extended
because there is no space left on the file
system containing the directory.
[EDQUOT] The directory in which the entry for the new
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.
[EIO] An I/O error occurred while reading from or
writing to the file system to make the direc-
tory entry.
[EROFS] The requested link requires writing in a
directory on a read-only file system.
[EFAULT] One of the pathnames specified is outside the
process's allocated address space.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
symlink(2), unlink(2)
Printed 7/9/88 August 26, 1985 2