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
29*3625efb1SRichard Lowe extern int execve (const char *path, char *const argv[], char *const envp[]);
30*3625efb1SRichard Lowe
31*3625efb1SRichard Lowe #include <vroot/vroot.h>
32*3625efb1SRichard Lowe #include <vroot/args.h>
33*3625efb1SRichard Lowe
execve_thunk(char * path)34*3625efb1SRichard Lowe static int execve_thunk(char *path)
35*3625efb1SRichard Lowe {
36*3625efb1SRichard Lowe execve(path, vroot_args.execve.argv, vroot_args.execve.environ);
37*3625efb1SRichard Lowe switch (errno) {
38*3625efb1SRichard Lowe case ETXTBSY:
39*3625efb1SRichard Lowe case ENOEXEC: return 1;
40*3625efb1SRichard Lowe default: return 0;
41*3625efb1SRichard Lowe }
42*3625efb1SRichard Lowe }
43*3625efb1SRichard Lowe
execve_vroot(char * path,char ** argv,char ** environ,pathpt vroot_path,pathpt vroot_vroot)44*3625efb1SRichard Lowe int execve_vroot(char *path, char **argv, char **environ, pathpt vroot_path, pathpt vroot_vroot)
45*3625efb1SRichard Lowe {
46*3625efb1SRichard Lowe vroot_args.execve.argv= argv;
47*3625efb1SRichard Lowe vroot_args.execve.environ= environ;
48*3625efb1SRichard Lowe translate_with_thunk(path, execve_thunk, vroot_path, vroot_vroot, rw_read);
49*3625efb1SRichard Lowe return(-1);
50*3625efb1SRichard Lowe }
51