link to a file
cc ... -lc
int link (path, newpath)
char *path, *newpath;
The path argument points to a path name
naming an existing file.
The newpath argument points to a
path name naming the new directory entry to be created.
The link system call
creates a new link (directory entry) for the existing file.
Upon successful completion, link marks for update the
``st_ctime'' and ``st_mtime'' fields of the parent directory.
Also, the ``st_ctime'' and ``st_mtime''
fields of the file are marked for update.
The link system call fails and no link is created
if one or more of the following is true:
1. A component of either path prefix
denies search permission.
2. The requested link requires writing in a directory
with a mode that denies write permission.
The link named by newpath exists.
path points outside the allocated address space of the process.
A signal was caught during the link system call.
The maximum number of links to a file would be exceeded.
Components of path require hopping to multiple remote machines.
1. A component of either path prefix does not exist.
2. The file named by path does not exist.
3. newpath points to a null path name.
path points to a remote machine and the link
to that machine is no longer active.
The directory containing the link cannot be extended.
A component of either path prefix is not a directory.
The file named by path is a directory
and the effective user ID is not super user.
The requested link requires writing in a directory on a read-only file system.
The link named by newpath
and the file named by path
are on different logical devices (file systems).
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned, and
errno is set to indicate the error.
link is conformant with:
X/Open Portability Guide, Issue 3, 1989
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
NIST FIPS 151-1
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003