xref: /freebsd/share/man/man9/VOP_ACCESS.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1fab63cc4SDoug Rabson.\" -*- nroff -*-
2fab63cc4SDoug Rabson.\" -*- nroff -*-
3fab63cc4SDoug Rabson.\"
4fab63cc4SDoug Rabson.\" Copyright (c) 1996 Doug Rabson
5fab63cc4SDoug Rabson.\"
6fab63cc4SDoug Rabson.\" All rights reserved.
7fab63cc4SDoug Rabson.\"
8fab63cc4SDoug Rabson.\" This program is free software.
9fab63cc4SDoug Rabson.\"
10fab63cc4SDoug Rabson.\" Redistribution and use in source and binary forms, with or without
11fab63cc4SDoug Rabson.\" modification, are permitted provided that the following conditions
12fab63cc4SDoug Rabson.\" are met:
13fab63cc4SDoug Rabson.\" 1. Redistributions of source code must retain the above copyright
14fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer.
15fab63cc4SDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright
16fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer in the
17fab63cc4SDoug Rabson.\"    documentation and/or other materials provided with the distribution.
18fab63cc4SDoug Rabson.\"
19fab63cc4SDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
20fab63cc4SDoug Rabson.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21fab63cc4SDoug Rabson.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22fab63cc4SDoug Rabson.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
23fab63cc4SDoug Rabson.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24fab63cc4SDoug Rabson.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25fab63cc4SDoug Rabson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26fab63cc4SDoug Rabson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27fab63cc4SDoug Rabson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28fab63cc4SDoug Rabson.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29fab63cc4SDoug Rabson.\"
30a9315ddeSEdward Tomasz Napierala.Dd September 18, 2009
31fab63cc4SDoug Rabson.Dt VOP_ACCESS 9
32*aa12cea2SUlrich Spörlein.Os
33fab63cc4SDoug Rabson.Sh NAME
34c97fcdbaSEdward Tomasz Napierala.Nm VOP_ACCESS ,
35c97fcdbaSEdward Tomasz Napierala.Nm VOP_ACCESSX
36f167d7fbSSheldon Hearn.Nd "check access permissions of a file or Unix domain socket"
37fab63cc4SDoug Rabson.Sh SYNOPSIS
3832eef9aeSRuslan Ermilov.In sys/param.h
3932eef9aeSRuslan Ermilov.In sys/vnode.h
40fab63cc4SDoug Rabson.Ft int
4115bc6b2bSEdward Tomasz Napierala.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
42c97fcdbaSEdward Tomasz Napierala.Ft int
43c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
44fab63cc4SDoug Rabson.Sh DESCRIPTION
45fab63cc4SDoug RabsonThis entry point checks the access permissions of the file against the
46fab63cc4SDoug Rabsongiven credentials.
47fab63cc4SDoug Rabson.Pp
48fab63cc4SDoug RabsonIts arguments are:
4915bc6b2bSEdward Tomasz Napierala.Bl -tag -width accmode
500640e9e0SHiten Pandya.It Fa vp
510a57ea7dSRuslan ErmilovThe vnode of the file to check.
5215bc6b2bSEdward Tomasz Napierala.It Fa accmode
530a57ea7dSRuslan ErmilovThe type of access required.
540640e9e0SHiten Pandya.It Fa cred
550a57ea7dSRuslan ErmilovThe user credentials to check.
560640e9e0SHiten Pandya.It Fa td
570a57ea7dSRuslan ErmilovThe thread which is checking.
58fab63cc4SDoug Rabson.El
59fab63cc4SDoug Rabson.Pp
60fab63cc4SDoug RabsonThe
6115bc6b2bSEdward Tomasz Napierala.Fa accmode
6215bc6b2bSEdward Tomasz Napieralais a mask which can contain flags described in <sys/vnode.h>, e.g.
63fab63cc4SDoug Rabson.Dv VREAD ,
64d0353b83SRuslan Ermilov.Dv VWRITE
65d0353b83SRuslan Ermilovor
66fab63cc4SDoug Rabson.Dv VEXEC .
67c97fcdbaSEdward Tomasz NapieralaFor
68c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESS ,
69c97fcdbaSEdward Tomasz Napieralathe only flags that may be set in
70c97fcdbaSEdward Tomasz Napierala.Fa accmode
71c97fcdbaSEdward Tomasz Napieralaare
72c97fcdbaSEdward Tomasz Napierala.Dv VEXEC ,
73c97fcdbaSEdward Tomasz Napierala.Dv VWRITE ,
74c97fcdbaSEdward Tomasz Napierala.Dv VREAD ,
75c97fcdbaSEdward Tomasz Napierala.Dv VADMIN
76c97fcdbaSEdward Tomasz Napieralaand
77c97fcdbaSEdward Tomasz Napierala.Dv VAPPEND .
78f0fa0e7fSEdward Tomasz NapieralaTo check for other flags, one has to use
79c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESSX
80c97fcdbaSEdward Tomasz Napieralainstead.
81fab63cc4SDoug Rabson.Sh LOCKS
82fb3fd476SMatthew DillonThe vnode will be locked on entry and should remain locked on return.
83fab63cc4SDoug Rabson.Sh RETURN VALUES
843a9c9c6eSMike PritchardIf the file is accessible in the specified way, then zero is returned,
85fab63cc4SDoug Rabsonotherwise an appropriate error code is returned.
86fab63cc4SDoug Rabson.Sh ERRORS
87eaa8b244SMike Pritchard.Bl -tag -width Er
88fab63cc4SDoug Rabson.It Bq Er EPERM
89cc258457SDon LewisAn attempt was made to change an immutable file.
90fab63cc4SDoug Rabson.It Bq Er EACCES
9181f8d226SDon LewisThe permission bits the file mode or the ACL do not permit the
9281f8d226SDon Lewisrequested access.
93fab63cc4SDoug Rabson.El
94fab63cc4SDoug Rabson.Sh SEE ALSO
9512f96c9bSChris Costello.Xr vaccess 9 ,
96a9315ddeSEdward Tomasz Napierala.Xr vaccess_acl_nfs4 9 ,
9712f96c9bSChris Costello.Xr vaccess_acl_posix1e 9 ,
98fab63cc4SDoug Rabson.Xr vnode 9
99fab63cc4SDoug Rabson.Sh AUTHORS
100571dba6eSHiten PandyaThis manual page was written by
101aaf1f16eSPhilippe Charnier.An Doug Rabson .
102