xref: /titanic_41/usr/src/lib/libpkg/common/pkglib.h (revision b509e89b2befbaa42939abad9da1d7f5a8c6aaae)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29 
30 #ifndef	_PKGLIB_H
31 #define	_PKGLIB_H
32 
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #include <sys/types.h>
39 #include <limits.h>
40 #include <stdio.h>
41 #include <pkgdev.h>
42 #include <pkgstrct.h>
43 #include <openssl/bio.h>
44 #include <openssl/x509.h>
45 #include <netdb.h>
46 #include <boot_http.h>
47 #include "pkgerr.h"
48 #include "keystore.h"
49 #include "cfext.h"
50 
51 /*
52  * Virtual File Protocol definitions
53  */
54 
55 /*
56  * flags associated with virtual file protocol operations; note that these flags
57  * may only occupy the low order 16 bits of the 32-bit unsigned flag.
58  */
59 
60 typedef unsigned long VFPFLAGS_T;
61 
62 #define	VFP_NONE	0x00000000	/* no special flags */
63 #define	VFP_NEEDNOW	0x00000001	/* need memory now */
64 #define	VFP_SEQUENTIAL	0x00000002	/* sequential access */
65 #define	VFP_RANDOM	0x00000004	/* random access */
66 #define	VFP_NOMMAP	0x00000008	/* do not use mmap to access file */
67 #define	VFP_NOMALLOC	0x00000010	/* do not use malloc to buffer file */
68 
69 /* virtual file protocol object */
70 
71 typedef struct _vfp VFP_T;
72 
73 /* structure behind the virtual file protocol object */
74 
75 struct _vfp {
76 	FILE		*_vfpFile;	/* -> opened FILE */
77 	char		*_vfpCurr;	/* -> current byte to read/write */
78 	char		*_vfpHighWater;	/* -> last byte modified */
79 	char		*_vfpEnd;	/* -> last data byte */
80 	char		*_vfpPath;	/* -> path associated with FILE */
81 	char		*_vfpStart;	/* -> first data byte */
82 	void		*_vfpExtra;	/* undefined */
83 	size_t		_vfpSize;	/* size of mapped/allocated area */
84 	size_t		_vfpMapSize;	/* # mapped bytes */
85 	VFPFLAGS_T	_vfpFlags;	/* flags associated with vfp/data */
86 	int		_vfpOverflow;	/* non-zero if buffer write overflow */
87 	blkcnt_t	_vfpCkStBlocks;	/* checkpoint # blocks */
88 	dev_t		_vfpCkDev;	/* checkpoint device i.d. */
89 	ino_t		_vfpCkIno;	/* checkpoint inode # */
90 	off_t		_vfpCkSize;	/* checkpoint size */
91 	time_t		_vfpCkMtime;	/* checkpoint modification time */
92 };
93 
94 /*
95  * get highest modified byte (length) contained in vfp
96  *
97  * determine number of bytes to write - it will be the highest of:
98  *  -- the current pointer into the file - this is updated whenever
99  *	the location of the file is changed by a single byte
100  *  -- the last "high water mark" - the last known location that
101  *	was written to the file - updated only when the location
102  *	of the file is directly changed - e.g. vfpSetCurrCharPtr,
103  *	vfpTruncate, vfpRewind.
104  * this reduces the "bookkeeping" that needs to be done to know
105  * how many bytes to write out to the file - typically a file is
106  * written sequentially so the current file pointer is sufficient
107  * to determine how many bytes to write out.
108  */
109 
110 #define	vfpGetModifiedLen(VFP)						\
111 	(size_t)(((VFP)->_vfpHighWater > (VFP)->_vfpCurr) ?		\
112 		(((ptrdiff_t)(VFP)->_vfpHighWater -			\
113 				(ptrdiff_t)(VFP)->_vfpStart)) :		\
114 		(((ptrdiff_t)(VFP)->_vfpCurr -				\
115 				(ptrdiff_t)(VFP)->_vfpStart)))
116 
117 /*
118  * increment current pointer by specified delta
119  * if the delta exceeds the buffer size, set pointer to buffer end
120  */
121 #define	vfpIncCurrPtrBy(VFP, INC)					\
122 	{								\
123 		((VFP)->_vfpCurr) += (INC);				\
124 		if (((VFP)->_vfpCurr) > ((VFP)->_vfpEnd)) {		\
125 			(VFP)->_vfpCurr = (VFP)->_vfpEnd;		\
126 			(VFP)->_vfpOverflow = 1;			\
127 		}							\
128 		if ((VFP)->_vfpHighWater < (VFP)->_vfpCurr) {		\
129 			(VFP)->_vfpHighWater = (VFP)->_vfpCurr;		\
130 		}							\
131 	}
132 
133 /* get the path associated with the vfp */
134 #define	vfpGetPath(VFP)		((VFP)->_vfpPath)
135 
136 /* get a string from the vfp into a fixed size buffer */
137 #define	vfpGets(VFP, PTR, LEN)						\
138 	{								\
139 		char	*XXpXX = (PTR);					\
140 		size_t	XXlXX = (LEN);					\
141 		while ((*(VFP)->_vfpCurr != '\0') &&			\
142 				(*(VFP)->_vfpCurr != '\n')) {		\
143 			if (XXlXX > 1) {				\
144 				*XXpXX++ = *(VFP)->_vfpCurr;		\
145 				XXlXX--;				\
146 			}						\
147 			(VFP)->_vfpCurr++;				\
148 		}							\
149 		*XXpXX++ = '\0';					\
150 		if (*(VFP)->_vfpCurr != '\0') {				\
151 			(VFP)->_vfpCurr++;				\
152 		}							\
153 	}
154 
155 /* get number of bytes remaining to read */
156 #define	vfpGetBytesRemaining(VFP)	\
157 	(((((VFP)->_vfpHighWater) <= ((VFP)->_vfpCurr))) ? 0 : 		\
158 	((((ptrdiff_t)(VFP)->_vfpHighWater)-((ptrdiff_t)(VFP)->_vfpCurr))))
159 
160 /* get number of bytes remaining to write */
161 #define	vfpGetBytesAvailable(VFP)	\
162 	(((((VFP)->_vfpEnd) <= ((VFP)->_vfpCurr))) ? 0 : 		\
163 	((((ptrdiff_t)(VFP)->_vfpEnd)-((ptrdiff_t)(VFP)->_vfpCurr))))
164 
165 /* put current character and increment to next */
166 #define	vfpPutc(VFP, C)							\
167 	{								\
168 		(*(VFP)->_vfpCurr) = ((char)(C));			\
169 		vfpIncCurrPtrBy((VFP), 1);				\
170 	}
171 
172 /* put integer to current character and increment */
173 #define	vfpPutInteger(VFP, NUMBER)	vfpPutFormat((VFP), "%d", (NUMBER))
174 
175 /* put long to current character and increment */
176 #define	vfpPutLong(VFP, NUMBER)	vfpPutFormat((VFP), "%ld", (NUMBER))
177 
178 /* get current character and increment to next */
179 #define	vfpGetc(VFP)		(*(VFP)->_vfpCurr++)
180 
181 /* get current character - do not increment */
182 #define	vfpGetcNoInc(VFP)	(*(VFP)->_vfpCurr)
183 
184 /* get pointer to current character */
185 #define	vfpGetCurrCharPtr(VFP)	((VFP)->_vfpCurr)
186 
187 /* increment current character pointer */
188 #define	vfpIncCurrPtr(VFP)	vfpIncCurrPtrBy((VFP), 1)
189 
190 /* decrement current character pointer */
191 #define	vfpDecCurrPtr(VFP)	((VFP)->_vfpCurr--)
192 
193 /* get pointer to first data byte in buffer */
194 #define	vfpGetFirstCharPtr(VFP)	((VFP)->_vfpStart)
195 
196 /* get pointer to last data byte in buffer */
197 #define	vfpGetLastCharPtr(VFP)	((VFP)->_vfpHighWater)
198 
199 /* set pointer to current character */
200 #define	vfpSetCurrCharPtr(VFP, PTR)					\
201 	if ((VFP)->_vfpCurr > (VFP)->_vfpHighWater) {			\
202 		(VFP)->_vfpHighWater = (VFP)->_vfpCurr;			\
203 	}								\
204 	((VFP)->_vfpCurr = (PTR))
205 
206 /* set pointer to last data byte in buffer */
207 #define	vfpSetLastCharPtr(VFP, PTR)					\
208 	if ((PTR) >= (VFP)->_vfpStart) {				\
209 		(VFP)->_vfpHighWater = (PTR);				\
210 		if ((VFP)->_vfpCurr > (VFP)->_vfpHighWater) {		\
211 			(VFP)->_vfpCurr = (VFP)->_vfpHighWater;		\
212 		}							\
213 	}
214 
215 /* seek to end of file - one past last data byte in file */
216 #define	vfpSeekToEnd(VFP)	((VFP)->_vfpCurr = ((VFP)->_vfpHighWater)+1)
217 
218 /* get number of bytes between current char and specified char */
219 #define	vfpGetCurrPtrDelta(VFP, P)	\
220 	(((ptrdiff_t)(P))-((ptrdiff_t)(VFP)->_vfpCurr))
221 
222 /* put string to current character and increment */
223 #define	vfpPuts(VFP, S)							\
224 	{								\
225 		size_t	xxLen;						\
226 		size_t	xxResult;					\
227 		xxLen = vfpGetBytesAvailable((VFP));			\
228 		xxResult = strlcpy(((VFP)->_vfpCurr), (S), xxLen);	\
229 		vfpIncCurrPtrBy((VFP), xxResult);			\
230 	}
231 
232 /* put fixed number of bytes to current character and increment */
233 #define	vfpPutBytes(VFP, PTR, LEN)					\
234 	{								\
235 		size_t	xxLen;						\
236 		xxLen = vfpGetBytesAvailable((VFP));			\
237 		if (xxLen > (LEN)) {					\
238 			xxLen = (LEN);					\
239 		} else {						\
240 			(VFP)->_vfpOverflow = 1;			\
241 		}							\
242 		memcpy((VFP)->_vfpCurr, (PTR), (xxLen));		\
243 		vfpIncCurrPtrBy((VFP), (xxLen));			\
244 	}
245 
246 /* put format one arg to current character and increment */
247 #define	vfpPutFormat(VFP, FORMAT, ARG)					\
248 	{								\
249 	char	xxTeMpXX[256];						\
250 	(void) snprintf(xxTeMpXX, sizeof (xxTeMpXX), (FORMAT), (ARG));	\
251 	vfpPuts((VFP), xxTeMpXX);					\
252 	}
253 
254 struct dm_buf {
255 	char *text_buffer;	/* start of allocated buffer */
256 	int offset;		/* number of bytes into the text_buffer */
257 	int allocation;		/* size of buffer in bytes */
258 };
259 
260 /* This structure is used to hold a dynamically growing string */
261 
262 struct dstr {
263 	char *pc;
264 	int   len;
265 	int   max;
266 };
267 
268 /* setmapmode() defines */
269 #define	MAPALL		0	/* resolve all variables */
270 #define	MAPBUILD	1	/* map only build variables */
271 #define	MAPINSTALL	2	/* map only install variables */
272 #define	MAPNONE		3	/* map no variables */
273 
274 #define	NON_ABI_NAMELNGTH	33	/* 32 chars for name + 1 for NULL */
275 
276 #define	BLK_SIZE	512	/* size of logical block */
277 
278 /* max length for printed attributes */
279 #define	ATTR_MAX	80
280 
281 /*
282  * These three defines indicate that the prototype file contains a '?'
283  * meaning do not specify this data in the pkgmap entry.
284  */
285 #define	CURMODE		BADMODE		/* current mode has been specified */
286 #define	CUROWNER	BADOWNER	/* ... same for owner ... */
287 #define	CURGROUP	BADGROUP	/* ... and group. */
288 
289 #define	WILDCARD		BADMODE >> 1
290 #define	DB_UNDEFINED_ENTRY	"?"
291 
292 #define	DEFAULT_MODE		0755
293 #define	DEFAULT_MODE_FILE	0644
294 #define	DEFAULT_OWNER	"root"
295 #define	DEFAULT_GROUP	"other"
296 
297 #define	INST_RELEASE "var/sadm/system/admin/INST_RELEASE"
298 
299 #define	RANDOM			"/dev/urandom"
300 #define	BLOCK			256
301 
302 #define	TERM_WIDTH		60
303 #define	SMALL_DIVISOR		4
304 #define	MED_DIVISOR		5
305 #define	LARGE_DIVISOR		10
306 #define	MED_DWNLD		(10 * 1024 * 1024) /* 10 MB */
307 #define	LARGE_DWNLD		(5 * MED_DWNLD) /* 50 MB */
308 
309 #define	HTTP			"http://"
310 #define	HTTPS			"https://"
311 
312 #define	PKGADD			"pkgadd"
313 
314 /* Settings for network admin defaults */
315 
316 #define	NET_TIMEOUT_DEFAULT 	60
317 #define	NET_RETRIES_DEFAULT 	3
318 #define	NET_TIMEOUT_MIN		1		/* 1 second */
319 #define	NET_TIMEOUT_MAX		(5 * 60)	/* 5 minutes */
320 #define	NET_RETRIES_MIN		1
321 #define	NET_RETRIES_MAX		10
322 #define	AUTH_NOCHECK		0
323 #define	AUTH_QUIT		1
324 
325 /* package header magic tokens */
326 #define	HDR_PREFIX	"# PaCkAgE DaTaStReAm"
327 #define	HDR_SUFFIX	"# end of header"
328 
329 /* name of security files */
330 #define	PKGSEC		"/var/sadm/security"
331 #define	SIGNATURE_FILENAME	"signature"
332 
333 #define	GROUP	"/etc/group"
334 #define	PASSWD	"/etc/passwd"
335 
336 /*
337  * The next three mean that no mode, owner or group was specified or that the
338  * one specified is invalid for some reason. Sometimes this is an error in
339  * which case it is generally converted to CUR* with a warning. Other times
340  * it means "look it up" by stating the existing file system object pointred
341  * to in the prototype file.
342  */
343 #define	NOMODE		(BADMODE-1)
344 #define	NOOWNER		"@"
345 #define	NOGROUP		"@"
346 
347 /* string comparitor abbreviators */
348 
349 #define	ci_streq(a, b)		(strcasecmp((a), (b)) == 0)
350 #define	ci_strneq(a, b, c)	(strncasecmp((a), (b), (c)) == 0)
351 #define	streq(a, b)		(strcmp((a), (b)) == 0)
352 #define	strneq(a, b, c)		(strncmp((a), (b), (c)) == 0)
353 
354 #ifdef	__STDC__
355 
356 extern FILE	*epopen(char *cmd, char *mode);
357 extern char	**gpkglist(char *dir, char **pkg, char **catg);
358 extern int	is_not_valid_length(char **category);
359 extern int	is_not_valid_category(char **category, char *progname);
360 extern int	is_same_CATEGORY(char **category, char *installed_category);
361 extern char **get_categories(char *catg_arg);
362 
363 extern void	pkglist_cont(char *keyword);
364 extern char	**pkgalias(char *pkg);
365 extern char	*get_prog_name(void);
366 extern char 	*set_prog_name(char *name);
367 extern int	averify(int fix, char *ftype, char *path, struct ainfo *ainfo);
368 extern int	ckparam(char *param, char *value);
369 extern int	ckvolseq(char *dir, int part, int nparts);
370 extern int	cverify(int fix, char *ftype, char *path, struct cinfo *cinfo,
371 			int allow_checksum);
372 extern unsigned long	compute_checksum(int *r_cksumerr, char *a_path);
373 extern int	fverify(int fix, char *ftype, char *path, struct ainfo *ainfo,
374 		    struct cinfo *cinfo);
375 extern char	*getErrbufAddr(void);
376 extern int	getErrbufSize(void);
377 extern char	*getErrstr(void);
378 extern void	setErrstr(char *errstr);
379 extern int	devtype(char *alias, struct pkgdev *devp);
380 extern int	ds_totread;	/* total number of parts read */
381 extern int	ds_close(int pkgendflg);
382 extern int	ds_findpkg(char *device, char *pkg);
383 extern int	ds_getinfo(char *string);
384 extern int	ds_getpkg(char *device, int n, char *dstdir);
385 extern int	ds_ginit(char *device);
386 extern boolean_t	ds_fd_open(void);
387 extern int	ds_init(char *device, char **pkg, char *norewind);
388 extern int	BIO_ds_dump_header(PKG_ERR *, BIO *);
389 extern int	BIO_ds_dump(PKG_ERR *, char *, BIO *);
390 extern int	BIO_dump_cmd(char *cmd, BIO *bio);
391 extern int	ds_next(char *, char *);
392 extern int	ds_readbuf(char *device);
393 extern int	epclose(FILE *pp);
394 extern int	esystem(char *cmd, int ifd, int ofd);
395 extern int	e_ExecCmdArray(int *r_status, char **r_results,
396 			char *a_inputFile, char *a_cmd, char **a_args);
397 extern int	e_ExecCmdList(int *r_status, char **r_results,
398 			char *a_inputFile, char *a_cmd, ...);
399 extern int	gpkgmap(struct cfent *ept, FILE *fp);
400 extern int	gpkgmapvfp(struct cfent *ept, VFP_T *fpv);
401 extern void	setmapmode(int mode_no);
402 extern int	isFdRemote(int a_fd);
403 extern int	isFstypeRemote(char *a_fstype);
404 extern int	isPathRemote(char *a_path);
405 extern int	iscpio(char *path, int *iscomp);
406 extern int	isdir(char *path);
407 extern int	isfile(char *dir, char *file);
408 extern int	fmkdir(char *a_path, int a_mode);
409 extern int	pkgexecl(char *filein, char *fileout, char *uname, char *gname,
410 			...);
411 extern int	pkgexecv(char *filein, char *fileout, char *uname, char *gname,
412 			char *arg[]);
413 extern int	pkghead(char *device);
414 extern int	pkgmount(struct pkgdev *devp, char *pkg, int part, int nparts,
415 			int getvolflg);
416 extern int	pkgtrans(char *device1, char *device2, char **pkg,
417 			int options, keystore_handle_t, char *);
418 extern int	pkgumount(struct pkgdev *devp);
419 extern int	ppkgmap(struct cfent *ept, FILE *fp);
420 extern int	putcfile(struct cfent *ept, FILE *fp);
421 extern int	putcvfpfile(struct cfent *ept, VFP_T *vfp);
422 extern int	rrmdir(char *path);
423 extern void	set_memalloc_failure_func(void (*)(int));
424 extern void	*xmalloc(size_t size);
425 extern void	*xrealloc(void *ptr, size_t size);
426 extern char	*xstrdup(char *str);
427 extern void	set_passphrase_prompt(char *);
428 extern void	set_passphrase_passarg(char *);
429 extern int	pkg_passphrase_cb(char *, int, int, void *);
430 
431 extern int	srchcfile(struct cfent *ept, char *path, VFP_T *vfp,
432 			VFP_T *vfpout);
433 extern struct	group *cgrgid(gid_t gid);
434 extern struct	group *cgrnam(char *nam);
435 extern struct	passwd *cpwnam(char *nam);
436 extern struct	passwd *cpwuid(uid_t uid);
437 extern struct	group *clgrgid(gid_t gid);
438 extern struct	group *clgrnam(char *nam);
439 extern struct	passwd *clpwnam(char *nam);
440 extern struct	passwd *clpwuid(uid_t uid);
441 extern void	basepath(char *path, char *basedir, char *ir);
442 extern void	canonize(char *file);
443 extern void	canonize_slashes(char *file);
444 extern void	checksum_off(void);
445 extern void	checksum_on(void);
446 extern void	cvtpath(char *path, char *copy);
447 extern void	ds_order(char *list[]);
448 extern void	ds_putinfo(char *buf);
449 extern void	ds_skiptoend(char *device);
450 extern void	ecleanup(void);
451 /*PRINTFLIKE1*/
452 extern void	logerr(char *fmt, ...);
453 extern int	mappath(int flag, char *path);
454 extern int	mapvar(int flag, char *varname);
455 /*PRINTFLIKE1*/
456 extern void	progerr(char *fmt, ...);
457 extern void	pkgerr(PKG_ERR *);
458 extern void	rpterr(void);
459 extern void	tputcfent(struct cfent *ept, FILE *fp);
460 extern void	set_nonABI_symlinks(void);
461 extern int	nonABI_symlinks(void);
462 extern void	disable_attribute_check(void);
463 extern int	get_disable_attribute_check(void);
464 
465 /* security.c */
466 extern void	sec_init(void);
467 extern char	*get_subject_display_name(X509 *);
468 extern char	*get_issuer_display_name(X509 *);
469 extern char	*get_serial_num(X509 *);
470 extern char	*get_fingerprint(X509 *, const EVP_MD *);
471 extern int	get_cert_chain(PKG_ERR *, X509 *, STACK_OF(X509) *,
472     STACK_OF(X509) *, STACK_OF(X509) **);
473 
474 /* pkgstr.c */
475 void		pkgstrConvertUllToTimeString_r(unsigned long long a_time,
476 			char *a_buf, int a_bufLen);
477 char		*pkgstrConvertPathToBasename(char *a_path);
478 char		*pkgstrConvertPathToDirname(char *a_path);
479 char		*pkgstrDup(char *a_str);
480 char		*pkgstrLocatePathBasename(char *a_path);
481 void		pkgstrScaleNumericString(char *a_buf, unsigned long long scale);
482 void		pkgstrAddToken(char **a_old, char *a_new, char a_separator);
483 boolean_t	pkgstrContainsToken(char *a_string, char *a_token,
484 			char *a_separators);
485 void		pkgstrExpandTokens(char **a_old, char *a_string,
486 			char a_separator, char *a_separators);
487 char		*pkgstrGetToken(char *r_sep, char *a_string, int a_index,
488 			char *a_separators);
489 void		pkgstrGetToken_r(char *r_sep, char *a_string, int a_index,
490 			char *a_separators, char *a_buf, int a_bufLen);
491 unsigned long	pkgstrNumTokens(char *a_string, char *a_separators);
492 char		*pkgstrPrintf(char *a_format, ...);
493 void		pkgstrPrintf_r(char *a_buf, int a_bufLen, char *a_format, ...);
494 void		pkgstrRemoveToken(char **r_string, char *a_token,
495 			char *a_separators, int a_index);
496 void		pkgstrRemoveLeadingWhitespace(char **a_str);
497 /* vfpops.c */
498 extern int	vfpCheckpointFile(VFP_T **r_destVfp, VFP_T **a_vfp,
499 			char *a_path);
500 extern int	vfpCheckpointOpen(VFP_T **a_cvfp, VFP_T **r_vfp, char *a_path,
501 			char *a_mode, VFPFLAGS_T a_flags);
502 extern int	vfpClearModified(VFP_T *a_vfp);
503 extern int	vfpClose(VFP_T **r_vfp);
504 extern int	vfpGetModified(VFP_T *a_vfp);
505 extern int	vfpOpen(VFP_T **r_vfp, char *a_path, char *a_mode,
506 			VFPFLAGS_T a_flags);
507 extern void	vfpRewind(VFP_T *a_vfp);
508 extern ssize_t	vfpSafePwrite(int a_fildes, void *a_buf,
509 			size_t a_nbyte, off_t a_offset);
510 extern ssize_t	vfpSafeWrite(int a_fildes, void *a_buf, size_t a_nbyte);
511 extern int	vfpSetFlags(VFP_T *a_vfp, VFPFLAGS_T a_flags);
512 extern int	vfpSetModified(VFP_T *a_vfp);
513 extern int	vfpSetSize(VFP_T *a_vfp, size_t a_size);
514 extern void	vfpTruncate(VFP_T *a_vfp);
515 extern int	vfpWriteToFile(VFP_T *a_vfp, char *a_path);
516 
517 /* handlelocalfs.c */
518 boolean_t	enable_local_fs(void);
519 boolean_t	restore_local_fs(void);
520 
521 #else	/* __STDC__ */
522 
523 extern FILE	*epopen();
524 extern void	pkglist_cont();
525 extern char	**gpkglist();
526 extern char	**pkgalias();
527 extern char	*get_prog_name();
528 extern char 	*set_prog_name();
529 extern int	averify();
530 extern int	ckparam();
531 extern int	ckvolseq();
532 extern int	cverify();
533 extern unsigned long	compute_checksum();
534 extern int	fverify();
535 extern char	*getErrbufAddr();
536 extern int	getErrbufSize();
537 extern char	*getErrstr();
538 extern void	setErrstr();
539 extern int	devtype();
540 extern int	ds_close();
541 extern int	ds_findpkg();
542 extern int	ds_getinfo();
543 extern int	ds_getpkg();
544 extern int	ds_ginit();
545 extern boolean_t	ds_fd_open();
546 extern int	ds_init();
547 extern int	ds_next();
548 extern int	ds_readbuf();
549 extern int	epclose();
550 extern int	esystem();
551 extern int	e_ExecCmdArray();
552 extern int	e_ExecCmdList();
553 extern int	gpkgmap();
554 extern int	isFdRemote();
555 extern int	isFstypeRemote();
556 extern int	isPathRemote();
557 extern int	iscpio();
558 extern int	isdir();
559 extern int	isfile();
560 extern int	pkgexecl();
561 extern int	pkgexecv();
562 extern int	pkghead();
563 extern int	pkgmount();
564 extern int	pkgtrans();
565 extern int	pkgumount();
566 extern int	ppkgmap();
567 extern int	putcfile();
568 extern int	putcvfpfile();
569 extern int	rrmdir();
570 extern int	srchcfile();
571 extern struct	group *cgrgid();
572 extern struct	group *cgrnam();
573 extern struct	passwd *cpwnam();
574 extern struct	passwd *cpwuid();
575 extern void	basepath();
576 extern void	canonize();
577 extern void	canonize_slashes();
578 extern void	checksum_off();
579 extern void	checksum_on();
580 extern void	cvtpath();
581 extern void	ds_order();
582 extern void	ds_putinfo();
583 extern void	ds_skiptoend();
584 extern void	ecleanup();
585 extern void	logerr();
586 extern int	mappath();
587 extern int	mapvar();
588 extern void	progerr();
589 extern void	rpterr();
590 extern void	tputcfent();
591 extern void	set_nonABI_symlinks();
592 extern int	nonABI_symlinks();
593 extern void	disable_attribute_check();
594 extern int	get_disable_attribute_check();
595 /* vfpops.c */
596 extern int	vfpCheckpointFile();
597 extern int	vfpCheckpointOpen();
598 extern int	vfpClearModified();
599 extern int	vfpClose();
600 extern int	vfpGetModified();
601 extern int	vfpOpen();
602 extern void	vfpRewind();
603 extern int	vfpSetFlags();
604 extern int	vfpSetModified();
605 extern int	vfpSetSize();
606 extern void	vfpTruncate();
607 extern int	vfpWriteToFile();
608 
609 /* handlelocalfs.c */
610 boolean_t	enable_local_fs();
611 boolean_t	restore_local_fs();
612 
613 /* gpkgmap.c */
614 int		getmapmode(void);
615 
616 #endif	/* __STDC__ */
617 
618 #ifdef	__cplusplus
619 }
620 #endif
621 
622 #endif	/* _PKGLIB_H */
623