1.\" $OpenBSD: vaccess.9,v 1.9 2013/06/04 19:27:15 schwarze Exp $ 2.\"- 3.\" Copyright (c) 2001 Robert N. M. Watson 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" 28.Dd $Mdocdate: June 4 2013 $ 29.Dt VACCESS 9 30.Os 31.Sh NAME 32.Nm vaccess 33.Nd check access permissions based on vnode parameters 34.Sh SYNOPSIS 35.In sys/param.h 36.In sys/vnode.h 37.Ft int 38.Fo vaccess 39.Fa "enum vtype type" 40.Fa "mode_t file_mode" 41.Fa "uid_t uid" 42.Fa "gid_t gid" 43.Fa "mode_t acc_mode" 44.Fa "struct ucred *cred" 45.Fc 46.Sh DESCRIPTION 47The 48.Fn vaccess 49function checks if the credentials described in 50.Fa cred 51are sufficient to perform the operation described by 52.Fa acc_mode , 53based on the 54.Fa type , 55.Fa file_mode , 56.Fa uid , 57and 58.Fa gid 59arguments. 60These arguments would typically be based on the vnode being 61accessed. 62.Pp 63.Fa file_mode 64is the current mode of the file that is having access checked. 65The 66.Fa uid 67and 68.Fa gid 69arguments are the user id and group id representing the owner of the file. 70.Fa acc_mode 71describes the operation desired. 72It should be one of 73.Dv VREAD , 74.Dv VWRITE , 75or 76.Dv VEXEC 77representing read, write, and execute, respectively. 78.Sh RETURN VALUES 79.Fn vaccess 80will return 0 on success, or a non-zero error value on failure. 81.Sh ERRORS 82.Bl -tag -width Er 83.It Bq Er EACCES 84Permission denied. 85An attempt was made to access a file in a way forbidden by its file access 86permissions. 87.El 88.Sh SEE ALSO 89.Xr vnode 9 90.Sh HISTORY 91This man page was originally written by 92.An Robert Watson 93for 94.Fx . 95It was modified to represent the 96.Ox 97implementation by 98.An Peter Werner . 99