conv.h revision d840867f3a8b0ba209ef90762b3f9c72a5f92cc5
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License (the "License").
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You may not use this file except in compliance with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * Copyright (c) 1988 AT&T
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * All Rights Reserved
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Global include file for conversion library.
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * Configuration features available - maintained here (instead of debug.h)
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * to save libconv from having to include debug.h which results in numerous
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * "declared but not used or defined" lint errors.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_EDLIBPATH 0x000100 /* ELF default library path */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define CONF_ESLIBPATH 0x000200 /* ELF secure library path */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define CONF_ADLIBPATH 0x000400 /* AOUT default library path */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_ASLIBPATH 0x000800 /* AOUT secure library path */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_DIRCFG 0x001000 /* directory configuration available */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_OBJALT 0x002000 /* object alternatives available */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_MEMRESV 0x004000 /* memory reservation required */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_ENVS 0x008000 /* environment variables available */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_FLTR 0x010000 /* filter information available */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Various values that can't be matched to a symbolic definition are converted
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * to a numeric string. Each function that may require this fallback maintains
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * its own static string buffer, as many conversion routines may be called for
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * one final diagnostic. See conv_invalid_val().
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * The string size reflects the largest possible decimal number plus a trailing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * null. Typically however, values are hex with a leading "0x".
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if defined(_ELF64)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Some libconv routines require the caller to supply the buffer used by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * conv_invalid_val().
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Flags that alter standard formatting for conversion routines.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONV_FMT_DECIMAL 0x01 /* conv_invalid_val() should print */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* integer print as decimal */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* (default is hex) */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONV_FMT_SPACE 0x02 /* conv_invalid_val() should append */
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner /* a space after the number. */
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define CONV_FMT_ALTDUMP 0x04 /* Output strings using the versions */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* used by the dump program. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONV_FMT_ALTFILE 0x08 /* Output strings in the form used */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* by the file(1) command */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONV_FMT_ALTCRLE 0x10 /* Output strings in the form used */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* by the crle(1) command */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Mask of CONV_FMT bits that reflect a desire to use alternate strings.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONV_FMTALTMASK (CONV_FMT_ALTDUMP | CONV_FMT_ALTFILE)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * The expansion of bit-field data items is driven from a value descriptor and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the conv_expn_field() routine.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * conv_expn_field() is willing to supply default strings for the
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * prefix, separator, and suffix arguments, if they are passed as NULL.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * The caller needs to know how much room to allow for these items.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * These values supply those sizes.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define CONV_EXPN_FIELD_DEF_PREFIX_SIZE 2 /* Default is "[ " */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define CONV_EXPN_FIELD_DEF_SEP_SIZE 1 /* Default is " " */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 2 /* Default is " ]" */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * conv_expn_field() requires a large number of inputs, many of which
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * can be NULL to accept default behavior. An argument of the following
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * type is used to supply them.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct {
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin const Val_desc *vdp; /* Array of value descriptors, giving the */
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner /* possible bit values, and their */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* corresponding strings. Note that the */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* final element must contain only NULL */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* values. This terminates the list. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin const char **lead_str; /* NULL, or array of pointers to strings to */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* be output at the head of the list. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* Last entry must be NULL. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin Xword oflags; /* Bits for which output strings are desired */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin Xword rflags; /* Bits for which a numeric value should be */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* output if vdp does not provide str. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* Must be a proper subset of oflags */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin const char *prefix; /* NULL, or string to prefix output with */
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz /* If NULL, "[ " is used. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin const char *sep; /* NULL, or string to separate output items */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* with. If NULL, " " is used. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin const char *suffix; /* NULL, or string to suffix output with */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /* If NULL, " ]" is used. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Define all generic interfaces.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern uchar_t conv_check_native(char **, char **);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_config_feat(int);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_config_upm(const char *, const char *,
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner const char *, size_t);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_demangle_name(const char *);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_dl_flag(int, int);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_dl_mode(int, int);
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern const char *conv_lddstub(int);
#if defined(_ELF64)
#ifdef __cplusplus