xref: /onnv-gate/usr/src/cmd/sgs/crle/common/print.c (revision 1976:f0691a145b7e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51618Srie  * Common Development and Distribution License (the "License").
61618Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211618Srie 
220Sstevel@tonic-gate /*
231618Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #include	<sys/types.h>
290Sstevel@tonic-gate #include	<sys/stat.h>
300Sstevel@tonic-gate #include	<sys/mman.h>
310Sstevel@tonic-gate #include	<fcntl.h>
320Sstevel@tonic-gate #include	<stdio.h>
330Sstevel@tonic-gate #include	<string.h>
340Sstevel@tonic-gate #include	<unistd.h>
350Sstevel@tonic-gate #include	<errno.h>
360Sstevel@tonic-gate #include	<limits.h>
370Sstevel@tonic-gate #include	<alloca.h>
380Sstevel@tonic-gate #include	"sgs.h"
390Sstevel@tonic-gate #include	"rtc.h"
400Sstevel@tonic-gate #include	"conv.h"
410Sstevel@tonic-gate #include	"_crle.h"
420Sstevel@tonic-gate #include	"msg.h"
430Sstevel@tonic-gate 
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Display the command line required to regenerate the configuration file.
470Sstevel@tonic-gate  *
480Sstevel@tonic-gate  * Under normal mode the command is printed on one line to make it more
490Sstevel@tonic-gate  * available for grep(1) use.  Under verbose mode the command is separated
500Sstevel@tonic-gate  * into each argument (a little more readable perhaps when the arguments are
510Sstevel@tonic-gate  * numerous of have long pathnames).
520Sstevel@tonic-gate  *
530Sstevel@tonic-gate  * Note that for version 1 configuration files we never used to generate any
540Sstevel@tonic-gate  * command-line information, and as the attempt to do so is only a best effort
550Sstevel@tonic-gate  * don't bother printing anything.
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate static void
580Sstevel@tonic-gate printcmd(Crle_desc * crle, Rtc_head * head, List * cmdline)
590Sstevel@tonic-gate {
600Sstevel@tonic-gate 	Listnode	*lnp;
610Sstevel@tonic-gate 	const char	*fmto, *fmtb, *fmtm, *fmte;
620Sstevel@tonic-gate 	char		*cmd;
630Sstevel@tonic-gate 	int		output = 0;
640Sstevel@tonic-gate 
650Sstevel@tonic-gate 	if (crle->c_flags & CRLE_VERBOSE) {
660Sstevel@tonic-gate 		fmto = MSG_INTL(MSG_DMP_CMD_ONE_V);
670Sstevel@tonic-gate 		fmtb = MSG_INTL(MSG_DMP_CMD_BGN_V);
680Sstevel@tonic-gate 		fmtm = MSG_INTL(MSG_DMP_CMD_MID_V);
690Sstevel@tonic-gate 		fmte = MSG_INTL(MSG_DMP_CMD_END_V);
700Sstevel@tonic-gate 
710Sstevel@tonic-gate 	} else if (head->ch_version > RTC_VER_ONE) {
720Sstevel@tonic-gate 		fmto = MSG_INTL(MSG_DMP_CMD_ONE);
730Sstevel@tonic-gate 		fmtb = MSG_INTL(MSG_DMP_CMD_BGN);
740Sstevel@tonic-gate 		fmtm = MSG_INTL(MSG_DMP_CMD_MID);
750Sstevel@tonic-gate 		fmte = MSG_INTL(MSG_DMP_CMD_END);
760Sstevel@tonic-gate 
770Sstevel@tonic-gate 	} else {
780Sstevel@tonic-gate 		(void) printf(MSG_ORIG(MSG_STR_NL));
790Sstevel@tonic-gate 		return;
800Sstevel@tonic-gate 	}
810Sstevel@tonic-gate 
820Sstevel@tonic-gate 	(void) printf(MSG_INTL(MSG_DMP_CMD_TITLE));
830Sstevel@tonic-gate 	for (LIST_TRAVERSE(cmdline, lnp, cmd)) {
840Sstevel@tonic-gate 		if (output++ == 0) {
850Sstevel@tonic-gate 			if (lnp->next)
860Sstevel@tonic-gate 				(void) printf(fmtb, cmd);
870Sstevel@tonic-gate 			else
880Sstevel@tonic-gate 				(void) printf(fmto, cmd);
890Sstevel@tonic-gate 		} else {
900Sstevel@tonic-gate 			if (lnp->next)
910Sstevel@tonic-gate 				(void) printf(fmtm, cmd);
920Sstevel@tonic-gate 			else
930Sstevel@tonic-gate 				(void) printf(fmte, cmd);
940Sstevel@tonic-gate 		}
950Sstevel@tonic-gate 	}
960Sstevel@tonic-gate }
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /*
990Sstevel@tonic-gate  * Establish the argument required to generate the associated object.
1000Sstevel@tonic-gate  */
1010Sstevel@tonic-gate static const char *
1020Sstevel@tonic-gate getformat(Half flags)
1030Sstevel@tonic-gate {
1040Sstevel@tonic-gate 	if (flags & RTC_OBJ_ALTER) {
1050Sstevel@tonic-gate 		if (flags & RTC_OBJ_DUMP) {
1060Sstevel@tonic-gate 			if (flags & RTC_OBJ_GROUP)
1070Sstevel@tonic-gate 				return (MSG_ORIG(MSG_CMD_DUMPGRP));
1080Sstevel@tonic-gate 			else
1090Sstevel@tonic-gate 				return (MSG_ORIG(MSG_CMD_DUMPIND));
1100Sstevel@tonic-gate 		} else {
1110Sstevel@tonic-gate 			if (flags & RTC_OBJ_OPTINAL)
1120Sstevel@tonic-gate 				return (MSG_ORIG(MSG_CMD_OPTIONAL));
1130Sstevel@tonic-gate 			else
1140Sstevel@tonic-gate 				return (MSG_ORIG(MSG_CMD_ALTER));
1150Sstevel@tonic-gate 		}
1160Sstevel@tonic-gate 	} else {
1170Sstevel@tonic-gate 		if (flags & RTC_OBJ_GROUP)
1180Sstevel@tonic-gate 			return (MSG_ORIG(MSG_CMD_GRP));
1190Sstevel@tonic-gate 		else
1200Sstevel@tonic-gate 			return (MSG_ORIG(MSG_CMD_IND));
1210Sstevel@tonic-gate 	}
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate /*
1250Sstevel@tonic-gate  * Fabricate a system default search path.  If an update is requested, and
1260Sstevel@tonic-gate  * new search paths are specified while no configuration file exists, or if a
1270Sstevel@tonic-gate  * configuration file does exist but doesn't specify this particular search
1280Sstevel@tonic-gate  * path, create any system defaults.  The intent is to allow
1290Sstevel@tonic-gate  * "crle -u -l/usr/local/lib" and have this append the search path to the
1300Sstevel@tonic-gate  * system default, rather than have the user have to determine and specify
1310Sstevel@tonic-gate  * this default themselves.
1320Sstevel@tonic-gate  */
1330Sstevel@tonic-gate static int
1340Sstevel@tonic-gate fablib(Crle_desc * crle, int flag)
1350Sstevel@tonic-gate {
1360Sstevel@tonic-gate 	const char	*path;
1370Sstevel@tonic-gate 	char		**list;
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate 	switch (flag) {
1400Sstevel@tonic-gate 	case CRLE_EDLIB:
141*1976Sab196087 #if M_CLASS == ELFCLASS64
1420Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
143*1976Sab196087 		path = MSG_ORIG(MSG_PTH_NEWDLP_64);
1440Sstevel@tonic-gate #else
145*1976Sab196087 		path = MSG_ORIG(MSG_PTH_OLDDLP_64);
1460Sstevel@tonic-gate #endif
147*1976Sab196087 #else
1480Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
149*1976Sab196087 		path = MSG_ORIG(MSG_PTH_NEWDLP);
1500Sstevel@tonic-gate #else
151*1976Sab196087 		path = MSG_ORIG(MSG_PTH_OLDDLP);
1520Sstevel@tonic-gate #endif
153*1976Sab196087 #endif
1540Sstevel@tonic-gate 		list = &crle->c_edlibpath;
1550Sstevel@tonic-gate 		break;
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate 	case CRLE_ESLIB:
158*1976Sab196087 #if M_CLASS == ELFCLASS64
1590Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
160*1976Sab196087 		path = MSG_ORIG(MSG_PTH_NEWTD_64);
1610Sstevel@tonic-gate #else
162*1976Sab196087 		path = MSG_ORIG(MSG_PTH_OLDTD_64);
1630Sstevel@tonic-gate #endif
164*1976Sab196087 #else
1650Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
166*1976Sab196087 		path = MSG_ORIG(MSG_PTH_NEWTD);
1670Sstevel@tonic-gate #else
168*1976Sab196087 		path = MSG_ORIG(MSG_PTH_OLDTD);
1690Sstevel@tonic-gate #endif
170*1976Sab196087 #endif
1710Sstevel@tonic-gate 		list = &crle->c_eslibpath;
1720Sstevel@tonic-gate 		break;
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate 	case CRLE_ADLIB:
1750Sstevel@tonic-gate 		path = MSG_ORIG(MSG_PTH_AOUTDLP);
1760Sstevel@tonic-gate 		list = &crle->c_adlibpath;
1770Sstevel@tonic-gate 		break;
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate 	case CRLE_ASLIB:
1800Sstevel@tonic-gate 		path = MSG_ORIG(MSG_PTH_AOUTTD);
1810Sstevel@tonic-gate 		list = &crle->c_aslibpath;
1820Sstevel@tonic-gate 		break;
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate 	default:
1850Sstevel@tonic-gate 		return (1);
1860Sstevel@tonic-gate 	}
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate 	return (addlib(crle, list, path));
1890Sstevel@tonic-gate }
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate /*
1920Sstevel@tonic-gate  * Establish the flags required to generate the associated object.  Actually
1930Sstevel@tonic-gate  * the flags are already part of the object being inspected from the present
1940Sstevel@tonic-gate  * configuration file, but instead of using them all, which can cause some
1950Sstevel@tonic-gate  * unsuspected propagation down the inspect() family, only use those flags that
1960Sstevel@tonic-gate  * would have been contributed from crle()'s calls to inspect.
1970Sstevel@tonic-gate  */
1980Sstevel@tonic-gate static Half
1990Sstevel@tonic-gate getflags(Half flags)
2000Sstevel@tonic-gate {
2010Sstevel@tonic-gate 	flags &=
2020Sstevel@tonic-gate 	    (RTC_OBJ_ALTER | RTC_OBJ_DUMP | RTC_OBJ_GROUP | RTC_OBJ_OPTINAL);
2030Sstevel@tonic-gate 	return (flags | RTC_OBJ_CMDLINE);
2040Sstevel@tonic-gate }
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate /*
2070Sstevel@tonic-gate  * Dump a configuration files information.  This routine is very close to the
2080Sstevel@tonic-gate  * scanconfig() in libcrle.
2090Sstevel@tonic-gate  */
210*1976Sab196087 static INSCFG_RET
2110Sstevel@tonic-gate scanconfig(Crle_desc * crle, Addr addr)
2120Sstevel@tonic-gate {
213*1976Sab196087 	Rtc_id		*id;
214*1976Sab196087 	Rtc_head	*head;
2150Sstevel@tonic-gate 	Rtc_dir		*dirtbl;
2160Sstevel@tonic-gate 	Rtc_file	*filetbl;
2170Sstevel@tonic-gate 	Rtc_obj		*objtbl, * obj;
2180Sstevel@tonic-gate 	Word		*hash, * chain;
2190Sstevel@tonic-gate 	const char	*strtbl;
2200Sstevel@tonic-gate 	int		ndx, bkts;
2210Sstevel@tonic-gate 	List		cmdline = { 0 };
2220Sstevel@tonic-gate 	char		_cmd[PATH_MAX], * cmd;
2230Sstevel@tonic-gate 	char		_objdir[PATH_MAX], * objdir = 0;
2240Sstevel@tonic-gate 
225*1976Sab196087 
226*1976Sab196087 	/*
227*1976Sab196087 	 * If there is an Rtc_id present, the Rtc_head follows it.
228*1976Sab196087 	 * Otherwise, it is at the top.
229*1976Sab196087 	 */
230*1976Sab196087 	if (RTC_ID_TEST(addr)) {
231*1976Sab196087 		id = (Rtc_id *) addr;
232*1976Sab196087 		addr += sizeof (*id);	/* Rtc_head follows */
233*1976Sab196087 	} else {
234*1976Sab196087 		id = NULL;
235*1976Sab196087 		/*
236*1976Sab196087 		 * When updating an existing config file that is lacking
237*1976Sab196087 		 * the Rtc_id block, don't put one into the resulting file.
238*1976Sab196087 		 */
239*1976Sab196087 		crle->c_flags &= ~CRLE_ADDID;
240*1976Sab196087 	}
241*1976Sab196087 	head = (Rtc_head *) addr;
242*1976Sab196087 
243*1976Sab196087 
244*1976Sab196087 	/*
245*1976Sab196087 	 * The rest of the configuration file can only be examined by
246*1976Sab196087 	 * a program of the same ELFCLASS, byte order, and hardware
247*1976Sab196087 	 * architecture as the one that created it.
248*1976Sab196087 	 */
249*1976Sab196087 #ifdef _ELF64
250*1976Sab196087 	/* 64-bit program with an existing 32-bit file? Abort. */
251*1976Sab196087 	if (!(head->ch_cnflags & RTC_HDR_64)) {
252*1976Sab196087 		(void) fprintf(stderr, MSG_INTL(MSG_ARG_CLASS),
253*1976Sab196087 			crle->c_name, crle->c_confil);
254*1976Sab196087 		return (INSCFG_RET_FAIL);
255*1976Sab196087 	}
256*1976Sab196087 #else
257*1976Sab196087 	/* 32-bit program with an existing 64-bit file? Restart. */
258*1976Sab196087 	if (head->ch_cnflags & RTC_HDR_64)
259*1976Sab196087 		return (INSCFG_RET_NEED64);
260*1976Sab196087 #endif
261*1976Sab196087 	/*
262*1976Sab196087 	 * Now that the ELFCLASS has been settled, ensure that the
263*1976Sab196087 	 * byte order and hardware match. Unlike ELFCLASS, where restarting
264*1976Sab196087 	 * the other version is an option, we cannot work around a mismatch
265*1976Sab196087 	 * of these attributes.
266*1976Sab196087 	 */
267*1976Sab196087 	if (id) {		/* Rtc_id is present */
268*1976Sab196087 		/*
269*1976Sab196087 		 * Was the file produced by compatible hardware?
270*1976Sab196087 		 * ELFCLASS doesn't matter here, because we can
271*1976Sab196087 		 * adjust for that, but byte order and machine type do.
272*1976Sab196087 		 */
273*1976Sab196087 		if ((id->id_data != M_DATA) || (id->id_machine != M_MACH)) {
274*1976Sab196087 			(void) fprintf(stderr, MSG_INTL(MSG_ARG_WRONGARCH),
275*1976Sab196087 			    crle->c_name, crle->c_confil,
276*1976Sab196087 			    conv_ehdr_data(id->id_data, CONV_FMT_ALTFILE),
277*1976Sab196087 			    conv_ehdr_mach(id->id_machine, CONV_FMT_ALTFILE),
278*1976Sab196087 			    conv_ehdr_data(M_DATA, CONV_FMT_ALTFILE),
279*1976Sab196087 			    conv_ehdr_mach(M_MACH, CONV_FMT_ALTFILE));
280*1976Sab196087 			return (INSCFG_RET_FAIL);
281*1976Sab196087 		}
282*1976Sab196087 	}
283*1976Sab196087 
284*1976Sab196087 
2850Sstevel@tonic-gate 	/* LINTED */
286*1976Sab196087 	objtbl = (Rtc_obj *)(CAST_PTRINT(char *, head->ch_obj) + addr);
287*1976Sab196087 	strtbl = (const char *)(CAST_PTRINT(char *, head->ch_str) + addr);
288*1976Sab196087 
289*1976Sab196087 	/*
290*1976Sab196087 	 * If the configuration file has a version higher than we
291*1976Sab196087 	 * recognise, we face two issues:
292*1976Sab196087 	 *	(1) Updates are not possible because we have no
293*1976Sab196087 	 *		way to recognise or propagate the new features.
294*1976Sab196087 	 *		This has to be a fatal error.
295*1976Sab196087 	 *	(2) Printing has the risk that we may have been
296*1976Sab196087 	 *		handed something other than a real config file, as
297*1976Sab196087 	 *		well as the fact that we can't display the information
298*1976Sab196087 	 *		for the new features. So, we print a warning, but
299*1976Sab196087 	 *		continue on to do the best we can with it.
300*1976Sab196087 	 */
301*1976Sab196087 	if (head->ch_version > RTC_VER_CURRENT) {
302*1976Sab196087 		if (crle->c_flags & CRLE_UPDATE) {
303*1976Sab196087 			(void) fprintf(stderr, MSG_INTL(MSG_ARG_UPDATEVER),
304*1976Sab196087 				crle->c_name, crle->c_confil,
305*1976Sab196087 				head->ch_version, RTC_VER_CURRENT);
306*1976Sab196087 			return (INSCFG_RET_FAIL);
307*1976Sab196087 		} else {
308*1976Sab196087 			(void) fprintf(stderr, MSG_INTL(MSG_ARG_PRINTVER),
309*1976Sab196087 				crle->c_name, crle->c_confil,
310*1976Sab196087 				head->ch_version, RTC_VER_CURRENT);
311*1976Sab196087 		}
312*1976Sab196087 	}
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate 	/*
3150Sstevel@tonic-gate 	 * If this is a version 1 configuration file we can't generate accurate
3160Sstevel@tonic-gate 	 * update information, or the command-line used to create the file.
3170Sstevel@tonic-gate 	 */
3180Sstevel@tonic-gate 	if (head->ch_version == RTC_VER_ONE) {
3190Sstevel@tonic-gate 		(void) printf(MSG_INTL(MSG_ARG_UPDATE), crle->c_name,
3200Sstevel@tonic-gate 		    crle->c_confil, head->ch_version);
3210Sstevel@tonic-gate 	}
3220Sstevel@tonic-gate 
323*1976Sab196087 
324*1976Sab196087 	if (!(crle->c_flags & CRLE_UPDATE) && (head->ch_cnflags & RTC_HDR_64)) {
325*1976Sab196087 		/*
326*1976Sab196087 		 * Construct the original command line argument.
327*1976Sab196087 		 */
328*1976Sab196087 		cmd = strcpy(alloca(MSG_CMD_64_SIZE + 1), MSG_ORIG(MSG_CMD_64));
329*1976Sab196087 		if (list_append(&cmdline, cmd) == 0)
330*1976Sab196087 			return (INSCFG_RET_FAIL);
3310Sstevel@tonic-gate 	}
3320Sstevel@tonic-gate 
333*1976Sab196087 
3340Sstevel@tonic-gate 	/*
3350Sstevel@tonic-gate 	 * Start analyzing the configuration files header information.
3360Sstevel@tonic-gate 	 */
3370Sstevel@tonic-gate 	if ((crle->c_flags & CRLE_UPDATE) == 0) {
3380Sstevel@tonic-gate 		const char	*fmt;
3390Sstevel@tonic-gate 
3400Sstevel@tonic-gate 		if (head->ch_dlflags)
3411618Srie 			fmt = conv_dl_flag(head->ch_dlflags, 0);
3420Sstevel@tonic-gate 		else
3430Sstevel@tonic-gate 			fmt = MSG_ORIG(MSG_STR_EMPTY);
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate 		(void) printf(MSG_INTL(MSG_DMP_HEAD), head->ch_version,
3460Sstevel@tonic-gate 		    crle->c_confil, fmt);
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate 		/*
349*1976Sab196087 		 * If the file has an id block, show the information
350*1976Sab196087 		 */
351*1976Sab196087 		if (id)
352*1976Sab196087 		    printf(MSG_INTL(MSG_DMP_PLATFORM),
353*1976Sab196087 			conv_ehdr_class(id->id_class, CONV_FMT_ALTFILE),
354*1976Sab196087 			conv_ehdr_data(id->id_data, CONV_FMT_ALTFILE),
355*1976Sab196087 			conv_ehdr_mach(id->id_machine, CONV_FMT_ALTFILE));
356*1976Sab196087 
357*1976Sab196087 		/*
3580Sstevel@tonic-gate 		 * Construct the original command line argument.
3590Sstevel@tonic-gate 		 */
3600Sstevel@tonic-gate 		(void) snprintf(_cmd, PATH_MAX, MSG_ORIG(MSG_CMD_CONF),
3610Sstevel@tonic-gate 		    crle->c_confil);
3620Sstevel@tonic-gate 		cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
3630Sstevel@tonic-gate 		if (list_append(&cmdline, cmd) == 0)
364*1976Sab196087 			return (INSCFG_RET_FAIL);
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate 		/*
3670Sstevel@tonic-gate 		 * Construct any -f usage.
3680Sstevel@tonic-gate 		 */
3690Sstevel@tonic-gate 		if (head->ch_dlflags &&
3700Sstevel@tonic-gate 		    (head->ch_dlflags != RTLD_REL_RELATIVE)) {
3710Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX, MSG_ORIG(MSG_CMD_FLAGS),
3721618Srie 			    conv_dl_flag(head->ch_dlflags, 1));
3730Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
3740Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
375*1976Sab196087 				return (INSCFG_RET_FAIL);
3760Sstevel@tonic-gate 		}
3770Sstevel@tonic-gate 	} else {
3780Sstevel@tonic-gate 		/*
3790Sstevel@tonic-gate 		 * Establish any -f usage.
3800Sstevel@tonic-gate 		 */
3810Sstevel@tonic-gate 		if (head->ch_dlflags &&
3820Sstevel@tonic-gate 		    (head->ch_dlflags != RTLD_REL_RELATIVE))
3830Sstevel@tonic-gate 			crle->c_dlflags = head->ch_dlflags;
3840Sstevel@tonic-gate 	}
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate 
3870Sstevel@tonic-gate 	/*
3880Sstevel@tonic-gate 	 * Determine if this configuration file is only applicable to a specific
3890Sstevel@tonic-gate 	 * application.
3900Sstevel@tonic-gate 	 */
3910Sstevel@tonic-gate 	if (head->ch_app) {
3920Sstevel@tonic-gate 		char	*alter;
3930Sstevel@tonic-gate 
3940Sstevel@tonic-gate 		obj = (Rtc_obj *)(head->ch_app + addr);
3950Sstevel@tonic-gate 
3960Sstevel@tonic-gate 		/*
3970Sstevel@tonic-gate 		 * Determine the output directory for the files
3980Sstevel@tonic-gate 		 * alternative name.
3990Sstevel@tonic-gate 		 */
4000Sstevel@tonic-gate 		alter = (char *)(strtbl + obj->co_alter);
4010Sstevel@tonic-gate 		(void) strcpy(_objdir, alter);
4020Sstevel@tonic-gate 		alter = strrchr(_objdir, '/');
4030Sstevel@tonic-gate 		*alter = '\0';
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate 		crle->c_objdir = objdir = _objdir;
4060Sstevel@tonic-gate 
4070Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
4080Sstevel@tonic-gate 			if (inspect(crle, (strtbl + obj->co_name),
4090Sstevel@tonic-gate 			    (RTC_OBJ_DUMP | RTC_OBJ_ALTER |
4100Sstevel@tonic-gate 			    RTC_OBJ_GROUP | RTC_OBJ_CMDLINE)) != 0)
411*1976Sab196087 				return (INSCFG_RET_FAIL);
4120Sstevel@tonic-gate 		} else {
4130Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_APP),
4140Sstevel@tonic-gate 			    (strtbl + obj->co_alter), (strtbl + obj->co_name));
4150Sstevel@tonic-gate 
4160Sstevel@tonic-gate 			/*
4170Sstevel@tonic-gate 			 * Construct the original command line arguments.
4180Sstevel@tonic-gate 			 */
4190Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
4200Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_OUTPUT), crle->c_objdir);
4210Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
4220Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
423*1976Sab196087 				return (INSCFG_RET_FAIL);
4240Sstevel@tonic-gate 
4250Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
4260Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_DUMPGRP), (strtbl + obj->co_name));
4270Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
4280Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
429*1976Sab196087 				return (INSCFG_RET_FAIL);
4300Sstevel@tonic-gate 		}
4310Sstevel@tonic-gate 	}
4320Sstevel@tonic-gate 
4330Sstevel@tonic-gate 	/*
4340Sstevel@tonic-gate 	 * Analyze any alternative library path and trusted directory entries.
4350Sstevel@tonic-gate 	 */
4360Sstevel@tonic-gate 	if (head->ch_edlibpath) {
4370Sstevel@tonic-gate 		const char	*str;
4380Sstevel@tonic-gate 
4390Sstevel@tonic-gate 		str = (const char *)(head->ch_edlibpath + addr);
4400Sstevel@tonic-gate 
4410Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
4420Sstevel@tonic-gate 			crle->c_flags &= ~CRLE_AOUT;
4430Sstevel@tonic-gate 
4440Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
4450Sstevel@tonic-gate 			if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
4460Sstevel@tonic-gate 				if (head->ch_cnflags & RTC_HDR_64)
4471618Srie 					str = conv_config_upm(str,
4480Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_OLDDLP_64),
4490Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_UPDLP_64),
4500Sstevel@tonic-gate 					    MSG_PTH_UPDLP_64_SIZE);
4510Sstevel@tonic-gate 				else
4521618Srie 					str = conv_config_upm(str,
4530Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_OLDDLP),
4540Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_UPDLP),
4550Sstevel@tonic-gate 					    MSG_PTH_UPDLP_SIZE);
4560Sstevel@tonic-gate 			}
4570Sstevel@tonic-gate #endif
4580Sstevel@tonic-gate 			if (addlib(crle, &crle->c_edlibpath, str) != 0)
459*1976Sab196087 				return (INSCFG_RET_FAIL);
4600Sstevel@tonic-gate 		} else {
4610Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_DLIBPTH),
4620Sstevel@tonic-gate 			    MSG_ORIG(MSG_STR_ELF), str);
4630Sstevel@tonic-gate 
4640Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
4650Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_EDLIB), str);
4660Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
4670Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
468*1976Sab196087 				return (INSCFG_RET_FAIL);
4690Sstevel@tonic-gate 		}
4700Sstevel@tonic-gate 	} else {
4710Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
4720Sstevel@tonic-gate 			if (crle->c_flags & CRLE_EDLIB) {
4730Sstevel@tonic-gate 				/*
4740Sstevel@tonic-gate 				 * If we've been asked to update a configuration
4750Sstevel@tonic-gate 				 * file, and no existing default ELF search
4760Sstevel@tonic-gate 				 * path exists, but the user is going to add new
4770Sstevel@tonic-gate 				 * entries, fabricate the system defaults so
4780Sstevel@tonic-gate 				 * that the users get added to them.
4790Sstevel@tonic-gate 				 */
4800Sstevel@tonic-gate 				if (fablib(crle, CRLE_EDLIB) != 0)
481*1976Sab196087 					return (INSCFG_RET_FAIL);
4820Sstevel@tonic-gate 			}
4830Sstevel@tonic-gate 		} else {
4840Sstevel@tonic-gate 			/*
4850Sstevel@tonic-gate 			 * Indicate any system default.
4860Sstevel@tonic-gate 			 */
487*1976Sab196087 #if M_CLASS == ELFCLASS64
4880Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
489*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_NEWDLP_64));
4900Sstevel@tonic-gate #else
491*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_OLDDLP_64));
4920Sstevel@tonic-gate #endif
493*1976Sab196087 #else
4940Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
495*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_NEWDLP));
4960Sstevel@tonic-gate #else
497*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_OLDDLP));
4980Sstevel@tonic-gate #endif
499*1976Sab196087 #endif
5000Sstevel@tonic-gate 		}
5010Sstevel@tonic-gate 	}
5020Sstevel@tonic-gate 
5030Sstevel@tonic-gate 	if (head->ch_eslibpath) {
5040Sstevel@tonic-gate 		const char	*str;
5050Sstevel@tonic-gate 
5060Sstevel@tonic-gate 		str = (const char *)(head->ch_eslibpath + addr);
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
5090Sstevel@tonic-gate 			crle->c_flags &= ~CRLE_AOUT;
5100Sstevel@tonic-gate 
5110Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
5120Sstevel@tonic-gate 			if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
5130Sstevel@tonic-gate 				if (head->ch_cnflags & RTC_HDR_64)
5141618Srie 					str = conv_config_upm(str,
5150Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_OLDTD_64),
5160Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_UPTD_64),
5170Sstevel@tonic-gate 					    MSG_PTH_UPTD_64_SIZE);
5180Sstevel@tonic-gate 				else
5191618Srie 					str = conv_config_upm(str,
5200Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_OLDTD),
5210Sstevel@tonic-gate 					    MSG_ORIG(MSG_PTH_UPTD),
5220Sstevel@tonic-gate 					    MSG_PTH_UPTD_SIZE);
5230Sstevel@tonic-gate 			}
5240Sstevel@tonic-gate #endif
5250Sstevel@tonic-gate 			if (addlib(crle, &crle->c_eslibpath, str) != 0)
526*1976Sab196087 				return (INSCFG_RET_FAIL);
5270Sstevel@tonic-gate 		} else {
5280Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_TLIBPTH),
5290Sstevel@tonic-gate 			    MSG_ORIG(MSG_STR_ELF), str);
5300Sstevel@tonic-gate 
5310Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
5320Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_ESLIB), str);
5330Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
5340Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
535*1976Sab196087 				return (INSCFG_RET_FAIL);
5360Sstevel@tonic-gate 		}
5370Sstevel@tonic-gate 	} else {
5380Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
5390Sstevel@tonic-gate 			if (crle->c_flags & CRLE_ESLIB) {
5400Sstevel@tonic-gate 				/*
5410Sstevel@tonic-gate 				 * If we've been asked to update a configuration
5420Sstevel@tonic-gate 				 * file, and no existing default ELF secure
5430Sstevel@tonic-gate 				 * path exists, but the user is going to add new
5440Sstevel@tonic-gate 				 * entries, fabricate the system defaults so
5450Sstevel@tonic-gate 				 * that the users get added to them.
5460Sstevel@tonic-gate 				 */
5470Sstevel@tonic-gate 				if (fablib(crle, CRLE_ESLIB) != 0)
548*1976Sab196087 					return (INSCFG_RET_FAIL);
5490Sstevel@tonic-gate 			}
5500Sstevel@tonic-gate 		} else {
5510Sstevel@tonic-gate 			/*
5520Sstevel@tonic-gate 			 * Indicate any system default.
5530Sstevel@tonic-gate 			 */
554*1976Sab196087 #if M_CLASS == ELFCLASS64
5550Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
556*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_NEWTD_64));
5570Sstevel@tonic-gate #else
558*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_OLDTD_64));
5590Sstevel@tonic-gate #endif
560*1976Sab196087 #else
5610Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
562*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_NEWTD));
5630Sstevel@tonic-gate #else
564*1976Sab196087 			(void) printf(MSG_INTL(MSG_DEF_OLDTD));
5650Sstevel@tonic-gate #endif
566*1976Sab196087 #endif
5670Sstevel@tonic-gate 		}
5680Sstevel@tonic-gate 	}
5690Sstevel@tonic-gate 
5700Sstevel@tonic-gate 	if (head->ch_adlibpath) {
5710Sstevel@tonic-gate 		const char	*str;
5720Sstevel@tonic-gate 
5730Sstevel@tonic-gate 		str = (const char *)(head->ch_adlibpath + addr);
5740Sstevel@tonic-gate 
5750Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
5760Sstevel@tonic-gate 			crle->c_flags |= CRLE_AOUT;
5770Sstevel@tonic-gate 			if (addlib(crle, &crle->c_adlibpath, str) != 0)
578*1976Sab196087 				return (INSCFG_RET_FAIL);
5790Sstevel@tonic-gate 		} else {
5800Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_DLIBPTH),
5810Sstevel@tonic-gate 			    MSG_ORIG(MSG_STR_AOUT), str);
5820Sstevel@tonic-gate 
5830Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
5840Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_ADLIB), str);
5850Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
5860Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
587*1976Sab196087 				return (INSCFG_RET_FAIL);
5880Sstevel@tonic-gate 		}
5890Sstevel@tonic-gate 	} else {
5900Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
5910Sstevel@tonic-gate 			if (crle->c_flags & CRLE_ADLIB) {
5920Sstevel@tonic-gate 				/*
5930Sstevel@tonic-gate 				 * If we've been asked to update a configuration
5940Sstevel@tonic-gate 				 * file, and no existing default AOUT search
5950Sstevel@tonic-gate 				 * path exists, but the user is going to add new
5960Sstevel@tonic-gate 				 * entries, fabricate the system defaults so
5970Sstevel@tonic-gate 				 * that the users get added to them.
5980Sstevel@tonic-gate 				 */
5990Sstevel@tonic-gate 				if (fablib(crle, CRLE_ADLIB) != 0)
600*1976Sab196087 					return (INSCFG_RET_FAIL);
6010Sstevel@tonic-gate 			}
6020Sstevel@tonic-gate 		} else if (crle->c_flags & CRLE_AOUT) {
6030Sstevel@tonic-gate 			/*
6040Sstevel@tonic-gate 			 * Indicate any system default.
6050Sstevel@tonic-gate 			 */
6060Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DEF_AOUTDLP));
6070Sstevel@tonic-gate 		}
6080Sstevel@tonic-gate 	}
6090Sstevel@tonic-gate 
6100Sstevel@tonic-gate 	if (head->ch_aslibpath) {
6110Sstevel@tonic-gate 		const char	*str;
6120Sstevel@tonic-gate 
6130Sstevel@tonic-gate 		str = (const char *)(head->ch_aslibpath + addr);
6140Sstevel@tonic-gate 
6150Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
6160Sstevel@tonic-gate 			crle->c_flags |= CRLE_AOUT;
6170Sstevel@tonic-gate 			if (addlib(crle, &crle->c_aslibpath, str) != 0)
618*1976Sab196087 				return (INSCFG_RET_FAIL);
6190Sstevel@tonic-gate 		} else {
6200Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_TLIBPTH),
6210Sstevel@tonic-gate 			    MSG_ORIG(MSG_STR_AOUT), str);
6220Sstevel@tonic-gate 
6230Sstevel@tonic-gate 			(void) snprintf(_cmd, PATH_MAX,
6240Sstevel@tonic-gate 			    MSG_ORIG(MSG_CMD_ASLIB), str);
6250Sstevel@tonic-gate 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
6260Sstevel@tonic-gate 			if (list_append(&cmdline, cmd) == 0)
627*1976Sab196087 				return (INSCFG_RET_FAIL);
6280Sstevel@tonic-gate 		}
6290Sstevel@tonic-gate 	} else {
6300Sstevel@tonic-gate 		if (crle->c_flags & CRLE_UPDATE) {
6310Sstevel@tonic-gate 			if (crle->c_flags & CRLE_ASLIB) {
6320Sstevel@tonic-gate 				/*
6330Sstevel@tonic-gate 				 * If we've been asked to update a configuration
6340Sstevel@tonic-gate 				 * file, and no existing default AOUT secure
6350Sstevel@tonic-gate 				 * path exists, but the user is going to add new
6360Sstevel@tonic-gate 				 * entries, fabricate the system defaults so
6370Sstevel@tonic-gate 				 * that the users get added to them.
6380Sstevel@tonic-gate 				 */
6390Sstevel@tonic-gate 				if (fablib(crle, CRLE_ASLIB) != 0)
640*1976Sab196087 					return (INSCFG_RET_FAIL);
6410Sstevel@tonic-gate 			}
6420Sstevel@tonic-gate 		} else if (crle->c_flags & CRLE_AOUT) {
6430Sstevel@tonic-gate 			/*
6440Sstevel@tonic-gate 			 * Indicate any system default.
6450Sstevel@tonic-gate 			 */
6460Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DEF_AOUTTD));
6470Sstevel@tonic-gate 		}
6480Sstevel@tonic-gate 	}
6490Sstevel@tonic-gate 
6500Sstevel@tonic-gate 	/*
6510Sstevel@tonic-gate 	 * Display any environment variables.
6520Sstevel@tonic-gate 	 */
6530Sstevel@tonic-gate 	if ((head->ch_version >= RTC_VER_THREE) && head->ch_env) {
6540Sstevel@tonic-gate 		Rtc_env *	envtbl;
6550Sstevel@tonic-gate 
6560Sstevel@tonic-gate 		if ((crle->c_flags & CRLE_UPDATE) == 0)
6570Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_ENV_TITLE));
6580Sstevel@tonic-gate 
6590Sstevel@tonic-gate 		for (envtbl = (Rtc_env *)(head->ch_env + addr);
6600Sstevel@tonic-gate 		    envtbl->env_str; envtbl++) {
6610Sstevel@tonic-gate 			const char	*str;
6620Sstevel@tonic-gate 
6630Sstevel@tonic-gate 			str = (const char *)(envtbl->env_str + addr);
6640Sstevel@tonic-gate 
6650Sstevel@tonic-gate 			if (crle->c_flags & CRLE_UPDATE) {
6660Sstevel@tonic-gate 				if (addenv(crle, str,
6670Sstevel@tonic-gate 				    (envtbl->env_flags | RTC_ENV_CONFIG)) == 0)
668*1976Sab196087 					return (INSCFG_RET_FAIL);
6690Sstevel@tonic-gate 			} else {
6700Sstevel@tonic-gate 				const char	*pfmt, *sfmt;
6710Sstevel@tonic-gate 
6720Sstevel@tonic-gate 				if (envtbl->env_flags & RTC_ENV_PERMANT) {
6730Sstevel@tonic-gate 					pfmt = MSG_INTL(MSG_ENV_PRM);
6740Sstevel@tonic-gate 					sfmt = MSG_ORIG(MSG_CMD_PRMENV);
6750Sstevel@tonic-gate 				} else {
6760Sstevel@tonic-gate 					pfmt = MSG_INTL(MSG_ENV_RPL);
6770Sstevel@tonic-gate 					sfmt = MSG_ORIG(MSG_CMD_RPLENV);
6780Sstevel@tonic-gate 				}
6790Sstevel@tonic-gate 				(void) printf(pfmt, str);
6800Sstevel@tonic-gate 				(void) snprintf(_cmd, PATH_MAX, sfmt, str);
6810Sstevel@tonic-gate 				cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
6820Sstevel@tonic-gate 				if (list_append(&cmdline, cmd) == 0)
683*1976Sab196087 					return (INSCFG_RET_FAIL);
6840Sstevel@tonic-gate 			}
6850Sstevel@tonic-gate 		}
6860Sstevel@tonic-gate 	}
6870Sstevel@tonic-gate 
6880Sstevel@tonic-gate 	/*
6890Sstevel@tonic-gate 	 * Display any filter/filtee associations.
6900Sstevel@tonic-gate 	 */
6910Sstevel@tonic-gate 	if ((head->ch_version >= RTC_VER_FOUR) && head->ch_fltr) {
6920Sstevel@tonic-gate 		if ((crle->c_flags & CRLE_UPDATE) == 0) {
6930Sstevel@tonic-gate 			Rtc_fltr *	fltrtbl;
6940Sstevel@tonic-gate 			Rtc_flte *	fltetbl;
6950Sstevel@tonic-gate 
6960Sstevel@tonic-gate 			/* LINTED */
697*1976Sab196087 			fltrtbl = (Rtc_fltr *)
698*1976Sab196087 				(CAST_PTRINT(char *, head->ch_fltr) + addr);
6990Sstevel@tonic-gate 			/* LINTED */
700*1976Sab196087 			fltetbl = (Rtc_flte *)
701*1976Sab196087 				(CAST_PTRINT(char *, head->ch_flte) + addr);
7020Sstevel@tonic-gate 
7030Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_FLT_TITLE));
7040Sstevel@tonic-gate 
7050Sstevel@tonic-gate 			while (fltrtbl->fr_filter) {
7060Sstevel@tonic-gate 				Rtc_flte	*_fltetbl;
7070Sstevel@tonic-gate 
7080Sstevel@tonic-gate 				/*
7090Sstevel@tonic-gate 				 * Print the filter and filtee string pair.
7100Sstevel@tonic-gate 				 */
7110Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_FLT_FILTER),
7120Sstevel@tonic-gate 				    (strtbl + fltrtbl->fr_filter),
7130Sstevel@tonic-gate 				    (strtbl + fltrtbl->fr_string));
7140Sstevel@tonic-gate 
7150Sstevel@tonic-gate 				/*
7160Sstevel@tonic-gate 				 * Print each filtee.
7170Sstevel@tonic-gate 				 */
7180Sstevel@tonic-gate 				/* LINTED */
7190Sstevel@tonic-gate 				for (_fltetbl = (Rtc_flte *)((char *)fltetbl +
7200Sstevel@tonic-gate 				    fltrtbl->fr_filtee); _fltetbl->fe_filtee;
7210Sstevel@tonic-gate 				    _fltetbl++) {
7220Sstevel@tonic-gate 					(void) printf(MSG_INTL(MSG_FLT_FILTEE),
7230Sstevel@tonic-gate 					    (strtbl + _fltetbl->fe_filtee));
7240Sstevel@tonic-gate 				}
7250Sstevel@tonic-gate 				fltrtbl++;
7260Sstevel@tonic-gate 			}
7270Sstevel@tonic-gate 		}
7280Sstevel@tonic-gate 	}
7290Sstevel@tonic-gate 
7300Sstevel@tonic-gate 	/*
7310Sstevel@tonic-gate 	 * Display any memory reservations required for any alternative
7320Sstevel@tonic-gate 	 * objects.
7330Sstevel@tonic-gate 	 */
7340Sstevel@tonic-gate 	if (head->ch_resbgn && ((crle->c_flags & CRLE_UPDATE) == 0))
7350Sstevel@tonic-gate 		(void) printf(MSG_INTL(MSG_DMP_RESV), head->ch_resbgn,
7360Sstevel@tonic-gate 		    head->ch_resend, (head->ch_resend - head->ch_resbgn));
7370Sstevel@tonic-gate 
7380Sstevel@tonic-gate 	/*
7390Sstevel@tonic-gate 	 * If there's no hash table there's nothing else to process.
7400Sstevel@tonic-gate 	 */
7410Sstevel@tonic-gate 	if (head->ch_hash == 0) {
7420Sstevel@tonic-gate 		if ((crle->c_flags & CRLE_UPDATE) == 0)
7430Sstevel@tonic-gate 			printcmd(crle, head, &cmdline);
744*1976Sab196087 		return (INSCFG_RET_OK);
7450Sstevel@tonic-gate 	}
7460Sstevel@tonic-gate 
7470Sstevel@tonic-gate 	/*
7480Sstevel@tonic-gate 	 * Traverse the directory and filename arrays.
7490Sstevel@tonic-gate 	 */
7500Sstevel@tonic-gate 	for (dirtbl = (Rtc_dir *)(head->ch_dir + addr);
7510Sstevel@tonic-gate 	    dirtbl->cd_obj; dirtbl++) {
7520Sstevel@tonic-gate 		struct stat	status;
7530Sstevel@tonic-gate 		Rtc_obj		*dobj;
7540Sstevel@tonic-gate 		const char	*str;
7550Sstevel@tonic-gate 
7560Sstevel@tonic-gate 		dobj = (Rtc_obj *)(dirtbl->cd_obj + addr);
7570Sstevel@tonic-gate 		filetbl = (Rtc_file *)(dirtbl->cd_file + addr);
7580Sstevel@tonic-gate 		str = strtbl + dobj->co_name;
7590Sstevel@tonic-gate 
7600Sstevel@tonic-gate 		/*
7610Sstevel@tonic-gate 		 * Simplify recreation by using any command-line directories.
7620Sstevel@tonic-gate 		 * If we're dealing with a version 1 configuration file use
7630Sstevel@tonic-gate 		 * every directory.
7640Sstevel@tonic-gate 		 */
7650Sstevel@tonic-gate 		if ((dobj->co_flags & RTC_OBJ_CMDLINE) ||
7660Sstevel@tonic-gate 		    (head->ch_version == RTC_VER_ONE)) {
7670Sstevel@tonic-gate 			if (crle->c_flags & CRLE_UPDATE) {
7680Sstevel@tonic-gate 				if (inspect(crle, str,
7690Sstevel@tonic-gate 				    getflags(dobj->co_flags)) != 0)
770*1976Sab196087 					return (INSCFG_RET_FAIL);
7710Sstevel@tonic-gate 				if ((dobj->co_flags &
7720Sstevel@tonic-gate 				    (RTC_OBJ_NOEXIST | RTC_OBJ_ALTER)) ==
7730Sstevel@tonic-gate 				    RTC_OBJ_NOEXIST)
7740Sstevel@tonic-gate 					continue;
7750Sstevel@tonic-gate 			} else {
7760Sstevel@tonic-gate 				/* LINTED */
7770Sstevel@tonic-gate 				(void) snprintf(_cmd, PATH_MAX,
7780Sstevel@tonic-gate 				    getformat(dobj->co_flags), str);
7790Sstevel@tonic-gate 				cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
7800Sstevel@tonic-gate 				if (list_append(&cmdline, cmd) == 0)
781*1976Sab196087 					return (INSCFG_RET_FAIL);
7820Sstevel@tonic-gate 			}
7830Sstevel@tonic-gate 		}
7840Sstevel@tonic-gate 
7850Sstevel@tonic-gate 		/*
7860Sstevel@tonic-gate 		 * If this isn't an update print the directory name.  If the
7870Sstevel@tonic-gate 		 * directory has no entries (possible if the directory is a
7880Sstevel@tonic-gate 		 * symlink to another directory, in which case we record the
7890Sstevel@tonic-gate 		 * real path also), don't bother printing it unless we're in
7900Sstevel@tonic-gate 		 * verbose mode.
7910Sstevel@tonic-gate 		 */
7920Sstevel@tonic-gate 		if ((crle->c_flags & CRLE_UPDATE) == 0) {
7930Sstevel@tonic-gate 			if ((dobj->co_flags &
7940Sstevel@tonic-gate 			    (RTC_OBJ_NOEXIST | RTC_OBJ_ALTER)) ==
7950Sstevel@tonic-gate 			    RTC_OBJ_NOEXIST) {
7960Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_DMP_DIR_2), str);
7970Sstevel@tonic-gate 				continue;
7980Sstevel@tonic-gate 			} else if (filetbl->cf_obj ||
7990Sstevel@tonic-gate 			    (crle->c_flags & CRLE_VERBOSE))
8000Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_DMP_DIR_1), str);
8010Sstevel@tonic-gate 		}
8020Sstevel@tonic-gate 
8030Sstevel@tonic-gate 		/*
8040Sstevel@tonic-gate 		 * Under verbose mode validate any real directory entry - the
8050Sstevel@tonic-gate 		 * same test will be carried out by ld.so.1.
8060Sstevel@tonic-gate 		 */
8070Sstevel@tonic-gate 		if (((crle->c_flags & CRLE_UPDATE) == 0) &&
8080Sstevel@tonic-gate 		    (crle->c_flags & CRLE_VERBOSE) &&
8090Sstevel@tonic-gate 		    (dobj->co_flags & RTC_OBJ_REALPTH)) {
8100Sstevel@tonic-gate 			if (stat(str, &status) != 0) {
8110Sstevel@tonic-gate 				int err = errno;
8120Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_DMP_STAT), str,
8130Sstevel@tonic-gate 				    strerror(err));
8140Sstevel@tonic-gate 			} else if (status.st_mtime != dobj->co_info) {
8150Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_DMP_DCMP), str);
8160Sstevel@tonic-gate 			}
8170Sstevel@tonic-gate 		}
8180Sstevel@tonic-gate 
8190Sstevel@tonic-gate 		for (; filetbl->cf_obj; filetbl++) {
8200Sstevel@tonic-gate 			Rtc_obj *	fobj;
8210Sstevel@tonic-gate 			Half		flags;
8220Sstevel@tonic-gate 
8230Sstevel@tonic-gate 			fobj = (Rtc_obj *)(filetbl->cf_obj + addr);
8240Sstevel@tonic-gate 			str = strtbl + fobj->co_name;
8250Sstevel@tonic-gate 			flags = fobj->co_flags;
8260Sstevel@tonic-gate 
8270Sstevel@tonic-gate 			/*
8280Sstevel@tonic-gate 			 * Only update individual files that were originally
8290Sstevel@tonic-gate 			 * specified on the command-line.  Or, if this is a
8300Sstevel@tonic-gate 			 * version 1 configuration file use every file that
8310Sstevel@tonic-gate 			 * isn't part of an all-entries directory.
8320Sstevel@tonic-gate 			 */
8330Sstevel@tonic-gate 			if (((flags & RTC_OBJ_CMDLINE) &&
8340Sstevel@tonic-gate 			    ((fobj->co_flags & RTC_OBJ_APP) == 0)) ||
8350Sstevel@tonic-gate 			    ((head->ch_version == RTC_VER_ONE) &&
8360Sstevel@tonic-gate 			    ((dobj->co_flags & RTC_OBJ_ALLENTS) == 0))) {
8370Sstevel@tonic-gate 				char	*alter = 0, altdir[PATH_MAX];
8380Sstevel@tonic-gate 
8390Sstevel@tonic-gate 				/*
8400Sstevel@tonic-gate 				 * Determine whether this file requires an
8410Sstevel@tonic-gate 				 * alternative, and if so, and we haven't
8420Sstevel@tonic-gate 				 * already an alternative in affect, create one.
8430Sstevel@tonic-gate 				 */
8440Sstevel@tonic-gate 				if (fobj->co_flags & RTC_OBJ_ALTER) {
8450Sstevel@tonic-gate 					alter = (char *)(strtbl +
8460Sstevel@tonic-gate 					    fobj->co_alter);
8470Sstevel@tonic-gate 					(void) strcpy(altdir, alter);
8480Sstevel@tonic-gate 					alter = strrchr(altdir, '/');
8490Sstevel@tonic-gate 					*alter = '\0';
8500Sstevel@tonic-gate 
8510Sstevel@tonic-gate 					if ((objdir == 0) ||
8520Sstevel@tonic-gate 					    (strcmp(objdir, altdir) != 0)) {
8530Sstevel@tonic-gate 						(void) strcpy(_objdir, altdir);
8540Sstevel@tonic-gate 						crle->c_objdir = alter =
8550Sstevel@tonic-gate 						    objdir = _objdir;
8560Sstevel@tonic-gate 					} else
8570Sstevel@tonic-gate 						alter = 0;
8580Sstevel@tonic-gate 				}
8590Sstevel@tonic-gate 
8600Sstevel@tonic-gate 				if (crle->c_flags & CRLE_UPDATE) {
8610Sstevel@tonic-gate 					if (inspect(crle, str,
8620Sstevel@tonic-gate 					    getflags(flags)) != 0)
863*1976Sab196087 						return (INSCFG_RET_FAIL);
8640Sstevel@tonic-gate 					continue;
8650Sstevel@tonic-gate 				}
8660Sstevel@tonic-gate 
8670Sstevel@tonic-gate 				if (alter) {
8680Sstevel@tonic-gate 					(void) snprintf(_cmd, PATH_MAX,
8690Sstevel@tonic-gate 					    MSG_ORIG(MSG_CMD_OUTPUT),
8700Sstevel@tonic-gate 					    crle->c_objdir);
8710Sstevel@tonic-gate 					cmd = strcpy(alloca(strlen(_cmd) + 1),
8720Sstevel@tonic-gate 					    _cmd);
8730Sstevel@tonic-gate 					if (list_append(&cmdline, cmd) == 0)
874*1976Sab196087 						return (INSCFG_RET_FAIL);
8750Sstevel@tonic-gate 				}
8760Sstevel@tonic-gate 
8770Sstevel@tonic-gate 				/* LINTED */
8780Sstevel@tonic-gate 				(void) snprintf(_cmd, PATH_MAX,
8790Sstevel@tonic-gate 				    getformat(flags), str);
8800Sstevel@tonic-gate 				cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
8810Sstevel@tonic-gate 				if (list_append(&cmdline, cmd) == 0)
882*1976Sab196087 					return (INSCFG_RET_FAIL);
8830Sstevel@tonic-gate 			}
8840Sstevel@tonic-gate 
8850Sstevel@tonic-gate 			if (crle->c_flags & CRLE_UPDATE)
8860Sstevel@tonic-gate 				continue;
8870Sstevel@tonic-gate 
8880Sstevel@tonic-gate 			/*
8890Sstevel@tonic-gate 			 * Although we record both full pathnames and their
8900Sstevel@tonic-gate 			 * simple filenames (basename), only print the simple
8910Sstevel@tonic-gate 			 * names unless we're under verbose mode.
8920Sstevel@tonic-gate 			 */
8930Sstevel@tonic-gate 			if ((strchr(str, '/') == 0) ||
8940Sstevel@tonic-gate 			    (crle->c_flags & CRLE_VERBOSE)) {
8950Sstevel@tonic-gate 				if (fobj->co_flags & RTC_OBJ_ALTER)
8960Sstevel@tonic-gate 					(void) printf(MSG_INTL(MSG_DMP_FILE_2),
8970Sstevel@tonic-gate 					    str, (strtbl + fobj->co_alter));
8980Sstevel@tonic-gate 				else
8990Sstevel@tonic-gate 					(void) printf(MSG_INTL(MSG_DMP_FILE_1),
9000Sstevel@tonic-gate 					    str);
9010Sstevel@tonic-gate 			}
9020Sstevel@tonic-gate 
9030Sstevel@tonic-gate 			/*
9040Sstevel@tonic-gate 			 * Under verbose mode validate any real file entry - the
9050Sstevel@tonic-gate 			 * same test will be carried out by ld.so.1.
9060Sstevel@tonic-gate 			 */
9070Sstevel@tonic-gate 			if ((crle->c_flags & CRLE_VERBOSE) &&
9080Sstevel@tonic-gate 			    (fobj->co_flags & RTC_OBJ_REALPTH)) {
9090Sstevel@tonic-gate 				if (stat(str, &status) != 0) {
9100Sstevel@tonic-gate 					int err = errno;
9110Sstevel@tonic-gate 					(void) printf(MSG_INTL(MSG_DMP_STAT),
9120Sstevel@tonic-gate 					    str, strerror(err));
9130Sstevel@tonic-gate 				} else if (status.st_size != fobj->co_info) {
9140Sstevel@tonic-gate 					(void) printf(MSG_INTL(MSG_DMP_FCMP),
9150Sstevel@tonic-gate 					    str);
9160Sstevel@tonic-gate 				}
9170Sstevel@tonic-gate 			}
9180Sstevel@tonic-gate 		}
9190Sstevel@tonic-gate 	}
9200Sstevel@tonic-gate 
9210Sstevel@tonic-gate 	if ((crle->c_flags & CRLE_UPDATE) == 0)
9220Sstevel@tonic-gate 		printcmd(crle, head, &cmdline);
9230Sstevel@tonic-gate 
9240Sstevel@tonic-gate 	if ((crle->c_flags & CRLE_VERBOSE) == 0)
925*1976Sab196087 		return (INSCFG_RET_OK);
9260Sstevel@tonic-gate 
9270Sstevel@tonic-gate 	/*
9280Sstevel@tonic-gate 	 * If we've in verbose mode scan the hash list.
9290Sstevel@tonic-gate 	 */
9300Sstevel@tonic-gate 	/* LINTED */
931*1976Sab196087 	hash = (Word *)(CAST_PTRINT(char *, head->ch_hash) + addr);
9320Sstevel@tonic-gate 	bkts = hash[0];
9330Sstevel@tonic-gate 	chain = &hash[2 + bkts];
9340Sstevel@tonic-gate 	hash += 2;
9350Sstevel@tonic-gate 
9360Sstevel@tonic-gate 	(void) printf(MSG_INTL(MSG_DMP_HASH));
9370Sstevel@tonic-gate 
9380Sstevel@tonic-gate 	/*
9390Sstevel@tonic-gate 	 * Scan the hash buckets looking for valid entries.
9400Sstevel@tonic-gate 	 */
9410Sstevel@tonic-gate 	for (ndx = 0; ndx < bkts; ndx++, hash++) {
9420Sstevel@tonic-gate 		Rtc_obj		*obj;
9430Sstevel@tonic-gate 		const char	*str;
9440Sstevel@tonic-gate 		Word		_ndx;
9450Sstevel@tonic-gate 
9460Sstevel@tonic-gate 		if (*hash == 0)
9470Sstevel@tonic-gate 			continue;
9480Sstevel@tonic-gate 
9490Sstevel@tonic-gate 		obj = objtbl + *hash;
9500Sstevel@tonic-gate 		str = strtbl + obj->co_name;
9510Sstevel@tonic-gate 
9520Sstevel@tonic-gate 		(void) printf(MSG_INTL(MSG_DMP_HASHENT_1), obj->co_id, ndx,
9530Sstevel@tonic-gate 			str, conv_config_obj(obj->co_flags));
9540Sstevel@tonic-gate 
9550Sstevel@tonic-gate 		/*
9560Sstevel@tonic-gate 		 * Determine whether there are other objects chained to this
9570Sstevel@tonic-gate 		 * bucket.
9580Sstevel@tonic-gate 		 */
9590Sstevel@tonic-gate 		for (_ndx = chain[*hash]; _ndx; _ndx = chain[_ndx]) {
9600Sstevel@tonic-gate 			obj = objtbl + _ndx;
9610Sstevel@tonic-gate 			str = strtbl + obj->co_name;
9620Sstevel@tonic-gate 
9630Sstevel@tonic-gate 			(void) printf(MSG_INTL(MSG_DMP_HASHENT_2), obj->co_id,
9640Sstevel@tonic-gate 			    str, conv_config_obj(obj->co_flags));
9650Sstevel@tonic-gate 		}
9660Sstevel@tonic-gate 	}
9670Sstevel@tonic-gate 	(void) printf(MSG_ORIG(MSG_STR_NL));
9680Sstevel@tonic-gate 
969*1976Sab196087 	return (INSCFG_RET_OK);
9700Sstevel@tonic-gate }
9710Sstevel@tonic-gate 
9720Sstevel@tonic-gate 
973*1976Sab196087 INSCFG_RET
9740Sstevel@tonic-gate inspectconfig(Crle_desc * crle)
9750Sstevel@tonic-gate {
976*1976Sab196087 	INSCFG_RET	error;
977*1976Sab196087 	int		fd;
9780Sstevel@tonic-gate 	Addr		addr;
9790Sstevel@tonic-gate 	struct stat	status;
9800Sstevel@tonic-gate 	const char	*caller = crle->c_name, *file = crle->c_confil;
9810Sstevel@tonic-gate 
9820Sstevel@tonic-gate 	/*
9830Sstevel@tonic-gate 	 * Open the configuration file, determine its size and map it in.
9840Sstevel@tonic-gate 	 */
9850Sstevel@tonic-gate 	if ((fd = open(file, O_RDONLY, 0)) == -1) {
9860Sstevel@tonic-gate 		int	err = errno;
9870Sstevel@tonic-gate 
9880Sstevel@tonic-gate 		if ((err == ENOENT)) {
9890Sstevel@tonic-gate 			/*
9900Sstevel@tonic-gate 			 * To allow an update (-u) from scratch, fabricate any
9910Sstevel@tonic-gate 			 * default search and secure paths that the user
9920Sstevel@tonic-gate 			 * intends to add to.
9930Sstevel@tonic-gate 			 */
9940Sstevel@tonic-gate 			if (crle->c_flags & CRLE_UPDATE) {
9950Sstevel@tonic-gate 				if (crle->c_flags & CRLE_EDLIB) {
9960Sstevel@tonic-gate 					if (fablib(crle, CRLE_EDLIB))
9970Sstevel@tonic-gate 						return (1);
9980Sstevel@tonic-gate 				}
9990Sstevel@tonic-gate 				if (crle->c_flags & CRLE_ESLIB) {
10000Sstevel@tonic-gate 					if (fablib(crle, CRLE_ESLIB))
10010Sstevel@tonic-gate 						return (1);
10020Sstevel@tonic-gate 				}
10030Sstevel@tonic-gate 				if (crle->c_flags & CRLE_ADLIB) {
10040Sstevel@tonic-gate 					if (fablib(crle, CRLE_ADLIB))
10050Sstevel@tonic-gate 						return (1);
10060Sstevel@tonic-gate 				}
10070Sstevel@tonic-gate 				if (crle->c_flags & CRLE_ASLIB) {
10080Sstevel@tonic-gate 					if (fablib(crle, CRLE_ASLIB))
10090Sstevel@tonic-gate 						return (1);
10100Sstevel@tonic-gate 				}
10110Sstevel@tonic-gate 				return (0);
10120Sstevel@tonic-gate 
10130Sstevel@tonic-gate 			} else if (crle->c_flags & CRLE_CONFDEF) {
10140Sstevel@tonic-gate 				const char	*fmt1, *fmt2;
10150Sstevel@tonic-gate 
10160Sstevel@tonic-gate 				/*
10170Sstevel@tonic-gate 				 * Otherwise if the user is inspecting a default
10180Sstevel@tonic-gate 				 * configuration file that doesn't exist inform
10190Sstevel@tonic-gate 				 * them and display the ELF defaults.
10200Sstevel@tonic-gate 				 */
10210Sstevel@tonic-gate 				(void) printf(MSG_INTL(MSG_DEF_NOCONF), file);
10220Sstevel@tonic-gate 
10230Sstevel@tonic-gate 				if (crle->c_flags & CRLE_AOUT) {
10240Sstevel@tonic-gate 					fmt1 = MSG_INTL(MSG_DEF_AOUTDLP);
10250Sstevel@tonic-gate 					fmt2 = MSG_INTL(MSG_DEF_AOUTTD);
10260Sstevel@tonic-gate 				} else {
1027*1976Sab196087 #if M_CLASS == ELFCLASS64
10280Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
1029*1976Sab196087 					fmt1 = MSG_INTL(MSG_DEF_NEWDLP_64);
1030*1976Sab196087 					fmt2 = MSG_INTL(MSG_DEF_NEWTD_64);
10310Sstevel@tonic-gate #else
1032*1976Sab196087 					fmt1 = MSG_INTL(MSG_DEF_OLDDLP_64);
1033*1976Sab196087 					fmt2 = MSG_INTL(MSG_DEF_OLDTD_64);
10340Sstevel@tonic-gate #endif
1035*1976Sab196087 #else
10360Sstevel@tonic-gate #ifndef	SGS_PRE_UNIFIED_PROCESS
1037*1976Sab196087 					fmt1 = MSG_INTL(MSG_DEF_NEWDLP);
1038*1976Sab196087 					fmt2 = MSG_INTL(MSG_DEF_NEWTD);
10390Sstevel@tonic-gate #else
1040*1976Sab196087 					fmt1 = MSG_INTL(MSG_DEF_OLDDLP);
1041*1976Sab196087 					fmt2 = MSG_INTL(MSG_DEF_OLDTD);
10420Sstevel@tonic-gate #endif
1043*1976Sab196087 #endif
10440Sstevel@tonic-gate 				}
10450Sstevel@tonic-gate 				(void) printf(fmt1);
10460Sstevel@tonic-gate 				(void) printf(fmt2);
10470Sstevel@tonic-gate 
10480Sstevel@tonic-gate 				return (0);
10490Sstevel@tonic-gate 			}
10500Sstevel@tonic-gate 		}
10510Sstevel@tonic-gate 
10520Sstevel@tonic-gate 		/*
10530Sstevel@tonic-gate 		 * Otherwise there's an error condition in accessing the file.
10540Sstevel@tonic-gate 		 */
10550Sstevel@tonic-gate 		(void) fprintf(stderr, MSG_INTL(MSG_SYS_OPEN), caller, file,
10560Sstevel@tonic-gate 		    strerror(err));
10570Sstevel@tonic-gate 
10580Sstevel@tonic-gate 		return (1);
10590Sstevel@tonic-gate 	}
10600Sstevel@tonic-gate 
10610Sstevel@tonic-gate 	(void) fstat(fd, &status);
10620Sstevel@tonic-gate 	if (status.st_size < sizeof (Rtc_head)) {
10630Sstevel@tonic-gate 		(void) close(fd);
10640Sstevel@tonic-gate 		(void) fprintf(stderr, MSG_INTL(MSG_COR_TRUNC), caller, file);
10650Sstevel@tonic-gate 		return (1);
10660Sstevel@tonic-gate 	}
10670Sstevel@tonic-gate 	if ((addr = (Addr)mmap(0, status.st_size, PROT_READ, MAP_SHARED,
10680Sstevel@tonic-gate 	    fd, 0)) == (Addr)MAP_FAILED) {
10690Sstevel@tonic-gate 		int err = errno;
10700Sstevel@tonic-gate 		(void) fprintf(stderr, MSG_INTL(MSG_SYS_MMAP), caller, file,
10710Sstevel@tonic-gate 		    strerror(err));
10720Sstevel@tonic-gate 		(void) close(fd);
10730Sstevel@tonic-gate 		return (1);
10740Sstevel@tonic-gate 	}
10750Sstevel@tonic-gate 	(void) close(fd);
10760Sstevel@tonic-gate 
10770Sstevel@tonic-gate 	/*
10780Sstevel@tonic-gate 	 * Print the contents of the configuration file.
10790Sstevel@tonic-gate 	 */
10800Sstevel@tonic-gate 	error = scanconfig(crle, addr);
10810Sstevel@tonic-gate 
10820Sstevel@tonic-gate 	(void) munmap((void *)addr, status.st_size);
10830Sstevel@tonic-gate 	return (error);
10840Sstevel@tonic-gate }
1085