LINK(2) SysV LINK(2)
NAME
link - link to a file
SYNOPSIS
int link (path1, path2)
char *path1, *path2;
DESCRIPTION
link creates a link (directory entry) to the file to which path1 points
and gives it the name pointed to by path2. The file to which path1
points must exist.
ERRORS
link 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.
[ENOENT] A component of either path prefix does not exist.
[EACCES] A component of either path prefix denies search
permission.
[ENOENT] The file named by path1 does not exist.
[EEXIST] The link named by path2 exists.
[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 logical devices (file systems).
[ENOENT] path2 points to a null pathname.
[EACCES] The requested link requires writing in a directory with a
mode that denies write permission.
[EROFS] The requested link requires writing in a directory on a
read-only file system.
[EFAULT] path points outside the allocated address space of the
process.
[EMLINK] The maximum number of links to a file would be exceeded.
[EINTR] A signal was caught during the link system call.
[ENOLINK] path points to a remote machine and the link to that
machine is no longer active.
[EMULTIHOP] Components of path require hopping to multiple remote
machines.
SEE ALSO
unlink(2).
DIAGNOSTICS
A successful call returns 0. A failed call returns -1 and sets errno.