Commit | Line | Data |
---|---|---|
dd547749 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
fd690c8b | 5 | .\" @(#)link.2 6.3 (Berkeley) %G% |
dd547749 | 6 | .\" |
7b9d67d2 | 7 | .TH LINK 2 "" |
dd547749 KM |
8 | .UC 4 |
9 | .SH NAME | |
9142a5ba | 10 | link \- make a hard link to a file |
dd547749 KM |
11 | .SH SYNOPSIS |
12 | .nf | |
9142a5ba KM |
13 | .ft B |
14 | link(name1, name2) | |
15 | char *name1, *name2; | |
dd547749 | 16 | .fi |
9142a5ba | 17 | .ft R |
dd547749 | 18 | .SH DESCRIPTION |
9142a5ba | 19 | A hard link |
dd547749 KM |
20 | to |
21 | .I name1 | |
22 | is created; | |
23 | the link has the name | |
24 | .IR name2 . | |
9142a5ba KM |
25 | .I Name1 |
26 | must exist. | |
27 | .PP | |
28 | With hard links, | |
29 | both | |
dd547749 | 30 | .I name1 |
9142a5ba | 31 | and |
dd547749 | 32 | .I name2 |
9142a5ba KM |
33 | must be in the same file system. |
34 | Unless the caller is the super-user, | |
35 | .I name1 | |
36 | must not be a directory. | |
37 | Both the old and the new | |
38 | .I link | |
39 | share equal access and rights to | |
40 | the underlying object. | |
41 | .SH "RETURN VALUE | |
42 | Upon successful completion, a value of 0 is returned. Otherwise, | |
43 | a value of \-1 is returned and | |
44 | .I errno | |
45 | is set to indicate the error. | |
46 | .SH "ERRORS | |
47 | .I Link | |
48 | will fail and no link will be created if one or more of the following | |
49 | are true: | |
50 | .TP 15 | |
9142a5ba KM |
51 | [ENOTDIR] |
52 | A component of either path prefix is not a directory. | |
53 | .TP 15 | |
b5984ffe KM |
54 | [EINVAL] |
55 | Either pathname contains a character with the high-order bit set. | |
56 | .TP 15 | |
57 | [ENAMETOOLONG] | |
58 | A component of either pathname exceeded 255 characters, | |
59 | or entire length of either path name exceeded 1023 characters. | |
60 | .TP 15 | |
9142a5ba KM |
61 | [ENOENT] |
62 | A component of either path prefix does not exist. | |
63 | .TP 15 | |
64 | [EACCES] | |
65 | A component of either path prefix denies search permission. | |
66 | .TP 15 | |
b5984ffe KM |
67 | [EACCES] |
68 | The requested link requires writing in a directory with a mode | |
69 | that denies write permission. | |
70 | .TP 15 | |
71 | [ELOOP] | |
72 | Too many symbolic links were encountered in translating one of the pathnames. | |
73 | .TP 15 | |
9142a5ba KM |
74 | [ENOENT] |
75 | The file named by \fIname1\fP does not exist. | |
76 | .TP 15 | |
77 | [EEXIST] | |
78 | The link named by \fIname2\fP does exist. | |
79 | .TP 15 | |
80 | [EPERM] | |
81 | The file named by \fIname1\fP is a directory and the effective | |
82 | user ID is not super-user. | |
83 | .TP 15 | |
84 | [EXDEV] | |
85 | The link named by \fIname2\fP and the file named by \fIname1\fP | |
86 | are on different file systems. | |
87 | .TP 15 | |
fd690c8b KM |
88 | [ENOSPC] |
89 | The directory in which the entry for the new link is being placed | |
90 | cannot be extended because there is no space left on the file | |
91 | system containing the directory. | |
92 | .TP 15 | |
93 | [EDQUOT] | |
94 | The directory in which the entry for the new link | |
95 | is being placed cannot be extended because the | |
96 | user's quota of disk blocks on the file system | |
97 | containing the directory has been exhausted. | |
98 | .TP 15 | |
b5984ffe | 99 | [EIO] |
fd690c8b KM |
100 | An I/O error occurred while reading from or writing to |
101 | the file system to make the directory entry. | |
9142a5ba KM |
102 | .TP 15 |
103 | [EROFS] | |
104 | The requested link requires writing in a directory on a read-only file | |
105 | system. | |
106 | .TP 15 | |
107 | [EFAULT] | |
108 | One of the pathnames specified | |
109 | is outside the process's allocated address space. | |
9142a5ba KM |
110 | .SH "SEE ALSO" |
111 | symlink(2), unlink(2) |