1*5088Sab196087 /* 2*5088Sab196087 * CDDL HEADER START 3*5088Sab196087 * 4*5088Sab196087 * The contents of this file are subject to the terms of the 5*5088Sab196087 * Common Development and Distribution License (the "License"). 6*5088Sab196087 * You may not use this file except in compliance with the License. 7*5088Sab196087 * 8*5088Sab196087 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5088Sab196087 * or http://www.opensolaris.org/os/licensing. 10*5088Sab196087 * See the License for the specific language governing permissions 11*5088Sab196087 * and limitations under the License. 12*5088Sab196087 * 13*5088Sab196087 * When distributing Covered Code, include this CDDL HEADER in each 14*5088Sab196087 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5088Sab196087 * If applicable, add the following below this CDDL HEADER, with the 16*5088Sab196087 * fields enclosed by brackets "[]" replaced with your own identifying 17*5088Sab196087 * information: Portions Copyright [yyyy] [name of copyright owner] 18*5088Sab196087 * 19*5088Sab196087 * CDDL HEADER END 20*5088Sab196087 */ 21*5088Sab196087 22*5088Sab196087 /* 23*5088Sab196087 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*5088Sab196087 * Use is subject to license terms. 25*5088Sab196087 */ 26*5088Sab196087 #pragma ident "%Z%%M% %I% %E% SMI" 27*5088Sab196087 28*5088Sab196087 /* 29*5088Sab196087 * String conversion routines for syminfo attributes. 30*5088Sab196087 */ 31*5088Sab196087 #include <stdio.h> 32*5088Sab196087 #include <sys/machelf.h> 33*5088Sab196087 #include "_conv.h" 34*5088Sab196087 #include "syminfo_msg.h" 35*5088Sab196087 36*5088Sab196087 37*5088Sab196087 38*5088Sab196087 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 39*5088Sab196087 MSG_SYMINFO_FLG_DIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 40*5088Sab196087 MSG_SYMINFO_FLG_COPY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 41*5088Sab196087 MSG_SYMINFO_FLG_LAZYLOAD_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 42*5088Sab196087 MSG_SYMINFO_FLG_DIRECTBIND_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 43*5088Sab196087 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 44*5088Sab196087 45*5088Sab196087 /* 46*5088Sab196087 * Ensure that Conv_syminfo_flags_buf_t is large enough: 47*5088Sab196087 * 48*5088Sab196087 * FLAGSZ is the real minimum size of the buffer required by 49*5088Sab196087 * conv_syminfo_flags(). However, Conv_syminfo_flags_buf_t uses 50*5088Sab196087 * CONV_SYMINFO_FLAGS_BUFSIZE to set the buffer size. We do things 51*5088Sab196087 * this way because the definition of FLAGSZ uses information that 52*5088Sab196087 * is not available in the environment of other programs that include 53*5088Sab196087 * the conv.h header file. 54*5088Sab196087 */ 55*5088Sab196087 #if CONV_SYMINFO_FLAGS_BUFSIZE < FLAGSZ 56*5088Sab196087 #error "CONV_SYMINFO_FLAGS_BUFSIZE is not large enough" 57*5088Sab196087 #endif 58*5088Sab196087 59*5088Sab196087 const char * 60*5088Sab196087 conv_syminfo_flags(Xword flags, Conv_fmt_flags_t fmt_flags, 61*5088Sab196087 Conv_syminfo_flags_buf_t *syminfo_flags_buf) 62*5088Sab196087 { 63*5088Sab196087 static Val_desc vda[] = { 64*5088Sab196087 { SYMINFO_FLG_DIRECT, MSG_ORIG(MSG_SYMINFO_FLG_DIRECT) }, 65*5088Sab196087 { SYMINFO_FLG_COPY, MSG_ORIG(MSG_SYMINFO_FLG_COPY) }, 66*5088Sab196087 { SYMINFO_FLG_LAZYLOAD, MSG_ORIG(MSG_SYMINFO_FLG_LAZYLOAD) }, 67*5088Sab196087 { SYMINFO_FLG_DIRECTBIND, 68*5088Sab196087 MSG_ORIG(MSG_SYMINFO_FLG_DIRECTBIND) }, 69*5088Sab196087 { SYMINFO_FLG_NOEXTDIRECT, 70*5088Sab196087 MSG_ORIG(MSG_SYMINFO_FLG_NOEXTDIRECT) }, 71*5088Sab196087 { 0, 0 } 72*5088Sab196087 }; 73*5088Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { 74*5088Sab196087 NULL, sizeof (syminfo_flags_buf->buf), vda }; 75*5088Sab196087 76*5088Sab196087 if (flags == 0) 77*5088Sab196087 return (MSG_ORIG(MSG_GBL_ZERO)); 78*5088Sab196087 79*5088Sab196087 conv_arg.buf = syminfo_flags_buf->buf; 80*5088Sab196087 conv_arg.oflags = conv_arg.rflags = flags; 81*5088Sab196087 conv_arg.prefix = conv_arg.suffix = NULL; 82*5088Sab196087 (void) conv_expn_field(&conv_arg, fmt_flags); 83*5088Sab196087 84*5088Sab196087 return ((const char *)syminfo_flags_buf->buf); 85*5088Sab196087 } 86