1*3625efb1SRichard Lowe /*
2*3625efb1SRichard Lowe * CDDL HEADER START
3*3625efb1SRichard Lowe *
4*3625efb1SRichard Lowe * The contents of this file are subject to the terms of the
5*3625efb1SRichard Lowe * Common Development and Distribution License (the "License").
6*3625efb1SRichard Lowe * You may not use this file except in compliance with the License.
7*3625efb1SRichard Lowe *
8*3625efb1SRichard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3625efb1SRichard Lowe * or http://www.opensolaris.org/os/licensing.
10*3625efb1SRichard Lowe * See the License for the specific language governing permissions
11*3625efb1SRichard Lowe * and limitations under the License.
12*3625efb1SRichard Lowe *
13*3625efb1SRichard Lowe * When distributing Covered Code, include this CDDL HEADER in each
14*3625efb1SRichard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3625efb1SRichard Lowe * If applicable, add the following below this CDDL HEADER, with the
16*3625efb1SRichard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
17*3625efb1SRichard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
18*3625efb1SRichard Lowe *
19*3625efb1SRichard Lowe * CDDL HEADER END
20*3625efb1SRichard Lowe */
21*3625efb1SRichard Lowe /*
22*3625efb1SRichard Lowe * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
23*3625efb1SRichard Lowe * Use is subject to license terms.
24*3625efb1SRichard Lowe */
25*3625efb1SRichard Lowe
26*3625efb1SRichard Lowe
27*3625efb1SRichard Lowe #include <unistd.h>
28*3625efb1SRichard Lowe #include <vroot/vroot.h>
29*3625efb1SRichard Lowe #include <vroot/args.h>
30*3625efb1SRichard Lowe
access_thunk(char * path)31*3625efb1SRichard Lowe static int access_thunk(char *path)
32*3625efb1SRichard Lowe {
33*3625efb1SRichard Lowe vroot_result= access(path, vroot_args.access.mode);
34*3625efb1SRichard Lowe return((vroot_result == 0) || (errno != ENOENT));
35*3625efb1SRichard Lowe }
36*3625efb1SRichard Lowe
access_vroot(char * path,int mode,pathpt vroot_path,pathpt vroot_vroot)37*3625efb1SRichard Lowe int access_vroot(char *path, int mode, pathpt vroot_path, pathpt vroot_vroot)
38*3625efb1SRichard Lowe {
39*3625efb1SRichard Lowe vroot_args.access.mode= mode;
40*3625efb1SRichard Lowe translate_with_thunk(path, access_thunk, vroot_path, vroot_vroot, rw_read);
41*3625efb1SRichard Lowe return(vroot_result);
42*3625efb1SRichard Lowe }
43