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 permission or 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.
Printed 4/6/89 1
LINK(2) COMMAND REFERENCE LINK(2)
[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.
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) and unlink(2).
Printed 4/6/89 2
%%index%%
na:240,85;
sy:325,490;
de:815,656;
di:1471,1520;3303,328;
rv:3631,280;
se:3911,176;
%%index%%000000000117