xref: /freebsd/share/man/man9/VOP_ACCESS.9 (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1.\" -*- nroff -*-
2.\" -*- nroff -*-
3.\"
4.\" Copyright (c) 1996 Doug Rabson
5.\"
6.\" All rights reserved.
7.\"
8.\" This program is free software.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd September 18, 2009
31.Dt VOP_ACCESS 9
32.Os
33.Sh NAME
34.Nm VOP_ACCESS ,
35.Nm VOP_ACCESSX
36.Nd "check access permissions of a file or Unix domain socket"
37.Sh SYNOPSIS
38.In sys/param.h
39.In sys/vnode.h
40.Ft int
41.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
42.Ft int
43.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
44.Sh DESCRIPTION
45This entry point checks the access permissions of the file against the
46given credentials.
47.Pp
48Its arguments are:
49.Bl -tag -width accmode
50.It Fa vp
51The vnode of the file to check.
52.It Fa accmode
53The type of access required.
54.It Fa cred
55The user credentials to check.
56.It Fa td
57The thread which is checking.
58.El
59.Pp
60The
61.Fa accmode
62is a mask which can contain flags described in <sys/vnode.h>, e.g.
63.Dv VREAD ,
64.Dv VWRITE
65or
66.Dv VEXEC .
67For
68.Fn VOP_ACCESS ,
69the only flags that may be set in
70.Fa accmode
71are
72.Dv VEXEC ,
73.Dv VWRITE ,
74.Dv VREAD ,
75.Dv VADMIN
76and
77.Dv VAPPEND .
78To check for other flags, one has to use
79.Fn VOP_ACCESSX
80instead.
81.Sh LOCKS
82The vnode will be locked on entry and should remain locked on return.
83.Sh RETURN VALUES
84If the file is accessible in the specified way, then zero is returned,
85otherwise an appropriate error code is returned.
86.Sh ERRORS
87.Bl -tag -width Er
88.It Bq Er EPERM
89An attempt was made to change an immutable file.
90.It Bq Er EACCES
91The permission bits the file mode or the ACL do not permit the
92requested access.
93.El
94.Sh SEE ALSO
95.Xr vaccess 9 ,
96.Xr vaccess_acl_nfs4 9 ,
97.Xr vaccess_acl_posix1e 9 ,
98.Xr vnode 9
99.Sh AUTHORS
100This manual page was written by
101.An Doug Rabson .
102