xref: /illumos-gate/usr/src/cmd/sgs/libconv/common/group.c (revision ba4e3c84e6b9390bbf7df80b5f1d11dec34cc525)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	<string.h>
29 #include	"rtld.h"
30 #include	"_conv.h"
31 #include	"group_msg.h"
32 
33 #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
34 		MSG_GPH_ZERO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
35 		MSG_GPH_LDSO_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
36 		MSG_GPH_FIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
37 		MSG_GPH_PARENT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
38 		MSG_GPH_FILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
39 		MSG_GPH_INITIAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
40 		MSG_GPH_STICKY_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
41 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
42 
43 /*
44  * String conversion routine for Grp_hdl flags.
45  */
46 const char *
47 conv_grphdl_flags(uint_t flags)
48 {
49 	static char	string[FLAGSZ];
50 	static Val_desc vda[] = {
51 		{ GPH_ZERO,		MSG_ORIG(MSG_GPH_ZERO) },
52 		{ GPH_LDSO,		MSG_ORIG(MSG_GPH_LDSO) },
53 		{ GPH_FIRST,		MSG_ORIG(MSG_GPH_FIRST) },
54 		{ GPH_PARENT,		MSG_ORIG(MSG_GPH_PARENT) },
55 		{ GPH_FILTEE,		MSG_ORIG(MSG_GPH_FILTEE) },
56 		{ GPH_INITIAL,		MSG_ORIG(MSG_GPH_INITIAL) },
57 		{ GPH_STICKY,		MSG_ORIG(MSG_GPH_STICKY) },
58 		{ 0,			0 }
59 	};
60 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
61 
62 	if (flags == 0)
63 		return (MSG_ORIG(MSG_GBL_NULL));
64 
65 	conv_arg.oflags = conv_arg.rflags = flags;
66 	(void) conv_expn_field(&conv_arg);
67 
68 	return ((const char *)string);
69 }
70