15c51f124SMoriah Waterland /*
25c51f124SMoriah Waterland  * CDDL HEADER START
35c51f124SMoriah Waterland  *
45c51f124SMoriah Waterland  * The contents of this file are subject to the terms of the
55c51f124SMoriah Waterland  * Common Development and Distribution License (the "License").
65c51f124SMoriah Waterland  * You may not use this file except in compliance with the License.
75c51f124SMoriah Waterland  *
85c51f124SMoriah Waterland  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95c51f124SMoriah Waterland  * or http://www.opensolaris.org/os/licensing.
105c51f124SMoriah Waterland  * See the License for the specific language governing permissions
115c51f124SMoriah Waterland  * and limitations under the License.
125c51f124SMoriah Waterland  *
135c51f124SMoriah Waterland  * When distributing Covered Code, include this CDDL HEADER in each
145c51f124SMoriah Waterland  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155c51f124SMoriah Waterland  * If applicable, add the following below this CDDL HEADER, with the
165c51f124SMoriah Waterland  * fields enclosed by brackets "[]" replaced with your own identifying
175c51f124SMoriah Waterland  * information: Portions Copyright [yyyy] [name of copyright owner]
185c51f124SMoriah Waterland  *
195c51f124SMoriah Waterland  * CDDL HEADER END
205c51f124SMoriah Waterland  */
215c51f124SMoriah Waterland /*
22*6e1ae2a3SGary Pennington  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
235c51f124SMoriah Waterland  */
245c51f124SMoriah Waterland 
255c51f124SMoriah Waterland 
265c51f124SMoriah Waterland 
275c51f124SMoriah Waterland #ifndef _INSTZONES_LIB_H
285c51f124SMoriah Waterland #define	_INSTZONES_LIB_H
295c51f124SMoriah Waterland 
305c51f124SMoriah Waterland 
315c51f124SMoriah Waterland /*
325c51f124SMoriah Waterland  * Module:	instzones_lib.h
335c51f124SMoriah Waterland  * Group:	libinstzones
345c51f124SMoriah Waterland  * Description:	This module contains the libinstzones internal data structures,
355c51f124SMoriah Waterland  *		constants, and function prototypes. This include should not be
365c51f124SMoriah Waterland  *		needed by any external code (consumers of this library).
375c51f124SMoriah Waterland  */
385c51f124SMoriah Waterland 
395c51f124SMoriah Waterland /*
405c51f124SMoriah Waterland  * required includes
415c51f124SMoriah Waterland  */
425c51f124SMoriah Waterland 
435c51f124SMoriah Waterland /* System includes */
445c51f124SMoriah Waterland 
455c51f124SMoriah Waterland #include <zone.h>
465c51f124SMoriah Waterland #include <libzonecfg.h>
475c51f124SMoriah Waterland #include <libcontract.h>
4822fb2eebSMoriah Waterland #include <instzones_api.h>
495c51f124SMoriah Waterland 
505c51f124SMoriah Waterland 
515c51f124SMoriah Waterland 
525c51f124SMoriah Waterland /*
535c51f124SMoriah Waterland  * C++ prefix
545c51f124SMoriah Waterland  */
555c51f124SMoriah Waterland 
565c51f124SMoriah Waterland #ifdef __cplusplus
575c51f124SMoriah Waterland extern "C" {
585c51f124SMoriah Waterland #endif
595c51f124SMoriah Waterland 
605c51f124SMoriah Waterland /* constants */
615c51f124SMoriah Waterland 
625c51f124SMoriah Waterland 
635c51f124SMoriah Waterland /* macros */
645c51f124SMoriah Waterland 
655c51f124SMoriah Waterland /*
665c51f124SMoriah Waterland  * argument array processing type
675c51f124SMoriah Waterland  */
685c51f124SMoriah Waterland 
695c51f124SMoriah Waterland /*
705c51f124SMoriah Waterland  * This is the "argument array" definition that is returned by _z_new_args
715c51f124SMoriah Waterland  * and is used by _z_add_args, _z_free_args, etc.
725c51f124SMoriah Waterland  */
735c51f124SMoriah Waterland 
745c51f124SMoriah Waterland struct _argArray_t {
755c51f124SMoriah Waterland 	long	_aaNumArgs;	/* number of arguments set */
765c51f124SMoriah Waterland 	long	_aaMaxArgs;	/* number of arguments allocated */
775c51f124SMoriah Waterland 	char	**_aaArgs;	/* actual arguments */
785c51f124SMoriah Waterland };
795c51f124SMoriah Waterland 
805c51f124SMoriah Waterland typedef struct _argArray_t argArray_t;
815c51f124SMoriah Waterland 
825c51f124SMoriah Waterland /*
835c51f124SMoriah Waterland  * lock objects
845c51f124SMoriah Waterland  */
855c51f124SMoriah Waterland 
865c51f124SMoriah Waterland /*
875c51f124SMoriah Waterland  * this allows a root path to be prepended to a lock object; e.g.
885c51f124SMoriah Waterland  *   rootpath.%s/zone.%s/...
895c51f124SMoriah Waterland  */
905c51f124SMoriah Waterland #define	LOBJ_ROOTPATH	"rootpath.%s"
915c51f124SMoriah Waterland 
925c51f124SMoriah Waterland /* this locks a single zone (zone.name) */
935c51f124SMoriah Waterland #define	LOBJ_ONE_ZONE	"zone.%s"
945c51f124SMoriah Waterland 
955c51f124SMoriah Waterland /* this locks all zones */
965c51f124SMoriah Waterland #define	LOBJ_ZONEADMIN	"zone.*"
975c51f124SMoriah Waterland 
985c51f124SMoriah Waterland /* this locks all packages, in all zones */
995c51f124SMoriah Waterland #define	LOBJ_PKGADMIN	"zone.*/package.*"
1005c51f124SMoriah Waterland 
1015c51f124SMoriah Waterland #define	LOCK_OBJECT_MAXLEN	512
1025c51f124SMoriah Waterland #define	LOCK_KEY_MAXLEN		37
1035c51f124SMoriah Waterland 
1045c51f124SMoriah Waterland /* paths to commands executed by this module */
1055c51f124SMoriah Waterland 
1065c51f124SMoriah Waterland #define	PKGADM_CMD	"/usr/bin/pkgadm"
1075c51f124SMoriah Waterland #define	ZONEADM_CMD	"/usr/sbin/zoneadm"
1085c51f124SMoriah Waterland 
1095c51f124SMoriah Waterland /* max message size for program output functions (echo, echo debug, progerr) */
1105c51f124SMoriah Waterland 
1115c51f124SMoriah Waterland #define	MAX_MESSAGE_SIZE	4096
1125c51f124SMoriah Waterland 
1135c51f124SMoriah Waterland /* maximum number of retries when waiting for lock */
1145c51f124SMoriah Waterland 
1155c51f124SMoriah Waterland #define	MAX_RETRIES	300
1165c51f124SMoriah Waterland 
1175c51f124SMoriah Waterland /* delay (in seconds) between retries when waiting for lock */
1185c51f124SMoriah Waterland 
1195c51f124SMoriah Waterland #define	RETRY_DELAY_SECS	1
1205c51f124SMoriah Waterland 
1215c51f124SMoriah Waterland /* Size of buffer increments when reading from pipe */
1225c51f124SMoriah Waterland 
1235c51f124SMoriah Waterland #define	PIPE_BUFFER_INCREMENT	256
1245c51f124SMoriah Waterland 
1255c51f124SMoriah Waterland /* Maximum number of arguments to pkg_ExecCmdList */
1265c51f124SMoriah Waterland 
1275c51f124SMoriah Waterland #define	MAX_EXEC_CMD_ARGS	100
1285c51f124SMoriah Waterland 
1295c51f124SMoriah Waterland /*
1305c51f124SMoriah Waterland  * These dynamic libraries are required in order to use the zones
1315c51f124SMoriah Waterland  * functionality - if these libraries are not available at runtime,
1325c51f124SMoriah Waterland  * then zones are assumed to NOT be available, and it is assumed that
1335c51f124SMoriah Waterland  * the program is running in the global zone with no non-global zones.
1345c51f124SMoriah Waterland  */
1355c51f124SMoriah Waterland 
1365c51f124SMoriah Waterland #if	defined(LIBZONECFG_PATH)
1375c51f124SMoriah Waterland #define	ZONECFG1_LIBRARY	LIBZONECFG_PATH
1385c51f124SMoriah Waterland #else	/* defined(LIBZONECFG_PATH) */
1395c51f124SMoriah Waterland #define	ZONECFG1_LIBRARY	"libzonecfg.so.1"
1405c51f124SMoriah Waterland #endif	/* defined(LIBZONECFG_PATH) */
1415c51f124SMoriah Waterland 
1425c51f124SMoriah Waterland #define	ZONECFG_LIBRARY		"libzonecfg.so"
1435c51f124SMoriah Waterland 
1445c51f124SMoriah Waterland #define	CONTRACT1_LIBRARY	"libcontract.so.1"
1455c51f124SMoriah Waterland #define	CONTRACT_LIBRARY	"libcontract.so"
1465c51f124SMoriah Waterland 
1475c51f124SMoriah Waterland /*
1485c51f124SMoriah Waterland  * Environment values used when running commands within a non-global zone
1495c51f124SMoriah Waterland  */
1505c51f124SMoriah Waterland 
1515c51f124SMoriah Waterland /* SHELL= */
1525c51f124SMoriah Waterland 
1535c51f124SMoriah Waterland #define	ZONE_FAILSAFESHELL	"/sbin/sh"
1545c51f124SMoriah Waterland 
1555c51f124SMoriah Waterland /* PATH= */
1565c51f124SMoriah Waterland 
1575c51f124SMoriah Waterland #define	ZONE_DEF_PATH		"/usr/sbin:/usr/bin"
1585c51f124SMoriah Waterland 
1595c51f124SMoriah Waterland /* error codes */
1605c51f124SMoriah Waterland #define	ERR_MALLOC_FAIL		-50
1615c51f124SMoriah Waterland 
1625c51f124SMoriah Waterland /*
1635c51f124SMoriah Waterland  * zone brand list structure
1645c51f124SMoriah Waterland  */
1655c51f124SMoriah Waterland 
1665c51f124SMoriah Waterland struct _zoneBrandList {
1675c51f124SMoriah Waterland 	char			*string_ptr;
1685c51f124SMoriah Waterland 	struct _zoneBrandList	*next;
1695c51f124SMoriah Waterland };
1705c51f124SMoriah Waterland 
1715c51f124SMoriah Waterland /*
1725c51f124SMoriah Waterland  * zone status structure - used to retrieve and hold status of zones
1735c51f124SMoriah Waterland  */
1745c51f124SMoriah Waterland 
1755c51f124SMoriah Waterland typedef unsigned long _zone_status_t;
1765c51f124SMoriah Waterland 
1775c51f124SMoriah Waterland struct _zoneListElement_t {
1785c51f124SMoriah Waterland 	char		*_zlName;
1795c51f124SMoriah Waterland 	char		*_zlPath;
1805c51f124SMoriah Waterland 	char		*_zlScratchName;
1815c51f124SMoriah Waterland 	char		*_zlLockObjects;
1825c51f124SMoriah Waterland 	/*
1835c51f124SMoriah Waterland 	 * the install "state" refers to the zone states listed in
1845c51f124SMoriah Waterland 	 * /usr/include/libzonecfg.h that is stored in the zone_state_t
1855c51f124SMoriah Waterland 	 * structure and returned from getzoneent_private() - such as:
1865c51f124SMoriah Waterland 	 * ZONE_STATE_CONFIGURED, ZONE_STATE_INCOMPLETE,
1875c51f124SMoriah Waterland 	 * ZONE_STATE_INSTALLED, ZONE_STATE_READY, ZONE_STATE_MOUNTED,
1885c51f124SMoriah Waterland 	 * ZONE_STATE_SHUTTING_DOWN, ZONE_STATE_DOWN.
1895c51f124SMoriah Waterland 	 */
1905c51f124SMoriah Waterland 	zone_state_t	_zlOrigInstallState;
1915c51f124SMoriah Waterland 	zone_state_t	_zlCurrInstallState;
1925c51f124SMoriah Waterland 	/*
1935c51f124SMoriah Waterland 	 * the kernel "status" refers to the zone status listed in
1945c51f124SMoriah Waterland 	 * /usr/include/sys/zone.h, returned by zone_get_state(),
1955c51f124SMoriah Waterland 	 * and defined in the zone_status_t enum - such as:
1965c51f124SMoriah Waterland 	 * ZONE_IS_UNINITIALIZED, ZONE_IS_READY, ZONE_IS_BOOTING,
1975c51f124SMoriah Waterland 	 * ZONE_IS_RUNNING, ZONE_IS_SHUTTING_DOWN, ZONE_IS_EMPTY,
1985c51f124SMoriah Waterland 	 * ZONE_IS_DOWN, ZONE_IS_DYING, ZONE_IS_DEAD.
1995c51f124SMoriah Waterland 	 */
2005c51f124SMoriah Waterland 	zone_status_t	_zlOrigKernelStatus;
2015c51f124SMoriah Waterland 	zone_status_t	_zlCurrKernelStatus;
2025c51f124SMoriah Waterland 	/*
2035c51f124SMoriah Waterland 	 * this is an internal state recorded about the zone (ZSF_xxx).
2045c51f124SMoriah Waterland 	 */
2055c51f124SMoriah Waterland 	_zone_status_t	_zlStatus;
2065c51f124SMoriah Waterland };
2075c51f124SMoriah Waterland 
2085c51f124SMoriah Waterland typedef struct _zoneListElement_t zoneListElement_t;
2095c51f124SMoriah Waterland 
2105c51f124SMoriah Waterland /* bits used in the _zoneListElement _zlStatus variable */
2115c51f124SMoriah Waterland 
2125c51f124SMoriah Waterland #define	ZST_NOT_BOOTABLE	((_zone_status_t)0x00000001)
2135c51f124SMoriah Waterland #define	ZST_LOCKED		((_zone_status_t)0x00000002)
2145c51f124SMoriah Waterland 
2155c51f124SMoriah Waterland /*
2165c51f124SMoriah Waterland  * User-specified list of zones.
2175c51f124SMoriah Waterland  */
2185c51f124SMoriah Waterland 
2195c51f124SMoriah Waterland typedef struct zone_spec_s {
2205c51f124SMoriah Waterland 	struct zone_spec_s	*zl_next;
2215c51f124SMoriah Waterland 	boolean_t		zl_used;
2225c51f124SMoriah Waterland 	char			zl_name[ZONENAME_MAX];
2235c51f124SMoriah Waterland } zone_spec_t;
2245c51f124SMoriah Waterland 
2255c51f124SMoriah Waterland /*
2265c51f124SMoriah Waterland  * The global data structure used to hold all of the global (extern) data
2275c51f124SMoriah Waterland  * used by this library.
2285c51f124SMoriah Waterland  *
2295c51f124SMoriah Waterland  * --> THESE DEFINITIONS ARE ORDER DEPENDENT BASED <--
2305c51f124SMoriah Waterland  * --> ON THE ORDER OF THE STRUCTURE INITIALIZERS! <--
2315c51f124SMoriah Waterland  */
2325c51f124SMoriah Waterland 
2335c51f124SMoriah Waterland struct _z_global_data_t {
2345c51f124SMoriah Waterland 	char		*_z_ObjectLocks;	/* object locks held */
2355c51f124SMoriah Waterland 	char 		*_z_root_dir;		/* root for zone lib fctns */
2365c51f124SMoriah Waterland 	int		_z_SigReceived;		/* received signal count */
2375c51f124SMoriah Waterland 	pid_t		_z_ChildProcessId;	/* child to propagate sigs to */
2385c51f124SMoriah Waterland 	zone_spec_t	*_zone_spec;		/* zones to operate on */
2395c51f124SMoriah Waterland 	_z_printf_fcn_t	_z_echo;		/* operational message fcn */
2405c51f124SMoriah Waterland 	_z_printf_fcn_t	_z_echo_debug;		/* debug message fcn */
2415c51f124SMoriah Waterland 	_z_printf_fcn_t	_z_progerr;		/* program error fcn */
2425c51f124SMoriah Waterland };
2435c51f124SMoriah Waterland 
2445c51f124SMoriah Waterland typedef struct _z_global_data_t z_global_data_t;
2455c51f124SMoriah Waterland 
2465c51f124SMoriah Waterland /*
2475c51f124SMoriah Waterland  * When _INSTZONES_LIB_Z_DEFINE_GLOBAL_DATA is defined,
2485c51f124SMoriah Waterland  * instzones_lib.h will define the z_global_data structure.
2495c51f124SMoriah Waterland  * Otherwise an extern to the structure is inserted.
2505c51f124SMoriah Waterland  *
2515c51f124SMoriah Waterland  * --> THESE DEFINITIONS ARE ORDER DEPENDENT BASED ON <--
2525c51f124SMoriah Waterland  * --> THE ORDER OF THE _z_global_data_t STRUCTURE!!! <--
2535c51f124SMoriah Waterland  */
2545c51f124SMoriah Waterland 
2555c51f124SMoriah Waterland #if	defined(_INSTZONES_LIB_Z_DEFINE_GLOBAL_DATA)
2565c51f124SMoriah Waterland 
2575c51f124SMoriah Waterland /* define and initialize structure */
2585c51f124SMoriah Waterland 
2595c51f124SMoriah Waterland z_global_data_t _z_global_data = {
2605c51f124SMoriah Waterland 	NULL,	/* *_z_ObjectLocks */
2615c51f124SMoriah Waterland 	"",	/* *_z_root_dir */
2625c51f124SMoriah Waterland 	0,	/* _z_SigReceived */
2635c51f124SMoriah Waterland 	-1,	/* _z_ChildProcessId */
2645c51f124SMoriah Waterland 	NULL,	/* *_zone_spec */
2655c51f124SMoriah Waterland 	NULL,	/* _z_echo */
2665c51f124SMoriah Waterland 	NULL,	/* _z_echo_debug */
2675c51f124SMoriah Waterland 	NULL	/* _z_progerr */
2685c51f124SMoriah Waterland };
2695c51f124SMoriah Waterland 
2705c51f124SMoriah Waterland #else	/* !defined(_INSTZONES_LIB__Z_DEFINE_GLOBAL_DATA) */
2715c51f124SMoriah Waterland 
2725c51f124SMoriah Waterland /* define structure extern */
2735c51f124SMoriah Waterland 
2745c51f124SMoriah Waterland extern z_global_data_t _z_global_data;
2755c51f124SMoriah Waterland 
2765c51f124SMoriah Waterland #endif	/* defined(_INSTZONES_LIB_Z_DEFINE_GLOBAL_DATA) */
2775c51f124SMoriah Waterland 
2785c51f124SMoriah Waterland /* function prototypes */
2795c51f124SMoriah Waterland 
2805c51f124SMoriah Waterland /*
2815c51f124SMoriah Waterland  *  The following functions can be used by other libs, but not
2825c51f124SMoriah Waterland  *  by applications.
2835c51f124SMoriah Waterland  */
2845c51f124SMoriah Waterland 
2855c51f124SMoriah Waterland /* ---> zones_states.c */
2865c51f124SMoriah Waterland 
2875c51f124SMoriah Waterland boolean_t	_z_make_zone_ready(zoneListElement_t *a_zlem);
2885c51f124SMoriah Waterland boolean_t	_z_make_zone_down(zoneListElement_t *a_zlem);
2895c51f124SMoriah Waterland boolean_t	_z_make_zone_running(zoneListElement_t *a_zlem);
2905c51f124SMoriah Waterland int		UmountAllZones(char *mntpnt);
2915c51f124SMoriah Waterland void		*_z_calloc(size_t size);
2925c51f124SMoriah Waterland void		*_z_malloc(size_t size);
2935c51f124SMoriah Waterland void		*_z_realloc(void *ptr, size_t size);
2945c51f124SMoriah Waterland void		*_z_strdup(char *str);
2955c51f124SMoriah Waterland 
2965c51f124SMoriah Waterland /* ---> zones_utils.c */
2975c51f124SMoriah Waterland 
2985c51f124SMoriah Waterland /*PRINTFLIKE1*/
2995c51f124SMoriah Waterland void		_z_program_error(char *fmt, ...);
3005c51f124SMoriah Waterland /*PRINTFLIKE1*/
3015c51f124SMoriah Waterland void		_z_echo(char *fmt, ...);
3025c51f124SMoriah Waterland /*PRINTFLIKE1*/
3035c51f124SMoriah Waterland void		_z_echoDebug(char *a_fmt, ...);
3045c51f124SMoriah Waterland int		_z_is_directory(char *path);
3055c51f124SMoriah Waterland boolean_t	_z_running_in_global_zone(void);
3065c51f124SMoriah Waterland boolean_t	_z_zones_are_implemented(void);
3075c51f124SMoriah Waterland void		_z_sig_trap(int a_signo);
3085c51f124SMoriah Waterland int		_z_close_file_descriptors(void *a_fds, int a_fd);
3095c51f124SMoriah Waterland boolean_t	_z_brands_are_implemented(void);
3105c51f124SMoriah Waterland 
3115c51f124SMoriah Waterland 
3125c51f124SMoriah Waterland /* ---> zones_locks.c */
3135c51f124SMoriah Waterland 
3145c51f124SMoriah Waterland boolean_t	_z_adjust_lock_object_for_rootpath(char **r_result,
3155c51f124SMoriah Waterland 			char *a_lockObject);
3165c51f124SMoriah Waterland boolean_t	_z_acquire_lock(char **r_lockKey, char *a_zoneName,
3175c51f124SMoriah Waterland 			char *a_lock, pid_t a_pid, boolean_t a_wait);
3185c51f124SMoriah Waterland boolean_t	_z_lock_zone(zoneListElement_t *a_zlst,
3195c51f124SMoriah Waterland 			ZLOCKS_T a_lflags);
3205c51f124SMoriah Waterland boolean_t	_z_lock_zone_object(char **r_objectLocks,
3215c51f124SMoriah Waterland 			char *a_zoneName, char *a_lockObject,
3225c51f124SMoriah Waterland 			pid_t a_pid, char *a_waitingMsg,
3235c51f124SMoriah Waterland 			char *a_busyMsg);
3245c51f124SMoriah Waterland boolean_t	_z_release_lock(char *a_zoneName, char *a_lock,
3255c51f124SMoriah Waterland 			char *a_key, boolean_t a_wait);
3265c51f124SMoriah Waterland boolean_t	_z_unlock_zone(zoneListElement_t *a_zlst,
3275c51f124SMoriah Waterland 			ZLOCKS_T a_lflags);
3285c51f124SMoriah Waterland boolean_t	_z_unlock_zone_object(char **r_objectLocks,
3295c51f124SMoriah Waterland 			char *a_zoneName, char *a_lockObject,
3305c51f124SMoriah Waterland 			char *a_errMsg);
3315c51f124SMoriah Waterland 
3325c51f124SMoriah Waterland /* ---> zones_args.c */
3335c51f124SMoriah Waterland 
3345c51f124SMoriah Waterland void		_z_free_args(argArray_t *a_args);
3355c51f124SMoriah Waterland argArray_t	*_z_new_args(int initialCount);
3365c51f124SMoriah Waterland /*PRINTFLIKE2*/
3375c51f124SMoriah Waterland boolean_t	_z_add_arg(argArray_t *a_args, char *a_format, ...);
3385c51f124SMoriah Waterland int		_z_get_argc(argArray_t *a_args);
3395c51f124SMoriah Waterland char		**_z_get_argv(argArray_t *a_args);
3405c51f124SMoriah Waterland 
3415c51f124SMoriah Waterland /* ---> zones_str.c */
3425c51f124SMoriah Waterland 
3435c51f124SMoriah Waterland boolean_t	_z_strContainsToken(char *a_string, char *a_token,
3445c51f124SMoriah Waterland 			char *a_separators);
3455c51f124SMoriah Waterland char		*_z_strGetToken(char *r_sep, char *a_string,
3465c51f124SMoriah Waterland 			int a_index, char *a_separators);
3475c51f124SMoriah Waterland void		_z_strRemoveLeadingWhitespace(char **a_str);
3485c51f124SMoriah Waterland void		_z_strGetToken_r(char *r_sep, char *a_string,
3495c51f124SMoriah Waterland 			int a_index, char *a_separators, char *a_buf,
3505c51f124SMoriah Waterland 			int a_bufLen);
3515c51f124SMoriah Waterland void		_z_strAddToken(char **a_old, char *a_new,
3525c51f124SMoriah Waterland 			char a_separator);
3535c51f124SMoriah Waterland void		_z_strRemoveToken(char **r_string, char *a_token,
3545c51f124SMoriah Waterland 			char *a_separators, int a_index);
3555c51f124SMoriah Waterland /*PRINTFLIKE3*/
3565c51f124SMoriah Waterland void		_z_strPrintf_r(char *a_buf, int a_bufLen,
3575c51f124SMoriah Waterland 			char *a_format, ...);
3585c51f124SMoriah Waterland /*PRINTFLIKE1*/
3595c51f124SMoriah Waterland char		*_z_strPrintf(char *a_format, ...);
3605c51f124SMoriah Waterland 
3615c51f124SMoriah Waterland /* ---> zones_exec.c */
3625c51f124SMoriah Waterland 
3635c51f124SMoriah Waterland int		_z_zone_exec(int *r_status, char **r_results, char *a_inputFile,
3645c51f124SMoriah Waterland 			char *a_path, char *a_argv[], const char *a_zoneName,
3655c51f124SMoriah Waterland 			int *a_fds);
3665c51f124SMoriah Waterland int		_zexec(const char *a_zoneName,
3675c51f124SMoriah Waterland 			const char *path, char *argv[]);
3685c51f124SMoriah Waterland char		*_zexec_add_env(char *name, char *value);
3695c51f124SMoriah Waterland int		_zexec_init_template(void);
3705c51f124SMoriah Waterland char		**_zexec_prep_env();
3715c51f124SMoriah Waterland 
3725c51f124SMoriah Waterland /*
3735c51f124SMoriah Waterland  * C++ postfix
3745c51f124SMoriah Waterland  */
3755c51f124SMoriah Waterland 
3765c51f124SMoriah Waterland #ifdef __cplusplus
3775c51f124SMoriah Waterland }
3785c51f124SMoriah Waterland #endif
3795c51f124SMoriah Waterland 
3805c51f124SMoriah Waterland #endif	/* _INSTZONES_LIB_H */
381