xref: /illumos-gate/usr/src/cmd/svr4pkg/hdrs/libinst.h (revision 69aea4bf)
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 
2232991bedSPeter Tribble /*
23*69aea4bfSPeter Tribble  * Copyright (c) 2018 Peter Tribble.
2432991bedSPeter Tribble  */
2532991bedSPeter Tribble 
265c51f124SMoriah Waterland /*
276e1ae2a3SGary Pennington  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
285c51f124SMoriah Waterland  */
295c51f124SMoriah Waterland 
305c51f124SMoriah Waterland #ifndef	__HDRS_LIBINST_H__
315c51f124SMoriah Waterland #define	__HDRS_LIBINST_H__
325c51f124SMoriah Waterland 
335c51f124SMoriah Waterland 
345c51f124SMoriah Waterland #ifdef __cplusplus
355c51f124SMoriah Waterland extern "C" {
365c51f124SMoriah Waterland #endif
375c51f124SMoriah Waterland 
385c51f124SMoriah Waterland #include <stdio.h>
395c51f124SMoriah Waterland #include <fcntl.h>
405c51f124SMoriah Waterland #include <sys/types.h>
415c51f124SMoriah Waterland #include <sys/stat.h>
425c51f124SMoriah Waterland #include <pkgstrct.h>
435c51f124SMoriah Waterland #include <pkginfo.h>
445c51f124SMoriah Waterland #include "pkglib.h"
455c51f124SMoriah Waterland #include <cfext.h>
465c51f124SMoriah Waterland #include "install.h"
475c51f124SMoriah Waterland 
485c51f124SMoriah Waterland #define	DEF_NONE_SCR	"i.CompCpio"
495c51f124SMoriah Waterland 
505c51f124SMoriah Waterland #define	BL_ALL		-1	/* refers to all allocated lists */
515c51f124SMoriah Waterland 
525c51f124SMoriah Waterland /* signal handler function definition */
535c51f124SMoriah Waterland 
545c51f124SMoriah Waterland typedef void (sighdlrFunc_t)(int);
555c51f124SMoriah Waterland 
565c51f124SMoriah Waterland /* maximum parameter length */
575c51f124SMoriah Waterland 
585c51f124SMoriah Waterland #define	MAX_PKG_PARAM_LENGTH	(64+1)	/* +1 for null termination */
595c51f124SMoriah Waterland 
605c51f124SMoriah Waterland /* flag for check_applicability */
615c51f124SMoriah Waterland 
625c51f124SMoriah Waterland typedef unsigned long CAF_T;
635c51f124SMoriah Waterland 
645c51f124SMoriah Waterland /* flags for check_applicability */
655c51f124SMoriah Waterland 
665c51f124SMoriah Waterland #define	CAF_IN_GLOBAL_ZONE	0x00000001	/* in global zone */
675c51f124SMoriah Waterland #define	CAF_SCOPE_GLOBAL	0x00000002	/* -G specified */
685c51f124SMoriah Waterland 
695c51f124SMoriah Waterland /* path to the request file in the package directory */
705c51f124SMoriah Waterland 
715c51f124SMoriah Waterland #define	REQUEST_FILE	"install/request"
725c51f124SMoriah Waterland 
735c51f124SMoriah Waterland /* path to the copyright file in the package directory */
745c51f124SMoriah Waterland 
755c51f124SMoriah Waterland #define	COPYRIGHT_FILE	"install/copyright"
765c51f124SMoriah Waterland 
775c51f124SMoriah Waterland /* path to the depend file in the package directory */
785c51f124SMoriah Waterland 
795c51f124SMoriah Waterland #define	DEPEND_FILE	"install/depend"
805c51f124SMoriah Waterland 
815c51f124SMoriah Waterland /*
825c51f124SMoriah Waterland  * name of environment variable set to non-global zone name being installed:
835c51f124SMoriah Waterland  * pkgadd/pkginstall expects this name and passes it on to any scripts that
845c51f124SMoriah Waterland  * are run if it is set.
855c51f124SMoriah Waterland  */
865c51f124SMoriah Waterland 
885c51f124SMoriah Waterland 
895c51f124SMoriah Waterland /*
905c51f124SMoriah Waterland  * name of environment variable set to indicate this package should be installed
915c51f124SMoriah Waterland  * in the current zone only - see PSARC/2004/789 - New Pkginfo(4) attributes
925c51f124SMoriah Waterland  * for zones
935c51f124SMoriah Waterland  */
945c51f124SMoriah Waterland 
955c51f124SMoriah Waterland #define	PKG_THISZONE_VARIABLE	"SUNW_PKG_THISZONE"
965c51f124SMoriah Waterland 
975c51f124SMoriah Waterland /*
985c51f124SMoriah Waterland  * name of environment variable set to indicate this package should be installed
995c51f124SMoriah Waterland  * in all zones, and only from the global zone - see PSARC/2003/460
1005c51f124SMoriah Waterland  */
1015c51f124SMoriah Waterland 
1025c51f124SMoriah Waterland #define	PKG_ALLZONES_VARIABLE	"SUNW_PKG_ALLZONES"
1035c51f124SMoriah Waterland 
1045c51f124SMoriah Waterland /*
1055c51f124SMoriah Waterland  * name of environment variable set to indicate this package should be installed
1065c51f124SMoriah Waterland  * hollow (db update only) when installed in nonglobal zone - see PSARC/2003/460
1075c51f124SMoriah Waterland  */
1085c51f124SMoriah Waterland 
1095c51f124SMoriah Waterland #define	PKG_HOLLOW_VARIABLE	"SUNW_PKG_HOLLOW"
1105c51f124SMoriah Waterland 
1115c51f124SMoriah Waterland /*
1125c51f124SMoriah Waterland  * General purpose return codes used for functions which don't return a basic
1135c51f124SMoriah Waterland  * success or failure. For those functions wherein a yes/no result is
1145c51f124SMoriah Waterland  * possible, then 1 means OK and 0 means FAIL.
1155c51f124SMoriah Waterland  */
1165c51f124SMoriah Waterland #define	RESULT_OK	0x0
1175c51f124SMoriah Waterland #define	RESULT_WRN	0x1
1185c51f124SMoriah Waterland #define	RESULT_ERR	0x2
1195c51f124SMoriah Waterland 
1205c51f124SMoriah Waterland /* These are the file status indicators for the contents file */
1215c51f124SMoriah Waterland #define	INST_RDY	'+'	/* entry is ready to installf -f */
1225c51f124SMoriah Waterland #define	RM_RDY		'-'	/* entry is ready for removef -f */
1235c51f124SMoriah Waterland #define	NOT_FND		'!'	/* entry (or part of entry) was not found */
1245c51f124SMoriah Waterland #define	SERVED_FILE	'%'	/* using the file server's RO partition */
1255c51f124SMoriah Waterland #define	STAT_NEXT	'@'	/* this is awaiting eptstat */
1265c51f124SMoriah Waterland #define	DUP_ENTRY	'#'	/* there's a duplicate of this */
1275c51f124SMoriah Waterland #define	CONFIRM_CONT	'*'	/* need to confirm contents */
1285c51f124SMoriah Waterland #define	CONFIRM_ATTR	'~'	/* need to confirm attributes */
1295c51f124SMoriah Waterland #define	ENTRY_OK	'\0'	/* entry is a confirmed file */
1305c51f124SMoriah Waterland 
1315c51f124SMoriah Waterland /* control bits for pkgdbmerg() */
1325c51f124SMoriah Waterland #define	NO_COPY		0x0001
1335c51f124SMoriah Waterland #define	CLIENT_PATHS	0x0002	/* working with a client database */
1345c51f124SMoriah Waterland 
1355c51f124SMoriah Waterland /* control bits for file verification by class */
1365c51f124SMoriah Waterland #define	DEFAULT		0x0	/* standard full verification */
1375c51f124SMoriah Waterland #define	NOVERIFY	0x1	/* do not verify */
1385c51f124SMoriah Waterland #define	QKVERIFY	0x2	/* do a quick verification instead */
1395c51f124SMoriah Waterland 
1405c51f124SMoriah Waterland /* control bit for path type to pass to CAS */
1415c51f124SMoriah Waterland #define	DEFAULT		0x0	/* standard server-relative absolute path */
1425c51f124SMoriah Waterland #define	REL_2_CAS	0x1	/* pass pkgmap-type relative path */
1435c51f124SMoriah Waterland 
1445c51f124SMoriah Waterland /* findscripts() argument */
1455c51f124SMoriah Waterland #define	I_ONLY		0x0	/* find install class action scripts */
1465c51f124SMoriah Waterland #define	R_ONLY		0x1	/* find removal class action scripts */
1475c51f124SMoriah Waterland 
1485c51f124SMoriah Waterland struct cl_attr {
1495c51f124SMoriah Waterland 	char	name[CLSSIZ+1];	/* name of class */
1505c51f124SMoriah Waterland 	char	*inst_script;	/* install class action script */
1515c51f124SMoriah Waterland 	char	*rem_script;	/* remove class action script */
1525c51f124SMoriah Waterland 	unsigned	src_verify:3;	/* source verification level */
1535c51f124SMoriah Waterland 	unsigned 	dst_verify:4;	/* destination verification level */
1545c51f124SMoriah Waterland 	unsigned	relpath_2_CAS:1;	/* CAS gets relative paths */
1555c51f124SMoriah Waterland };
1565c51f124SMoriah Waterland 
1575c51f124SMoriah Waterland #if defined(__STDC__)
1585c51f124SMoriah Waterland #define	__P(protos) protos
1595c51f124SMoriah Waterland #else	/* __STDC__ */
1605c51f124SMoriah Waterland #define	__P(protos) ()
1615c51f124SMoriah Waterland #endif	/* __STDC__ */
1625c51f124SMoriah Waterland 
1635c51f124SMoriah Waterland /* Common quit declaration used across many package commands */
1645c51f124SMoriah Waterland extern void	quit(int) __NORETURN;
1655c51f124SMoriah Waterland 
1665c51f124SMoriah Waterland 
1675c51f124SMoriah Waterland /* listmgr.c */
1685c51f124SMoriah Waterland extern int	bl_create __P((int count_per_block, int struct_size,
1695c51f124SMoriah Waterland 		    char *desc));
1705c51f124SMoriah Waterland extern char	*bl_next_avail __P((int list_handle));
1715c51f124SMoriah Waterland extern char	*bl_get_record __P((int list_handle, int recno));
1725c51f124SMoriah Waterland extern void	bl_free __P((int list_handle));
1735c51f124SMoriah Waterland extern int	ar_create __P((int count_per_block, int struct_size,
1745c51f124SMoriah Waterland 		    char *desc));
1755c51f124SMoriah Waterland extern char	**ar_next_avail __P((int list_handle));
1765c51f124SMoriah Waterland extern char	**ar_get_head __P((int list_handle));
1775c51f124SMoriah Waterland extern int	ar_delete __P((int list_handle, int index));
1785c51f124SMoriah Waterland extern void	ar_free __P((int list_handle));
1795c51f124SMoriah Waterland 
1805c51f124SMoriah Waterland /* doulimit.c */
1815c51f124SMoriah Waterland extern int	set_ulimit __P((char *script, char *err_msg));
1825c51f124SMoriah Waterland extern int	clr_ulimit __P((void));
1835c51f124SMoriah Waterland extern int	assign_ulimit __P((char *fslimit));
1845c51f124SMoriah Waterland 
1855c51f124SMoriah Waterland /* dryrun.c */
1865c51f124SMoriah Waterland extern void	set_continue_not_ok __P((void));
1875c51f124SMoriah Waterland extern int	continue_is_ok __P((void));
1885c51f124SMoriah Waterland extern int	in_dryrun_mode __P((void));
1895c51f124SMoriah Waterland extern int	in_continue_mode __P((void));
1905c51f124SMoriah Waterland extern void	init_dryrunfile __P((char *dr_dir));
1915c51f124SMoriah Waterland extern void	init_contfile __P((char *cn_dir));
1925c51f124SMoriah Waterland extern void	set_dr_exitmsg __P((char *value));
1935c51f124SMoriah Waterland extern void	set_dr_info __P((int type, int value));
1945c51f124SMoriah Waterland extern void	write_dryrun_file __P((struct cfextra **extlist));
1955c51f124SMoriah Waterland 
1965c51f124SMoriah Waterland /* instvol.c */
1975c51f124SMoriah Waterland extern void	regfiles_free __P((void));
1985c51f124SMoriah Waterland 
1995c51f124SMoriah Waterland /* lockinst.c */
2005c51f124SMoriah Waterland extern int	lockinst __P((char *util_name, char *pkg_name, char *place));
2015c51f124SMoriah Waterland extern void	lockupd __P((char *place));
2025c51f124SMoriah Waterland extern void	unlockinst __P((void));
2035c51f124SMoriah Waterland 
2045c51f124SMoriah Waterland extern char	*pathdup __P((char *s));
2055c51f124SMoriah Waterland extern char	*pathalloc __P((int n));
2065c51f124SMoriah Waterland extern char	*fixpath __P((char *path));
2075c51f124SMoriah Waterland extern char	*get_info_basedir __P((void));
2085c51f124SMoriah Waterland extern char	*get_basedir __P((void));
2095c51f124SMoriah Waterland extern char	*get_client_basedir __P((void));
2105c51f124SMoriah Waterland extern int	set_basedirs __P((int reloc, char *adm_basedir,
2115c51f124SMoriah Waterland 		    char *pkginst, int nointeract));
2125c51f124SMoriah Waterland extern int	eval_path __P((char **server_ptr, char **client_ptr,
2135c51f124SMoriah Waterland 		    char **map_ptr, char *path));
2145c51f124SMoriah Waterland extern int	get_orig_offset __P((void));
2155c51f124SMoriah Waterland extern char	*get_inst_root __P((void));
216e47aa97bSSimon Klinkert extern char	*get_mount_point __P((uint32_t n));
217e47aa97bSSimon Klinkert extern char	*get_remote_path __P((uint32_t n));
2185c51f124SMoriah Waterland extern void	set_env_cbdir __P((void));
2195c51f124SMoriah Waterland extern int	set_inst_root __P((char *path));
2205c51f124SMoriah Waterland extern void	put_path_params __P((void));
2215c51f124SMoriah Waterland extern int	mkpath __P((char *p));
2225c51f124SMoriah Waterland extern void	mkbasedir __P((int flag, char *path));
2235c51f124SMoriah Waterland extern int	is_an_inst_root __P((void));
2245c51f124SMoriah Waterland extern int	is_a_basedir __P((void));
2255c51f124SMoriah Waterland extern int	is_a_cl_basedir __P((void));
2265c51f124SMoriah Waterland extern int	is_relocatable __P((void));
2275c51f124SMoriah Waterland extern char	*orig_path __P((char *path));
2285c51f124SMoriah Waterland extern char	*orig_path_ptr __P((char *path));
2295c51f124SMoriah Waterland extern char	*qreason __P((int caller, int retcode, int started,
2305c51f124SMoriah Waterland 			int includeZonename));
2315c51f124SMoriah Waterland extern char	*qstrdup __P((char *s));
2325c51f124SMoriah Waterland extern char	*srcpath __P((char *d, char *p, int part, int nparts));
233d676c667Sphaniram rampura krishnamurthy - Sun Microsystems - Bangalore India extern char	*trans_srcp_pi __P((char *local_path));
2345c51f124SMoriah Waterland extern int	copyf __P((char *from, char *to, time_t mytime));
2355c51f124SMoriah Waterland extern int	copyFile __P((int, int, char *, char *, struct stat *, long));
2365c51f124SMoriah Waterland extern int	openLocal __P((char *a_path, int a_oflag, char *a_tmpdir));
2375c51f124SMoriah Waterland extern int	dockdeps __P((char *depfile, int removeFlag,
2385c51f124SMoriah Waterland 			boolean_t a_preinstallCheck));
2395c51f124SMoriah Waterland extern int	finalck __P((struct cfent *ept, int attrchg, int contchg,
2405c51f124SMoriah Waterland 			boolean_t a_warning));
2415c51f124SMoriah Waterland 
2425c51f124SMoriah Waterland /* dockdeps.c */
2435c51f124SMoriah Waterland extern void setUpdate __P((void));
2445c51f124SMoriah Waterland extern int  isUpdate __P((void));
2455c51f124SMoriah Waterland 
2465c51f124SMoriah Waterland /* mntinfo.c */
2475c51f124SMoriah Waterland extern int	get_mntinfo __P((int map_client, char *vfstab_file));
248e47aa97bSSimon Klinkert extern uint32_t	fsys __P((char *path));
249e47aa97bSSimon Klinkert extern struct fstable *get_fs_entry __P((uint32_t n));
2505c51f124SMoriah Waterland extern int	mount_client __P((void));
2515c51f124SMoriah Waterland extern int	unmount_client __P((void));
252e47aa97bSSimon Klinkert extern uint32_t	resolved_fsys __P((char *path));
253e47aa97bSSimon Klinkert extern char	*get_server_host __P((uint32_t n));
254e47aa97bSSimon Klinkert extern char	*server_map __P((char *path, uint32_t fsys_value));
255e47aa97bSSimon Klinkert extern int	use_srvr_map __P((char *path, uint32_t *fsys_value));
256e47aa97bSSimon Klinkert extern int	use_srvr_map_n __P((uint32_t n));
257e47aa97bSSimon Klinkert extern int	is_fs_writeable __P((char *path, uint32_t *fsys_value));
258e47aa97bSSimon Klinkert extern int	is_remote_fs __P((char *path, uint32_t *fsys_value));
259e47aa97bSSimon Klinkert extern int	is_served __P((char *path, uint32_t *fsys_value));
260e47aa97bSSimon Klinkert extern int	is_mounted __P((char *path, uint32_t *fsys_value));
261e47aa97bSSimon Klinkert extern int	is_fs_writeable_n __P((uint32_t n));
262e47aa97bSSimon Klinkert extern int	is_remote_fs_n __P((uint32_t n));
263e47aa97bSSimon Klinkert extern int	is_served_n __P((uint32_t n));
264e47aa97bSSimon Klinkert extern int	is_mounted_n __P((uint32_t n));
265e47aa97bSSimon Klinkert extern fsblkcnt_t	get_blk_size_n __P((uint32_t n));
266e47aa97bSSimon Klinkert extern fsblkcnt_t	get_frag_size_n __P((uint32_t n));
267e47aa97bSSimon Klinkert extern fsblkcnt_t	get_blk_used_n __P((uint32_t n));
268e47aa97bSSimon Klinkert extern fsblkcnt_t	get_blk_free_n __P((uint32_t n));
269e47aa97bSSimon Klinkert extern fsblkcnt_t	get_inode_used_n __P((uint32_t n));
270e47aa97bSSimon Klinkert extern fsblkcnt_t	get_inode_free_n __P((uint32_t n));
271e47aa97bSSimon Klinkert extern void	set_blk_used_n __P((uint32_t n, fsblkcnt_t value));
272e47aa97bSSimon Klinkert extern char	*get_source_name_n __P((uint32_t n));
273e47aa97bSSimon Klinkert extern char	*get_fs_name_n __P((uint32_t n));
2745c51f124SMoriah Waterland extern int	load_fsentry __P((struct fstable *fs_entry, char *name,
2755c51f124SMoriah Waterland 		    char *fstype, char *remote_name));
2765c51f124SMoriah Waterland extern int	isreloc __P((char *pkginstdir));
2775c51f124SMoriah Waterland extern int	is_local_host __P((char *hostname));
2785c51f124SMoriah Waterland extern void	fs_tab_free __P((void));
2795c51f124SMoriah Waterland 
2805c51f124SMoriah Waterland /* pkgdbmerg.c */
28162224350SCasper H.S. Dik extern int	pkgdbmerg __P((PKGserver server, VFP_T *tmpvfp,
28262224350SCasper H.S. Dik 		    struct cfextra **extlist));
2835c51f124SMoriah Waterland extern int	files_installed __P((void));
2845c51f124SMoriah Waterland 
2855c51f124SMoriah Waterland /* ocfile.c */
2865c51f124SMoriah Waterland extern int	trunc_tcfile __P((int fd));
28762224350SCasper H.S. Dik extern int	ocfile __P((PKGserver *serverp, VFP_T **tmpvfp,
2885c51f124SMoriah Waterland 			fsblkcnt_t map_blks));
28962224350SCasper H.S. Dik extern int	swapcfile __P((PKGserver server, VFP_T **a_tmpvfp,
2905c51f124SMoriah Waterland 			char *pkginst, int dbchg));
2915c51f124SMoriah Waterland extern int	set_cfdir __P((char *cfdir));
29262224350SCasper H.S. Dik extern int	socfile __P((PKGserver *server, boolean_t quiet));
2935c51f124SMoriah Waterland extern int	relslock __P((void));
29462224350SCasper H.S. Dik extern int	pkgWlock __P((int verbose));
2955c51f124SMoriah Waterland extern int	iscfile __P((void));
2965c51f124SMoriah Waterland extern int	vcfile __P((void));
2975c51f124SMoriah Waterland 
2985c51f124SMoriah Waterland extern fsblkcnt_t	nblk __P((fsblkcnt_t size, ulong_t bsize,
2995c51f124SMoriah Waterland 			ulong_t frsize));
3005c51f124SMoriah Waterland extern struct	cfent **procmap __P((VFP_T *vfp, int mapflag, char *ir));
3015c51f124SMoriah Waterland extern void	repl_cfent __P((struct cfent *new, struct cfent *old));
3025c51f124SMoriah Waterland extern struct	cfextra **pkgobjmap __P((VFP_T *vfp, int mapflag, char *ir));
3035c51f124SMoriah Waterland extern void	pkgobjinit __P((void));
3045c51f124SMoriah Waterland extern int	seed_pkgobjmap __P((struct cfextra *ext_entry, char *path,
3055c51f124SMoriah Waterland 		    char *local));
3065c51f124SMoriah Waterland extern int	init_pkgobjspace __P((void));
3075c51f124SMoriah Waterland 
3085c51f124SMoriah Waterland /* eptstat.c */
3095c51f124SMoriah Waterland extern void	pinfo_free __P((void));
3105c51f124SMoriah Waterland extern struct	pinfo *eptstat __P((struct cfent *entry, char *pkg, char c));
3115c51f124SMoriah Waterland 
3125c51f124SMoriah Waterland /* echo.c */
3135c51f124SMoriah Waterland /*PRINTFLIKE1*/
3145c51f124SMoriah Waterland extern void	echo __P((char *a_fmt, ...));
3155c51f124SMoriah Waterland /*PRINTFLIKE1*/
3165c51f124SMoriah Waterland extern void	echoDebug __P((char *a_fmt, ...));
3175c51f124SMoriah Waterland extern boolean_t	echoGetFlag __P((void));
3185c51f124SMoriah Waterland extern boolean_t	echoDebugGetFlag __P((void));
3195c51f124SMoriah Waterland extern boolean_t	echoSetFlag __P((boolean_t a_debugFlag));
3205c51f124SMoriah Waterland extern boolean_t	echoDebugSetFlag __P((boolean_t a_debugFlag));
3215c51f124SMoriah Waterland 
3225c51f124SMoriah Waterland /* ptext.c */
3235c51f124SMoriah Waterland /*PRINTFLIKE2*/
3245c51f124SMoriah Waterland extern void	ptext __P((FILE *fp, char *fmt, ...));
3255c51f124SMoriah Waterland 
3265c51f124SMoriah Waterland /* putparam.c */
3275c51f124SMoriah Waterland extern void	putparam __P((char *param, char *value));
3285c51f124SMoriah Waterland extern void	getuserlocale __P((void));
3295c51f124SMoriah Waterland extern void	putuserlocale __P((void));
3305c51f124SMoriah Waterland extern void	putConditionInfo __P((char *, char *));
3315c51f124SMoriah Waterland 
3325c51f124SMoriah Waterland /* setadmin.c */
3335c51f124SMoriah Waterland extern void		setadminFile __P((char *file));
3345c51f124SMoriah Waterland extern char		*setadminSetting __P((char *a_paramName,
3355c51f124SMoriah Waterland 				char *a_paramValue));
3365c51f124SMoriah Waterland 
3375c51f124SMoriah Waterland /* setlist.c */
3385c51f124SMoriah Waterland extern char	*cl_iscript __P((int idx));
3395c51f124SMoriah Waterland extern char	*cl_rscript __P((int idx));
3405c51f124SMoriah Waterland extern void	find_CAS __P((int CAS_type, char *bin_ptr, char *inst_ptr));
3415c51f124SMoriah Waterland extern int	setlist __P((struct cl_attr ***plist, char *slist));
3425c51f124SMoriah Waterland extern void	addlist __P((struct cl_attr ***plist, char *item));
3435c51f124SMoriah Waterland extern char	*cl_nam __P((int cl_idx));
3445c51f124SMoriah Waterland extern char	*flex_device(char *device_name, int dev_ok);
3455c51f124SMoriah Waterland extern int	cl_getn __P((void));
3465c51f124SMoriah Waterland extern int	cl_idx __P((char *cl_nam));
3475c51f124SMoriah Waterland extern void	cl_sets __P((char *slist));
3485c51f124SMoriah Waterland extern void	cl_setl __P((struct cl_attr **cl_lst));
3495c51f124SMoriah Waterland extern void	cl_putl __P((char *parm_name, struct cl_attr **list));
3505c51f124SMoriah Waterland extern int	cl_deliscript __P((int i));
3515c51f124SMoriah Waterland extern unsigned	cl_svfy __P((int i));
3525c51f124SMoriah Waterland extern unsigned	cl_dvfy __P((int i));
3535c51f124SMoriah Waterland extern unsigned	cl_pthrel __P((int i));
3545c51f124SMoriah Waterland 
3555c51f124SMoriah Waterland /* fixpath.c */
3565c51f124SMoriah Waterland extern void __P(export_client_env(char *));
3575c51f124SMoriah Waterland extern void __P(set_partial_inst(void));
3585c51f124SMoriah Waterland extern int __P(is_partial_inst(void));
3595c51f124SMoriah Waterland extern void __P(set_depend_pkginfo_DB(boolean_t a_setting));
3605c51f124SMoriah Waterland extern boolean_t __P(is_depend_pkginfo_DB(void));
3615c51f124SMoriah Waterland extern void __P(disable_spool_create(void));
3625c51f124SMoriah Waterland extern int __P(is_spool_create(void));
3635c51f124SMoriah Waterland 
3645c51f124SMoriah Waterland /* open_package_datastream.c */
3655c51f124SMoriah Waterland extern boolean_t	open_package_datastream(int a_argc, char **a_argv,
3665c51f124SMoriah Waterland 				char *a_spoolto, char *a_device,
3675c51f124SMoriah Waterland 				int *r_repeat, char **r_idsName,
3685c51f124SMoriah Waterland 				char *a_tmpdir, struct pkgdev *a_pkgdev,
3695c51f124SMoriah Waterland 				int a_optind);
3705c51f124SMoriah Waterland 
3715c51f124SMoriah Waterland /* setup_temporary_directory.c */
3725c51f124SMoriah Waterland extern boolean_t	setup_temporary_directory(char **r_dirname,
3735c51f124SMoriah Waterland 				char *a_tmpdir, char *a_suffix);
3745c51f124SMoriah Waterland 
3755c51f124SMoriah Waterland /* unpack_package_from_stream.c */
3765c51f124SMoriah Waterland extern boolean_t	unpack_package_from_stream(char *a_idsName,
3775c51f124SMoriah Waterland 				char *a_pkginst, char *a_tempDir);
3785c51f124SMoriah Waterland 
3795c51f124SMoriah Waterland /* pkgops.c */
3805c51f124SMoriah Waterland 
3815c51f124SMoriah Waterland extern boolean_t	pkgAddPackageToGzonlyList(char *a_pkgInst,
3825c51f124SMoriah Waterland 				char *a_rootPath);
3835c51f124SMoriah Waterland extern void		pkgAddThisZonePackage(char *a_pkgInst);
3845c51f124SMoriah Waterland extern boolean_t	pkgRemovePackageFromGzonlyList(char *a_rootPath,
3855c51f124SMoriah Waterland 				char *a_pkgInst);
3865c51f124SMoriah Waterland extern FILE		*pkgOpenInGzOnlyFile(char *a_rootPath);
3875c51f124SMoriah Waterland extern void		pkginfoFree(struct pkginfo **r_info);
3885c51f124SMoriah Waterland extern boolean_t	pkginfoIsPkgInstalled(struct pkginfo **r_pinfo,
3895c51f124SMoriah Waterland 				char *a_pkgInst);
3905c51f124SMoriah Waterland extern boolean_t	pkgIsPkgInGzOnly(char *a_rootPath, char *a_pkgInst);
3915c51f124SMoriah Waterland extern boolean_t	pkgIsPkgInGzOnlyFP(FILE *a_fp, char *a_pkgInst);
3925c51f124SMoriah Waterland extern boolean_t	pkginfoParamTruth(FILE *a_fp, char *a_param,
3935c51f124SMoriah Waterland 				char *a_value, boolean_t a_default);
3945c51f124SMoriah Waterland extern int		pkgGetPackageList(char ***r_pkgList, char **a_argv,
3955c51f124SMoriah Waterland 				int a_optind, char *a_categories,
3965c51f124SMoriah Waterland 				char **a_categoryList, struct pkgdev *a_pkgdev);
3975c51f124SMoriah Waterland extern void		pkgLocateHighestInst(char *r_path, int r_pathLen,
3985c51f124SMoriah Waterland 				char *r_pkgInst, int r_pkgInstLen,
3995c51f124SMoriah Waterland 				char *a_rootPath, char *a_pkgInst);
4005c51f124SMoriah Waterland extern boolean_t	pkgPackageIsThisZone(char *a_pkgInst);
4015c51f124SMoriah Waterland extern char		*pkgGetGzOnlyPath(void);
4025c51f124SMoriah Waterland extern boolean_t	pkgTestInstalled(char *a_packageName, char *a_rootPath);
4035c51f124SMoriah Waterland 
4045c51f124SMoriah Waterland /* depchk.c */
4055c51f124SMoriah Waterland 
4065c51f124SMoriah Waterland struct depckErrorRecord {
4075c51f124SMoriah Waterland 	int	ier_numZones;
4085c51f124SMoriah Waterland 	char	*ier_packageName;
4095c51f124SMoriah Waterland 	char	**ier_zones;
4105c51f124SMoriah Waterland 	char	**ier_values;
4115c51f124SMoriah Waterland };
4125c51f124SMoriah Waterland 
4135c51f124SMoriah Waterland typedef struct depckErrorRecord depckErrorRecord_t;
4145c51f124SMoriah Waterland 
4155c51f124SMoriah Waterland struct depckError {
4165c51f124SMoriah Waterland 	int			er_numEntries;
4175c51f124SMoriah Waterland 	depckErrorRecord_t	*er_theEntries;
4185c51f124SMoriah Waterland };
4195c51f124SMoriah Waterland 
4205c51f124SMoriah Waterland typedef struct depckError depckError_t;
4215c51f124SMoriah Waterland 
4225c51f124SMoriah Waterland typedef int (depcklFunc_t)(char *a_msg, char *a_pkg);
4235c51f124SMoriah Waterland 
4245c51f124SMoriah Waterland /*
4255c51f124SMoriah Waterland  * ignore_values:
4265c51f124SMoriah Waterland  *	== NULL - record one message for each instance of "name" found
4275c51f124SMoriah Waterland  *	== "" - record multiple instances
4285c51f124SMoriah Waterland  *	!= "" - record multiple instances if value not in ignore_values
4295c51f124SMoriah Waterland  */
4305c51f124SMoriah Waterland 
4315c51f124SMoriah Waterland struct depckl_struct {
4325c51f124SMoriah Waterland 	char		*name;
4335c51f124SMoriah Waterland 	char		*ignore_values;
4345c51f124SMoriah Waterland 	char		**err_msg;
4355c51f124SMoriah Waterland 	depcklFunc_t	*depcklFunc;
4365c51f124SMoriah Waterland 	depckError_t	*record;
4375c51f124SMoriah Waterland };
4385c51f124SMoriah Waterland 
4395c51f124SMoriah Waterland typedef struct depckl_struct depckl_t;
4405c51f124SMoriah Waterland 
4415c51f124SMoriah Waterland extern int		depchkReportErrors(depckl_t *depckl);
4425c51f124SMoriah Waterland extern void		depchkRecordError(depckError_t *a_erc,
4435c51f124SMoriah Waterland 				char *a_pkginst, char *a_zoneName,
4445c51f124SMoriah Waterland 				char *a_value);
4455c51f124SMoriah Waterland 
4465c51f124SMoriah Waterland /* log.c */
4475c51f124SMoriah Waterland 
4485c51f124SMoriah Waterland /* types of log messages we recognize */
4495c51f124SMoriah Waterland typedef enum {
4505c51f124SMoriah Waterland 	LOG_MSG_ERR,
4515c51f124SMoriah Waterland 	LOG_MSG_WRN,
4525c51f124SMoriah Waterland 	LOG_MSG_INFO,
4535c51f124SMoriah Waterland 	LOG_MSG_DEBUG
4545c51f124SMoriah Waterland } LogMsgType;
4555c51f124SMoriah Waterland 
4565c51f124SMoriah Waterland /*PRINTFLIKE2*/
4575c51f124SMoriah Waterland extern	void		log_msg(LogMsgType, const char *, ...);
4585c51f124SMoriah Waterland extern	void		log_set_verbose(boolean_t);
4595c51f124SMoriah Waterland extern	boolean_t	log_get_verbose(void);
4605c51f124SMoriah Waterland 
4615c51f124SMoriah Waterland /*
4625c51f124SMoriah Waterland  * typedef for the 'ckreturn' function
4635c51f124SMoriah Waterland  */
4645c51f124SMoriah Waterland typedef void (ckreturnFunc_t)(int a_retcode);
4655c51f124SMoriah Waterland 
4665c51f124SMoriah Waterland /* sml.c */
4675c51f124SMoriah Waterland 
4685c51f124SMoriah Waterland /* null reference to SML_TAG object */
4695c51f124SMoriah Waterland 
4705c51f124SMoriah Waterland #define	SML_TAG__NULL		((SML_TAG*)NULL)
4715c51f124SMoriah Waterland 
4725c51f124SMoriah Waterland /* null reference to SML_TAG * object */
4735c51f124SMoriah Waterland 
4745c51f124SMoriah Waterland #define	SML_TAG__R_NULL		((SML_TAG**)NULL)
4755c51f124SMoriah Waterland 
4765c51f124SMoriah Waterland /* is reference to SML_TAG object valid? */
4775c51f124SMoriah Waterland 
4785c51f124SMoriah Waterland #define	SML_TAG__ISVALID(tag)	((tag) != (SML_TAG__NULL))
4795c51f124SMoriah Waterland 
4805c51f124SMoriah Waterland /* is indirect reference to SML_TAG object valid? */
4815c51f124SMoriah Waterland 
4825c51f124SMoriah Waterland #define	SML_TAG__R_ISVALID(r_tag)	\
4835c51f124SMoriah Waterland 	((r_tag) != ((SML_TAG**)(SML_TAG__NULL)))
4845c51f124SMoriah Waterland 
4855c51f124SMoriah Waterland /* definitions for sml passed from pkginstall to pkgcond */
4865c51f124SMoriah Waterland 
4885c51f124SMoriah Waterland #define	TAG_COND_TOPLEVEL	"environmentConditionInformation"
4895c51f124SMoriah Waterland #define	TAG_COND_PARENT_ZONE	"parentZone"
4905c51f124SMoriah Waterland #define	TAG_COND_CURRENT_ZONE	"currentZone"
4915c51f124SMoriah Waterland #define	TAG_COND_ZONE_NAME	"zoneName"
4925c51f124SMoriah Waterland #define	TAG_COND_ZONE_TYPE	"zoneType"
4935c51f124SMoriah Waterland #define	TAG_COND_FS_NAME	"fileSystemName"
4945c51f124SMoriah Waterland #define	TAG_VALUE_GLOBAL_ZONE	"global"
4955c51f124SMoriah Waterland #define	TAG_VALUE_NONGLOBAL_ZONE	"nonglobal"
4965c51f124SMoriah Waterland 
4975c51f124SMoriah Waterland typedef struct _sml_tag_struct SML_TAG;
4985c51f124SMoriah Waterland typedef struct _sml_parameter_struct SML_PARAM;
4995c51f124SMoriah Waterland 
5005c51f124SMoriah Waterland struct _sml_tag_struct {
5015c51f124SMoriah Waterland 	char		*name;		/* tag name */
5025c51f124SMoriah Waterland 	int		params_num;	/* # params in *params */
5035c51f124SMoriah Waterland 	SML_PARAM	*params;	/* tag parameters */
5045c51f124SMoriah Waterland 	int		tags_num;	/* # subtags in *tags */
5055c51f124SMoriah Waterland 	SML_TAG		*tags;		/* tag subtags */
5065c51f124SMoriah Waterland };
5075c51f124SMoriah Waterland 
5085c51f124SMoriah Waterland struct _sml_parameter_struct {
5095c51f124SMoriah Waterland 	char	*name;		/* tag name */
5105c51f124SMoriah Waterland 	char	*value;		/* parameters */
5115c51f124SMoriah Waterland };
5125c51f124SMoriah Waterland 
5135c51f124SMoriah Waterland SML_TAG		*smlAddTag(SML_TAG **r_tag, int a_index,
5145c51f124SMoriah Waterland 			SML_TAG *a_subTag);
5155c51f124SMoriah Waterland boolean_t	smlFstatCompareEq(struct stat *statbuf,
5165c51f124SMoriah Waterland 				SML_TAG *tag, char *path);
5175c51f124SMoriah Waterland char		*smlConvertTagToString(SML_TAG *tag);
5185c51f124SMoriah Waterland /*PRINTFLIKE2*/
5195c51f124SMoriah Waterland void		smlDbgPrintTag(SML_TAG *a_tag, char *a_format, ...);
5205c51f124SMoriah Waterland void		smlDelTag(SML_TAG *tag, SML_TAG *sub_tag);
5215c51f124SMoriah Waterland void		smlDelParam(SML_TAG *tag, char *name);
5225c51f124SMoriah Waterland SML_TAG		*smlDup(SML_TAG *tag);
5235c51f124SMoriah Waterland boolean_t	smlFindAndDelTag(SML_TAG *tag, char *findTag);
5245c51f124SMoriah Waterland void		smlFreeTag(SML_TAG *tag);
5255c51f124SMoriah Waterland char		*smlGetElementName(SML_TAG *a_tag);
5265c51f124SMoriah Waterland int		smlGetNumParams(SML_TAG *a_tag);
5275c51f124SMoriah Waterland char		*smlGetParam(SML_TAG *tag, char *name);
5285c51f124SMoriah Waterland /*PRINTFLIKE2*/
5295c51f124SMoriah Waterland char		*smlGetParamF(SML_TAG *tag, char *format, ...);
5305c51f124SMoriah Waterland void		smlGetParam_r(SML_TAG *tag, char *name, char *buf,
5315c51f124SMoriah Waterland 			int bufLen);
5325c51f124SMoriah Waterland char		*smlGetParamByTag(SML_TAG *tag, int index,
5335c51f124SMoriah Waterland 			char *tagName, char *parmName);
5345c51f124SMoriah Waterland char		*smlGetParamByTagParam(SML_TAG *tag, int index,
5355c51f124SMoriah Waterland 			char *tagName, char *parmName, char *parmValue,
5365c51f124SMoriah Waterland 			char *parmReturn);
5375c51f124SMoriah Waterland char		*smlGetParamName(SML_TAG *tag, int index);
5385c51f124SMoriah Waterland SML_TAG		*smlGetTag(SML_TAG *tag, int index);
5395c51f124SMoriah Waterland SML_TAG		*smlGetTagByName(SML_TAG *tag, int index, char *name);
5405c51f124SMoriah Waterland SML_TAG		*smlGetTagByTagParam(SML_TAG *tag, int index,
5415c51f124SMoriah Waterland 			char *tagName, char *paramName, char *paramValue);
5425c51f124SMoriah Waterland boolean_t	smlGetVerbose(void);
5435c51f124SMoriah Waterland int		smlLoadTagFromFile(SML_TAG **r_tag, char *a_fileName);
5445c51f124SMoriah Waterland SML_TAG		*smlNewTag(char *name);
5455c51f124SMoriah Waterland boolean_t	smlParamEq(SML_TAG *tag, char *findTag,
5465c51f124SMoriah Waterland 			char *findParam, char *str);
5475c51f124SMoriah Waterland /*PRINTFLIKE4*/
5485c51f124SMoriah Waterland boolean_t	smlParamEqF(SML_TAG *tag, char *findTag, char *findParam,
5495c51f124SMoriah Waterland 			char *format, ...);
5505c51f124SMoriah Waterland void		smlPrintTag(SML_TAG *tag);
5515c51f124SMoriah Waterland int		smlReadOneTag(SML_TAG **r_tag, char *a_str);
5525c51f124SMoriah Waterland int		smlConvertStringToTag(SML_TAG **r_tag, char *str);
5535c51f124SMoriah Waterland void		smlSetFileStatInfo(SML_TAG **tag,
5545c51f124SMoriah Waterland 				struct stat *statbuf, char *path);
5555c51f124SMoriah Waterland void		smlSetParam(SML_TAG *tag, char *name, char *value);
5565c51f124SMoriah Waterland /*PRINTFLIKE3*/
5575c51f124SMoriah Waterland void		smlSetParamF(SML_TAG *tag, char *name, char *format, ...);
5585c51f124SMoriah Waterland void		smlSetVerbose(boolean_t a_setting);
5595c51f124SMoriah Waterland int		smlWriteTagToFd(SML_TAG *tag, int fd);
5605c51f124SMoriah Waterland int		smlWriteTagToFile(SML_TAG *tag, char *filename);
5615c51f124SMoriah Waterland /*PRINTFLIKE3*/
5625c51f124SMoriah Waterland void		sml_strPrintf_r(char *a_buf, int a_bufLen, char *a_format, ...);
5635c51f124SMoriah Waterland /*PRINTFLIKE1*/
5645c51f124SMoriah Waterland char 		*sml_strPrintf(char *a_format, ...);
5655c51f124SMoriah Waterland char		*sml_XmlEncodeString(char *a_plainTextString);
5665c51f124SMoriah Waterland char		*sml_XmlDecodeString(char *a_xmlEncodedString);
5675c51f124SMoriah Waterland 
5685c51f124SMoriah Waterland #if defined(lint) && !defined(gettext)
5695c51f124SMoriah Waterland #define	gettext(x)	x
5705c51f124SMoriah Waterland #endif	/* defined(lint) && !defined(gettext) */
5715c51f124SMoriah Waterland 
5725c51f124SMoriah Waterland #ifdef __cplusplus
5735c51f124SMoriah Waterland }
5745c51f124SMoriah Waterland #endif
5755c51f124SMoriah Waterland 
5765c51f124SMoriah Waterland #endif	/* __HDRS_LIBINST_H__ */