Blob
1 .TH ACCESS 32 .SH NAME3 access \- determine accessibility of file4 .SH SYNOPSIS5 .B #include <u.h>6 .br7 .B #include <libc.h>8 .PP9 .B10 int access(char *name, int mode)11 .SH DESCRIPTION12 .I Access13 evaluates the given14 file15 .I name16 for accessibility.17 If \fImode\fL&4\fR18 is nonzero,19 read permission is expected;20 if \fImode\fL&2\fR,21 write permission;22 if \fImode\fL&1\fR,23 execute permission.24 If \fImode\fL==0\fR,25 the file merely need exist.26 In any case27 all directories leading to the file28 must permit searches.29 Zero is returned if the desired access is permitted,30 \-1 if not.31 .PP32 Only access for open is checked.33 A file may look executable, but34 .IR exec (3)35 will fail unless it is in proper format.36 .PP37 The include file38 .F <libc.h>39 defines40 .BR AEXIST =0,41 .BR AEXEC =1,42 .BR AWRITE =2,43 and44 .BR AREAD =4.45 .PP46 .SH SOURCE47 .B /usr/local/plan9/src/libc/9sys/access.c48 .SH SEE ALSO49 .IR stat (3)50 .SH DIAGNOSTICS51 Sets52 .IR errstr .53 .SH BUGS54 Since file permissions are checked by the server and group information55 is not known to the client,56 .I access57 must open the file to check permissions.58 (It calls59 .IR stat (3)60 to check simple existence.)