link(2)
NAME
link − link to a file
SYNTAX
int link(name1, name2)
char *name1, *name2;
DESCRIPTION
The link system call creates a new link with name2 to an existing file name1. Either name1 or name2 may be an arbitrary path name.
RETURN VALUE
If unsuccessful, returns a −1, and the global variable errno indicates the error code.
DIAGNOSTICS
The link call will fail if:
[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 permission.
[EEXIST] A file by the same name already exists.
[EFAULT] One of the path names specified is outside the allocated address space of the process.
[EMLINK] Maximum number of links to a file would be exceeded.
[ENFILE] There is insufficient system space to contain the inode.
[ENOENT] A path prefix component does not exist.
[ENOENT] The file name1 does not exist.
[ENOSPC] The directory to contain the file cannot be extended.
[ENOTDIR] A path prefix component is not a directory.
[EPERM] The file named by name1 is a directory, and the effective user ID is not the superuser.
[EROFS] The requested link requires writing in a directory on a read-only file system.
[EXDEV] The link named by name2 and the file named by name1 are on different file systems.
[E2BIG] The argument count exceeded ncargs.
SEE ALSO
ASSEMBLER
(link = 9.)
sys link; name1; name2