60 lines · 1.1 KB · Text
RawDownload
.TH ACCESS 2.SH NAMEaccess \- determine accessibility of file.SH SYNOPSIS.B #include <u.h>.br.B #include <libc.h>.PP.Bint access(char *name, int mode).SH DESCRIPTION.I Accessevaluates the givenfile.I namefor accessibility.If \fImode\fL&4\fRis 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 caseall directories leading to the filemust permit searches.Zero is returned if the desired access is permitted,\-1 if not..PPOnly access for open is checked.A file may look executable, but.IR exec (2)will fail unless it is in proper format..PPThe include file.F <libc.h>defines.BR AEXIST =0,.BR AEXEC =1,.BR AWRITE =2,and.BR AREAD =4..PP.SH SOURCE.B /sys/src/libc/9sys/access.c.SH SEE ALSO.IR stat (2).SH DIAGNOSTICSSets.IR errstr ..SH BUGSSince file permissions are checked by the server and group informationis not known to the client,.I accessmust open the file to check permissions.(It calls.IR stat (2)to check simple existence.)