|
|
1.1 root 1: .TH ACCESS 2
2: .CT 2 dirs file_inq_creat secur
3: .SH NAME
4: access \(mi determine accessibility of file
5: .SH SYNOPSIS
6: .nf
7: .B int access(name, mode)
8: .B char *name;
9: .fi
10: .SH DESCRIPTION
11: .I Access
12: checks the given
13: file
14: .I name
15: for accessibility.
16: If \fImode\fL&4\fR
17: is nonzero, read access is checked.
18: If \fImode\fL&2\fR
19: is nonzero, write access is checked.
20: If \fImode\fL&1\fR
21: is nonzero, execute access is checked.
22: If \fImode\fL==\fR0,
23: the file merely need exist.
24: In any case
25: all directories leading to the file
26: must permit searches.
27: 0 is returned if the access is permitted,,
28: \-1 if not.
29: .PP
30: Permission is checked
31: against the real userid and groupid of the process;
32: this call is most useful in set-userid and set-groupid programs.
33: .PP
34: Only access bits are checked.
35: A directory may be announced as writable by
36: .IR access ,
37: but an attempt to open it for writing will fail
38: (although files may be created there);
39: a file may look executable, but
40: .IR exec (2)
41: will fail unless it is in proper format.
42: .PP
43: If the userid of the process is the owner of the file
44: access is determined by the three owner bits (0700).
45: Otherwise, if the groupid of the process is the group
46: of the file access is determined by the three group bits (0070).
47: Otherwise access is determined by the three other bits (0007).
48: .SH SEE ALSO
49: .IR stat (2)
50: .SH DIAGNOSTICS
51: .BR EACCES ,
52: .BR EFAULT ,
53: .BR EIO ,
54: .BR ELOOP ,
55: .BR ENOENT ,
56: .BR ENOTDIR ,
57: .BR EROFS ,
58: .BR ETXTBSY
59: .SH BUGS
60: On symbolic links permissions are irrelevant and
61: .IR access
62: returns nonsense.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.