10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe/*
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER START
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe *
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The contents of this file are subject to the terms of the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Common Development and Distribution License (the "License").
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You may not use this file except in compliance with the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe *
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * or http://www.opensolaris.org/os/licensing.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * See the License for the specific language governing permissions
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * and limitations under the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe *
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe *
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER END
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe/*
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Use is subject to license terms.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#ifndef _VROOT_H_
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#define _VROOT_H_
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#include <stdio.h>
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#include <nl_types.h>
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#define VROOT_DEFAULT ((pathpt)-1)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowetypedef struct {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe char *path;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe short length;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe} pathcellt, *pathcellpt, patht;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowetypedef patht *pathpt;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void add_dir_to_path(const char *path, register pathpt *pointer, register int position);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void flush_path_cache(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void flush_vroot_cache(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern const char *get_path_name(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern char *get_vroot_path(register char **vroot, register char **path, register char **filename);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern const char *get_vroot_name(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int open_vroot(char *path, int flags, int mode, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern pathpt parse_path_string(register char *string, register int remove_slash);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void scan_path_first(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void scan_vroot_first(void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void set_path_style(int style);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int access_vroot(char *path, int mode, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int execve_vroot(char *path, char **argv, char **environ, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int lstat_vroot(char *path, struct stat *buffer, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int stat_vroot(char *path, struct stat *buffer, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern int readlink_vroot(char *path, char *buffer, int buffer_size, pathpt vroot_path, pathpt vroot_vroot);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe#endif