xref: /titanic_52/usr/src/cmd/sgs/libconv/common/group.c (revision f498645a3eecf2ddd304b4ea9c7f1b4c155ff79e)
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	MSG_GBL_OSQBRKT_SIZE + \
34 		MSG_GPH_ZERO_SIZE + \
35 		MSG_GPH_LDSO_SIZE + \
36 		MSG_GPH_FIRST_SIZE + \
37 		MSG_GPH_PARENT_SIZE + \
38 		MSG_GPH_FILTEE_SIZE + \
39 		MSG_GPH_INITIAL_SIZE + \
40 		MSG_GPH_STICKY_SIZE + \
41 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_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 
61 	if (flags == 0)
62 		return (MSG_ORIG(MSG_GBL_NULL));
63 
64 	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
65 	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
66 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
67 
68 	return ((const char *)string);
69 }
70