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