xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/group.c (revision 4699:ba3c3e75e70c)
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 /*
233731Srie  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
241618Srie  * 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	<string.h>
290Sstevel@tonic-gate #include	"rtld.h"
300Sstevel@tonic-gate #include	"_conv.h"
310Sstevel@tonic-gate #include	"group_msg.h"
320Sstevel@tonic-gate 
333731Srie #define	HDLSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
342352Sab196087 		MSG_GPH_ZERO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
352352Sab196087 		MSG_GPH_LDSO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
362352Sab196087 		MSG_GPH_FIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
372352Sab196087 		MSG_GPH_PARENT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
382352Sab196087 		MSG_GPH_FILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
392352Sab196087 		MSG_GPH_INITIAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
403731Srie 		CONV_INV_STRSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * String conversion routine for Grp_hdl flags.
440Sstevel@tonic-gate  */
450Sstevel@tonic-gate const char *
461618Srie conv_grphdl_flags(uint_t flags)
470Sstevel@tonic-gate {
483731Srie 	static char	string[HDLSZ];
491618Srie 	static Val_desc vda[] = {
501618Srie 		{ GPH_ZERO,		MSG_ORIG(MSG_GPH_ZERO) },
511618Srie 		{ GPH_LDSO,		MSG_ORIG(MSG_GPH_LDSO) },
521618Srie 		{ GPH_FIRST,		MSG_ORIG(MSG_GPH_FIRST) },
531618Srie 		{ GPH_PARENT,		MSG_ORIG(MSG_GPH_PARENT) },
541618Srie 		{ GPH_FILTEE,		MSG_ORIG(MSG_GPH_FILTEE) },
551618Srie 		{ GPH_INITIAL,		MSG_ORIG(MSG_GPH_INITIAL) },
561618Srie 		{ 0,			0 }
571618Srie 	};
582352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	if (flags == 0)
610Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_NULL));
620Sstevel@tonic-gate 
632352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
642352Sab196087 	(void) conv_expn_field(&conv_arg);
650Sstevel@tonic-gate 
660Sstevel@tonic-gate 	return ((const char *)string);
670Sstevel@tonic-gate }
683731Srie 
693731Srie #define	DESCSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
70*4699Srie 		MSG_GPD_DLSYM_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
71*4699Srie 		MSG_GPD_RELOC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
723731Srie 		MSG_GPD_ADDEPS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
733731Srie 		MSG_GPD_PARENT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
743731Srie 		MSG_GPD_FILTER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
753731Srie 		MSG_GPD_REMOVE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
763731Srie 		CONV_INV_STRSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
773731Srie /*
783731Srie  * String conversion routine for Grp_desc flags.
793731Srie  */
803731Srie const char *
813731Srie conv_grpdesc_flags(uint_t flags)
823731Srie {
833731Srie 	static char	string[DESCSZ];
843731Srie 	static Val_desc vda[] = {
85*4699Srie 		{ GPD_DLSYM,		MSG_ORIG(MSG_GPD_DLSYM) },
86*4699Srie 		{ GPD_RELOC,		MSG_ORIG(MSG_GPD_RELOC) },
873731Srie 		{ GPD_ADDEPS,		MSG_ORIG(MSG_GPD_ADDEPS) },
883731Srie 		{ GPD_PARENT,		MSG_ORIG(MSG_GPD_PARENT) },
893731Srie 		{ GPD_FILTER,		MSG_ORIG(MSG_GPD_FILTER) },
903731Srie 		{ GPD_REMOVE,		MSG_ORIG(MSG_GPD_REMOVE) },
913731Srie 		{ 0,			0 }
923731Srie 	};
933731Srie 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
943731Srie 
953731Srie 	if (flags == 0)
963731Srie 		return (MSG_ORIG(MSG_GBL_NULL));
973731Srie 
983731Srie 	conv_arg.oflags = conv_arg.rflags = flags;
993731Srie 	(void) conv_expn_field(&conv_arg);
1003731Srie 
1013731Srie 	return ((const char *)string);
1023731Srie }
103