1 /*
2  * CDDL HEADER START
3  *
4  * This file and its contents are supplied under the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may use this file only in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.opensource.org/licenses/cddl1.txt
12  * See the License for the specific language governing permissions
13  * and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 /*
24  * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
25  * Use is subject to license terms.
26  */
27 /*
28  * @(#)vroot.h 1.10 06/12/12
29  */
30 
31 #pragma	ident	"@(#)vroot.h	1.10	06/12/12"
32 
33 /*
34  * Copyright 2017 J. Schilling
35  *
36  * @(#)vroot.h	1.5 21/08/16 2017 J. Schilling
37  */
38 
39 #ifndef _VROOT_H_
40 #define _VROOT_H_
41 
42 #if defined(SCHILY_BUILD) || defined(SCHILY_INCLUDES)
43 #include <schily/unistd.h>
44 #include <schily/stdio.h>
45 #else
46 #include <unistd.h>
47 #include <stdio.h>
48 #endif
49 
50 #define VROOT_DEFAULT ((pathpt)-1)
51 
52 typedef struct {
53 	char		*path;
54 	short		length;
55 } pathcellt, *pathcellpt, patht;
56 typedef patht		*pathpt;
57 
58 extern	void		add_dir_to_path(register const char *path, register pathpt *pointer, register int position);
59 extern	void		flush_path_cache(void);
60 extern	void		flush_vroot_cache(void);
61 extern	const char	*get_path_name(void);
62 extern	char		*get_vroot_path(register char **vroot, register char **path, register char **filename);
63 extern	const char	*get_vroot_name(void);
64 extern	int		open_vroot(char *path, int flags, int mode, pathpt vroot_path, pathpt vroot_vroot);
65 extern	pathpt		parse_path_string(register char *string, register int remove_slash);
66 extern	void		scan_path_first(void);
67 extern	void		scan_vroot_first(void);
68 extern	void		set_path_style(int style);
69 
70 extern	int		access_vroot(char *path, int mode, pathpt vroot_path, pathpt vroot_vroot);
71 
72 extern	int		execve_vroot(char *path, char **argv, char **environ, pathpt vroot_path, pathpt vroot_vroot);
73 
74 extern	int		lstat_vroot(char *path, struct stat *buffer, pathpt vroot_path, pathpt vroot_vroot);
75 extern	int		stat_vroot(char *path, struct stat *buffer, pathpt vroot_path, pathpt vroot_vroot);
76 extern	int		readlink_vroot(char *path, char *buffer, int buffer_size, pathpt vroot_path, pathpt vroot_vroot);
77 
78 
79 #endif
80