xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/group.c (revision 2352:9cdfed81bb1c)
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.
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 
33*2352Sab196087 #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
34*2352Sab196087 		MSG_GPH_ZERO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
35*2352Sab196087 		MSG_GPH_LDSO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
36*2352Sab196087 		MSG_GPH_FIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
37*2352Sab196087 		MSG_GPH_PARENT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
38*2352Sab196087 		MSG_GPH_FILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
39*2352Sab196087 		MSG_GPH_INITIAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
40*2352Sab196087 		MSG_GPH_STICKY_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
41*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  * String conversion routine for Grp_hdl flags.
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate const char *
471618Srie conv_grphdl_flags(uint_t flags)
480Sstevel@tonic-gate {
491618Srie 	static char	string[FLAGSZ];
501618Srie 	static Val_desc vda[] = {
511618Srie 		{ GPH_ZERO,		MSG_ORIG(MSG_GPH_ZERO) },
521618Srie 		{ GPH_LDSO,		MSG_ORIG(MSG_GPH_LDSO) },
531618Srie 		{ GPH_FIRST,		MSG_ORIG(MSG_GPH_FIRST) },
541618Srie 		{ GPH_PARENT,		MSG_ORIG(MSG_GPH_PARENT) },
551618Srie 		{ GPH_FILTEE,		MSG_ORIG(MSG_GPH_FILTEE) },
561618Srie 		{ GPH_INITIAL,		MSG_ORIG(MSG_GPH_INITIAL) },
571618Srie 		{ GPH_STICKY,		MSG_ORIG(MSG_GPH_STICKY) },
581618Srie 		{ 0,			0 }
591618Srie 	};
60*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 	if (flags == 0)
630Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_NULL));
640Sstevel@tonic-gate 
65*2352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
66*2352Sab196087 	(void) conv_expn_field(&conv_arg);
670Sstevel@tonic-gate 
680Sstevel@tonic-gate 	return ((const char *)string);
690Sstevel@tonic-gate }
70