Syntax | #include <unistd.h> int link(const char *path1, const char *path2); | |
Description |
path1 points to a pathname naming an existing file. path2 points to a pathname naming the new directory entry to be created. The If path1 names a directory, Upon successful completion, If the The calling process must have permission to access the existing file.
If The When the value In the flag parameter, the value | |
Return val. | 0 | if successful |
-1 | if an error occurs; | |
Errors |
| |
| Search permission is denied for a component of either path prefix, or the requested link requires writing in a directory with a mode that denies write permission, or the calling process does not have permission to access the existing file. | |
| The link named by path2 exists. | |
Extension | ||
| path1 or path2 points outside the allocated address space. | |
| A signal was caught during the | |
| An attempt was made to access a BS2000 file. | |
| Too many symbolic links were encountered in resolving path1 or path2. (End) | |
| The number of links to the file named by path1 would exceed | |
| ||
The length of path1 or path2 exceeds | ||
| A component of either path prefix does not exist; the file named by path1 does not exist; or path1 or path2 points to an empty string. | |
| The directory to contain the link cannot be extended. | |
| A component of one of the paths is not a directory. | |
| The file named by path1 is a directory, and the process does not have appropriate privileges. | |
| The requested link requires writing in a directory on a read-only file system. | |
| The link named by path2 and the file named by path1 are on different file systems. | |
In addition, | ||
|
| The file descriptor fd1 or fd2 was not opened with |
|
| The path1 parameter does not specify an absolute pathname, and the fd1 parameter does not have the value |
|
| The path1 or path2 parameter does not specify an absolute pathname, and the corresponding file descriptor fd1 / fd2 is not connected with a directory. |
|
| The value of the flag parameter is invalid. |
Notes |
| |
See also |
|