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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<table class="head">
<tr>
<td class="head-ltitle">VOP_ACCESS(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">VOP_ACCESS(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">VOP_ACCESS</code>,
<code class="Nm">VOP_ACCESSX</code> — <span class="Nd">check access
permissions of a file or Unix domain socket</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/vnode.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">VOP_ACCESS</code>(<var class="Fa" style="white-space: nowrap;">struct
vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">accmode_t
accmode</var>, <var class="Fa" style="white-space: nowrap;">struct ucred
*cred</var>, <var class="Fa" style="white-space: nowrap;">struct thread
*td</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">VOP_ACCESSX</code>(<var class="Fa" style="white-space: nowrap;">struct
vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">accmode_t
accmode</var>, <var class="Fa" style="white-space: nowrap;">struct ucred
*cred</var>, <var class="Fa" style="white-space: nowrap;">struct thread
*td</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This entry point checks the access permissions of the file against
the given credentials.</p>
<p class="Pp">Its arguments are:</p>
<dl class="Bl-tag">
<dt><var class="Fa">vp</var></dt>
<dd>The vnode of the file to check.</dd>
<dt><var class="Fa">accmode</var></dt>
<dd>The type of access required.</dd>
<dt><var class="Fa">cred</var></dt>
<dd>The user credentials to check.</dd>
<dt><var class="Fa">td</var></dt>
<dd>The thread which is checking.</dd>
</dl>
<p class="Pp" id="VOP_ACCESS">The <var class="Fa">accmode</var> is a mask which
can contain flags described in <sys/vnode.h>, e.g.
<code class="Dv">VREAD</code>, <code class="Dv">VWRITE</code> or
<code class="Dv">VEXEC</code>. For
<a class="permalink" href="#VOP_ACCESS"><code class="Fn">VOP_ACCESS</code></a>(),
the only flags that may be set in <var class="Fa">accmode</var> are
<code class="Dv">VEXEC</code>, <code class="Dv">VWRITE</code>,
<code class="Dv">VREAD</code>, <code class="Dv">VADMIN</code> and
<code class="Dv">VAPPEND</code>. To check for other flags, one has to use
<a class="permalink" href="#VOP_ACCESSX"><code class="Fn" id="VOP_ACCESSX">VOP_ACCESSX</code></a>()
instead.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="LOCKS"><a class="permalink" href="#LOCKS">LOCKS</a></h1>
<p class="Pp">The vnode will be locked on entry and should remain locked on
return.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">If the file is accessible in the specified way, then zero is
returned, otherwise an appropriate error code is returned.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<dl class="Bl-tag">
<dt id="EPERM">[<a class="permalink" href="#EPERM"><code class="Er">EPERM</code></a>]</dt>
<dd>An attempt was made to change an immutable file.</dd>
<dt id="EACCES">[<a class="permalink" href="#EACCES"><code class="Er">EACCES</code></a>]</dt>
<dd>The permission bits the file mode or the ACL do not permit the requested
access.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">vaccess(9)</a>,
<a class="Xr">vaccess_acl_nfs4(9)</a>,
<a class="Xr">vaccess_acl_posix1e(9)</a>, <a class="Xr">vnode(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Doug
Rabson</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">September 18, 2009</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|