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.\" $FreeBSD$ 31.\" 32.Dd September 18, 2009 33.Dt VOP_ACCESS 9 34.Os 35.Sh NAME 36.Nm VOP_ACCESS , 37.Nm VOP_ACCESSX 38.Nd "check access permissions of a file or Unix domain socket" 39.Sh SYNOPSIS 40.In sys/param.h 41.In sys/vnode.h 42.Ft int 43.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td" 44.Ft int 45.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td" 46.Sh DESCRIPTION 47This entry point checks the access permissions of the file against the 48given credentials. 49.Pp 50Its arguments are: 51.Bl -tag -width accmode 52.It Fa vp 53The vnode of the file to check. 54.It Fa accmode 55The type of access required. 56.It Fa cred 57The user credentials to check. 58.It Fa td 59The thread which is checking. 60.El 61.Pp 62The 63.Fa accmode 64is a mask which can contain flags described in <sys/vnode.h>, e.g. 65.Dv VREAD , 66.Dv VWRITE 67or 68.Dv VEXEC . 69For 70.Fn VOP_ACCESS , 71the only flags that may be set in 72.Fa accmode 73are 74.Dv VEXEC , 75.Dv VWRITE , 76.Dv VREAD , 77.Dv VADMIN 78and 79.Dv VAPPEND . 80To check for other flags, one has to use 81.Fn VOP_ACCESSX 82instead. 83.Sh LOCKS 84The vnode will be locked on entry and should remain locked on return. 85.Sh RETURN VALUES 86If the file is accessible in the specified way, then zero is returned, 87otherwise an appropriate error code is returned. 88.Sh ERRORS 89.Bl -tag -width Er 90.It Bq Er EPERM 91An attempt was made to change an immutable file. 92.It Bq Er EACCES 93The permission bits the file mode or the ACL do not permit the 94requested access. 95.El 96.Sh SEE ALSO 97.Xr vaccess 9 , 98.Xr vaccess_acl_nfs4 9 , 99.Xr vaccess_acl_posix1e 9 , 100.Xr vnode 9 101.Sh AUTHORS 102This manual page was written by 103.An Doug Rabson . 104