aboutsummaryrefslogtreecommitdiff
path: root/man/man3/access.3
blob: d98d88a5e17ac05644baaadfc4a935ad5b483995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.TH ACCESS 3
.SH NAME
access \- determine accessibility of file
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
int access(char *name, int mode)
.SH DESCRIPTION
.I Access
evaluates the given
file
.I name
for accessibility.
If \fImode\fL&4\fR
is nonzero,
read permission is expected;
if \fImode\fL&2\fR,
write permission;
if \fImode\fL&1\fR,
execute permission.
If \fImode\fL==0\fR,
the file merely need exist.
In any case
all directories leading to the file
must permit searches.
Zero is returned if the desired access is permitted,
\-1 if not.
.PP
Only access for open is checked.
A file may look executable, but
.IR exec (3)
will fail unless it is in proper format.
.PP
The include file
.F <libc.h>
defines
.BR AEXIST =0,
.BR AEXEC =1,
.BR AWRITE =2,
and
.BR AREAD =4.
.PP
.SH SOURCE
.B /usr/local/plan9/src/libc/9sys/access.c
.SH SEE ALSO
.IR stat (3)
.SH DIAGNOSTICS
Sets
.IR errstr .
.SH BUGS
Since file permissions are checked by the server and group information
is not known to the client,
.I access
must open the file to check permissions.
(It calls
.IR stat (3)
to check simple existence.)