LINK(2-POSIX) RISC/os Reference Manual LINK(2-POSIX)
NAME
link - link to a file
SYNOPSIS
int link (existing, new)
char *existing, *new;
DESCRIPTION
existing points to a path name naming an existing file. new
points to a path name naming the new directory entry to be
created. link creates a new link (directory entry) for the
existing file.
The existing argument must not name a directory unless the
user has appropriate privileges.
Upon successful completion, link marks for update the
st_ctime field of the file. Also, the st_ctime and st_mtime
fields of the directory that contains the new entry are
marked for update.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
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] Either existing or new points to a null
path name or a component of either path
prefix does not exist or the file named
by existing does not exist.
[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, or
the calling process does not have per-
mission to access the existing file.
[EEXIST] The link named by new exists.
[EPERM] The file named by existing is a direc-
tory and the effective user ID is not
super-user.
[EXDEV] The link named by new and the file named
Printed 1/15/91 Page 1
LINK(2-POSIX) RISC/os Reference Manual LINK(2-POSIX)
by existing are on different logical
devices (file systems).
[EROFS] The requested link requires writing in a
directory on a read-only file system.
[EFAULT] Either existing or new points outside
the allocated address space of the pro-
cess.
[EMLINK] The maximum number of links to a file
would be exceeded.
[EINTR] A signal was caught during the link sys-
tem call.
[ENAMETOOLONG] The length of existing or new exceeds
{PATH_MAX}, or a pathname component is
longer than {NAME_MAX} while
{_POSIX_NO_TRUNC} is in effect.
[ENOSPC] The directory that would contain the
link cannot be extended.
SEE ALSO
unlink(2).
Page 2 Printed 1/15/91