LINK(2) COMMAND REFERENCE LINK(2)
NAME
link - make a hard link to a file
SYNOPSIS
link(path1, path2)
char *path1, *path2;
DESCRIPTION
Path1 names an existing file. Path2 names a new directory
entry to be created. Link creates a new link (directory
entry) for the existing file, named path2.
With hard links, both path1 and path2 must be in the same
file system. Unless the caller is the super-user, path1
must not be a directory. Both path1 and path2 share equal
access and rights to the underlying object.
DIAGNOSTICS
Link will fail and no link will be created if one or more of
the following are true:
[ENOASCII]
Either pathname contains a byte with the high-order bit
set.
[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.
[ENAMETOOLONG]
Either pathname is too long.
[ENOTDIR]
A component of either path prefix is not a directory.
[ENOENT]
The file named by path1 does not exist.
[EEXIST]
The link named by path2 does exist.
[EPERM]
The file named by path1 is a directory and the effective
user ID is not super-user.
[EXDEV]
The link named by path2 and the file named by path1 are
on different file systems.
[EACCES]
A component of either path prefix denies search
Printed 10/17/86 1
LINK(2) COMMAND REFERENCE LINK(2)
permission or the requested link requires writing in a
directory with a mode that denies write permission. If
the file is located on a remote host, this error code
will be returned if the local host name and local user
name does not appear in /usr/lib/dfs/access on the
remote machine. See access(dfs)(5n).
[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.
[ELOOP]
Too many symbolic links were encountered in translating
a pathname.
[EIO]
An I/O error occurred while writing to the file system.
[EDFSREF]
Both path1 and path2 must reference files on the same
host or this error will be returned.
[EDFSNOSUCHHOST]
The pathname referenced a remote host, but when we
broadcast a request for its address, no host responded.
RETURN VALUE
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
indicate the error.
SEE ALSO
symlink(2), unlink(2).
Printed 10/17/86 2
%%index%%
na:72,69;
sy:141,318;
de:459,596;
di:1055,1111;2310,1101;
rv:3411,236;
se:3647,124;
%%index%%000000000117