Commit | Line | Data |
---|---|---|
e6817382 BJ |
1 | .TH ACCESS 2 |
2 | .SH NAME | |
3 | access \- determine accessibility of file | |
4 | .SH SYNOPSIS | |
5 | .B access(name, mode) | |
6 | .br | |
7 | .B char *name; | |
8 | .SH DESCRIPTION | |
9 | .I Access | |
10 | checks the given | |
11 | file | |
12 | .I name | |
13 | for accessibility according to | |
14 | .I mode, | |
15 | which is 4 (read), 2 (write) or 1 (execute) or a combination thereof. | |
16 | Specifying mode 0 | |
17 | tests whether the directories leading to the file can be | |
18 | searched and the file exists. | |
19 | .PP | |
20 | An appropriate error indication is returned if | |
21 | .I name | |
22 | cannot be found or if any | |
23 | of the desired access modes would not be granted. | |
24 | On disallowed accesses | |
25 | \-1 is returned and the error code is in | |
26 | .IR errno . | |
27 | 0 is returned from successful tests. | |
28 | .PP | |
29 | The user and group IDs with respect to which permission is checked | |
30 | are the real UID and GID of the process, so this call is | |
31 | useful to set-UID programs. | |
32 | .PP | |
33 | Notice that it is only access bits that are checked. | |
34 | A directory may be announced as writable by | |
35 | .I access, | |
36 | but an attempt to open it for writing will fail | |
37 | (although files may be created there); | |
38 | a file may look executable, but | |
39 | .I exec | |
40 | will fail unless it is in proper format. | |
41 | .PP | |
42 | .SH SEE ALSO | |
43 | stat(2) | |
44 | .SH "ASSEMBLER (PDP-11)" | |
45 | (access = 33.) | |
46 | .br | |
47 | .B sys access; name; mode |