xref: /freebsd/share/man/man9/VOP_ACCESS.9 (revision f0fa0e7faa9a2c67d9bcbb90c78f3029047b3682)
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.\"
307f3dea24SPeter Wemm.\" $FreeBSD$
31fab63cc4SDoug Rabson.\"
32f0fa0e7fSEdward Tomasz Napierala.Dd June 1, 2009
33fab63cc4SDoug Rabson.Os
34fab63cc4SDoug Rabson.Dt VOP_ACCESS 9
35fab63cc4SDoug Rabson.Sh NAME
36c97fcdbaSEdward Tomasz Napierala.Nm VOP_ACCESS ,
37c97fcdbaSEdward Tomasz Napierala.Nm VOP_ACCESSX
38f167d7fbSSheldon Hearn.Nd "check access permissions of a file or Unix domain socket"
39fab63cc4SDoug Rabson.Sh SYNOPSIS
4032eef9aeSRuslan Ermilov.In sys/param.h
4132eef9aeSRuslan Ermilov.In sys/vnode.h
42fab63cc4SDoug Rabson.Ft int
4315bc6b2bSEdward Tomasz Napierala.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
44c97fcdbaSEdward Tomasz Napierala.Ft int
45c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
46fab63cc4SDoug Rabson.Sh DESCRIPTION
47fab63cc4SDoug RabsonThis entry point checks the access permissions of the file against the
48fab63cc4SDoug Rabsongiven credentials.
49fab63cc4SDoug Rabson.Pp
50fab63cc4SDoug RabsonIts arguments are:
5115bc6b2bSEdward Tomasz Napierala.Bl -tag -width accmode
520640e9e0SHiten Pandya.It Fa vp
530a57ea7dSRuslan ErmilovThe vnode of the file to check.
5415bc6b2bSEdward Tomasz Napierala.It Fa accmode
550a57ea7dSRuslan ErmilovThe type of access required.
560640e9e0SHiten Pandya.It Fa cred
570a57ea7dSRuslan ErmilovThe user credentials to check.
580640e9e0SHiten Pandya.It Fa td
590a57ea7dSRuslan ErmilovThe thread which is checking.
60fab63cc4SDoug Rabson.El
61fab63cc4SDoug Rabson.Pp
62fab63cc4SDoug RabsonThe
6315bc6b2bSEdward Tomasz Napierala.Fa accmode
6415bc6b2bSEdward Tomasz Napieralais a mask which can contain flags described in <sys/vnode.h>, e.g.
65fab63cc4SDoug Rabson.Dv VREAD ,
66d0353b83SRuslan Ermilov.Dv VWRITE
67d0353b83SRuslan Ermilovor
68fab63cc4SDoug Rabson.Dv VEXEC .
69c97fcdbaSEdward Tomasz NapieralaFor
70c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESS ,
71c97fcdbaSEdward Tomasz Napieralathe only flags that may be set in
72c97fcdbaSEdward Tomasz Napierala.Fa accmode
73c97fcdbaSEdward Tomasz Napieralaare
74c97fcdbaSEdward Tomasz Napierala.Dv VEXEC ,
75c97fcdbaSEdward Tomasz Napierala.Dv VWRITE ,
76c97fcdbaSEdward Tomasz Napierala.Dv VREAD ,
77c97fcdbaSEdward Tomasz Napierala.Dv VADMIN
78c97fcdbaSEdward Tomasz Napieralaand
79c97fcdbaSEdward Tomasz Napierala.Dv VAPPEND .
80f0fa0e7fSEdward Tomasz NapieralaTo check for other flags, one has to use
81c97fcdbaSEdward Tomasz Napierala.Fn VOP_ACCESSX
82c97fcdbaSEdward Tomasz Napieralainstead.
83fab63cc4SDoug Rabson.Sh LOCKS
84fb3fd476SMatthew DillonThe vnode will be locked on entry and should remain locked on return.
85fab63cc4SDoug Rabson.Sh RETURN VALUES
863a9c9c6eSMike PritchardIf the file is accessible in the specified way, then zero is returned,
87fab63cc4SDoug Rabsonotherwise an appropriate error code is returned.
88fab63cc4SDoug Rabson.Sh ERRORS
89eaa8b244SMike Pritchard.Bl -tag -width Er
90fab63cc4SDoug Rabson.It Bq Er EPERM
91cc258457SDon LewisAn attempt was made to change an immutable file.
92fab63cc4SDoug Rabson.It Bq Er EACCES
9381f8d226SDon LewisThe permission bits the file mode or the ACL do not permit the
9481f8d226SDon Lewisrequested access.
95fab63cc4SDoug Rabson.El
96fab63cc4SDoug Rabson.Sh SEE ALSO
9712f96c9bSChris Costello.Xr vaccess 9 ,
9812f96c9bSChris Costello.Xr vaccess_acl_posix1e 9 ,
99fab63cc4SDoug Rabson.Xr vnode 9
100fab63cc4SDoug Rabson.Sh AUTHORS
101571dba6eSHiten PandyaThis manual page was written by
102aaf1f16eSPhilippe Charnier.An Doug Rabson .
103