corenote.c revision 8fd04b8338ed5093ec2d1e668fa620b7de44c177
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * CDDL HEADER START
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The contents of this file are subject to the terms of the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Common Development and Distribution License (the "License").
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * You may not use this file except in compliance with the License.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * See the License for the specific language governing permissions
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and limitations under the License.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * When distributing Covered Code, include this CDDL HEADER in each
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If applicable, add the following below this CDDL HEADER, with the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fields enclosed by brackets "[]" replaced with your own identifying
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * information: Portions Copyright [yyyy] [name of copyright owner]
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * CDDL HEADER END
8fd04b8338ed5093ec2d1e668fa620b7de44c177Roger A. Faulkner * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Use is subject to license terms.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * String conversion routines the system structs found in
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Solaris core file note sections. These items are not
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * ELF constructs. However, elfdump contains code for decoding
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * them, and therefore requires formatting support.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#include <_conv.h>
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_types_2000_2011 = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_types_2014_2022 = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_sigarr), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sig, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_fltarr), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, flt, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_sysnumarr), NULL };
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Range check, and handle the unused values in the middle
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * of the range. Although the missing values have strings,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * we still prefer to format them, because those strings are
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * decimal, and the default behavior, unless the CONV_FMT_DECIMAL
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * flag is set, is to display such things in hex.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (sysnum) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sysnum, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_errarr_120_134 = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_errarr_143_151 = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_errarr_1_74),
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami CONV_DS_ADDR(ds_errarr_77_99), CONV_DS_ADDR(ds_errarr_120_134),
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, errno_val, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_pr_dmodel(Word dmodel, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_models), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, dmodel, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_why_arr), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, why, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_pr_what(short why, short what, Conv_fmt_flags_t fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The meaning of pr_what depends on the corresponding
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * value of pr_why, as discussed in the proc(4) manpage.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (why) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Return the name of the general purpose register indexed by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * regno in the pr_reg array of lwpstatus_t (<sys/procfs.h>).
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_sparc_32_37_reg = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_sparcv9_32_37_reg = {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (mach) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_invalid_val(inv_buf, regno, fmt_flags));
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, mach, regno, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_pr_stype(Word stype, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_types = { CONV_DS_MSG_INIT(0, types) };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, stype, ds, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const char *fmt;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The PRIV_ constants defined in <sys/priv.h> are unusual
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * in that they are negative values. The libconv code is all
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * built around the Word type, which is unsigned. Rather than
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * modify libconv for this one case, we simply handle
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * these constants differently that the usual approach,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * and stay away from conv_invalid_val() and conv_map_ds().
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (priv) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, priv);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const char *fmt;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The PS_ constants defined in <sys/pset.h> are unusual
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * in that they are negative values. The libconv code is all
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * built around the Word type, which is unsigned. Rather than
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * modify libconv for this one case, we simply handle
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * these constants differently that the usual approach,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * and stay away from conv_invalid_val() and conv_map_ds().
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (id) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, id);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Return a string describing the si_code field of
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the siginfo_t struct.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The meaning of si_code is dependent on both the target
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * machine (mach) as well as the signal (sig).
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* Values of si_code for user generated signals */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Architecture dependent system generated signals. All
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * versions of Solaris use the same set of these values.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Architecture dependent system generated signals.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * These items (ILL, EMT, FPE, SEGV, BUS) are platform
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * dependent. Some architectures have extra codes.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The same name may have a different integer value.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Multiple arrays are used when they differ, and one
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * array when all the architectures agree.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_msg_emt_arr_sparc = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_msg_emt_arr_x86 = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_msg_fpe_arr_sparc = {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_ds_msg_t ds_msg_fpe_arr_x86 = {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* SEGV */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* Handle the si_code values that do not depend on the signal */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* User generated signal codes are <= 0 */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (si_code <= 0) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If no signal was delivered, and si_code is
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * 0, return "0" rather than "SI_USER".
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab const char *fmt;
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, ndx,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * If we didn't return above, then this is a
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * system generated signal, and the meaning of si_code
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * depends on the signal that was delivered, and possibly
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * on the target architecture.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (mach) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (sig) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (arch) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab switch (arch) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* If not recognized, format as a number */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_AUXV_AF_SUN_SETUGID_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_AUXV_AF_SUN_HWCAPVERIFY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_AUXV_AF_SUN_NOPLM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_auxv_af_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * AUXAFFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_auxv_af(). However, Conv_cnote_auxv_af_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_AUXV_AF_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of AUXAFFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_AUXV_AF_BUFSIZE != AUXAFFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_AUXV_AF_BUFSIZE does not match AUXAFFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_auxv_af(Word flags, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { AF_SUN_HWCAPVERIFY, MSG_AUXV_AF_SUN_HWCAPVERIFY },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_STACK_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_HEAP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_SHFILE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_SHANON_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_TEXT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_DATA_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_RODATA_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_ANON_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_SHM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_ISM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_DISM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_CTF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_CC_CONTENT_SYMTAB_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_cc_content_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * CCFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_cc_content(). However, Conv_cnote_cc_content_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_CC_CONTENT_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of CCFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_CC_CONTENT_BUFSIZE != CCFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_CC_CONTENT_BUFSIZE does not match CCFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_cc_content(Lword flags, Conv_fmt_flags_t fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Note: core_content_t is a 64-bit integer value, but our
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_expn_field() logic is all built around 32-bit
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Word values. This will probably need changing someday,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * but for now, we make do with the 32-bit engine. This works
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * because the number of bits actually assigned in
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the core_content_t data type (<sys/corectl.h>) bits within
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * 32-bits.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * The downside is that any bits set in the upper half of
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the flags will be ignored. At the time of this writing,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that can only occur via core file corruption, which presumably
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * would be evident in other ways.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_STACK, MSG_CC_CONTENT_STACK },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_HEAP, MSG_CC_CONTENT_HEAP },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_SHFILE, MSG_CC_CONTENT_SHFILE },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_SHANON, MSG_CC_CONTENT_SHANON },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_TEXT, MSG_CC_CONTENT_TEXT },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_DATA, MSG_CC_CONTENT_DATA },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_RODATA, MSG_CC_CONTENT_RODATA },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_ANON, MSG_CC_CONTENT_ANON },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_DISM, MSG_CC_CONTENT_DISM },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { (Word) CC_CONTENT_SYMTAB, MSG_CC_CONTENT_SYMTAB },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_STOPPED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ISTOP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_DSTOP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_STEP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASLEEP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_PCINVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASLWP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_AGENT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_DETACH_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_DAEMON_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_IDLE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ISSYS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_VFORKP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ORPHAN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_NOSIGCHLD_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_WAITPID_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_FORK_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASYNC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_MSACCT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_BPTADJ_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_PTRACE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_MSFORK_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_pr_flags_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * PRFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_pr_flags(). However, Conv_cnote_pr_flags_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_PR_FLAGS_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of PRFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_PR_FLAGS_BUFSIZE != PRFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_PR_FLAGS_BUFSIZE does not match PRFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_STOPPED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ISTOP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_DSTOP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASLEEP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_FORK_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_PTRACE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_PCINVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ISSYS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_STEP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASYNC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_PCOMPAT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_MSACCT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_BPTADJ_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PR_FLAGS_ASLWP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_old_pr_flags_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * OLDPRFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_old_pr_flags(). However, Conv_cnote_old_pr_flags_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of OLDPRFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE != OLDPRFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE does not match OLDPRFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_old_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * <sys/old_procfs.h> defines names for many of these flags
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that are also defined in <sys/procfs.h>, but with different
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * values. To avoid confusion, we don't include <sys/old_procfs.h>,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and specify the values directly.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PROC_FLAG_SSYS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_PROC_FLAG_SMSACCT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_proc_flag_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * PROCFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_proc_flag(). However, Conv_cnote_proc_flag_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_PROC_FLAG_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of PROCFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_PROC_FLAG_BUFSIZE != PROCFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_PROC_FLAG_BUFSIZE does not match PROCFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_proc_flag(int flags, Conv_fmt_flags_t fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Most of the proc flags are implementation dependant, and can
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * change between releases. As such, we do not attempt to translate
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * them to symbolic form, but simply report them in hex form.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * However, SMSACCT and SSYS are special, and their bit values
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * are maintained between releases so they can be used in the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * psinfo_t.p_flag field. We therefore translate these items.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Note: We don't want to include <sys/proc.h> in this file, because
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * it redefines 'struct list', which we have defined in sgs.h. As
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * SMSACCT and SSYS are stable public values, we simply use
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * their numeric value.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_sa_flags_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * SAFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_sa_flags(). However, Conv_cnote_sa_flags_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_SA_FLAGS_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of SAFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_SA_FLAGS_BUFSIZE != SAFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_SA_FLAGS_BUFSIZE does not match SAFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_sa_flags(int flags, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_ss_flags_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * SSFLGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_ss_flags(). However, Conv_cnote_ss_flags_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_SS_FLAGS_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of SSFLGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_SS_FLAGS_BUFSIZE != SSFLGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_SS_FLAGS_BUFSIZE does not match SSFLGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) conv_expn_field(&conv_arg, vda, fmt_flags);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Solaris has a variety of types that use bitmasks to represent
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sets of things like signals (sigset_t), faults (fltset_t), and
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * system calls (sysset_t). These types use arrays of unsigned 32-bit
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * integers to represent the set. These are public types that
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * cannot be changed, so they are generously oversized to allow
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * for future growth. Hence, there are usually unused bits.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_bitmaskset() generalizes the process of displaying these items.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abtypedef struct {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami const Val_desc *vdp; /* NULL, or bitmask description */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * n_mask - # of 32-bit masks that make up this bitmask type.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * maskarr - Array of n_mask 32-bit mask values
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * bitmask_descarr - Array of n_mask bitmask_desc_t descriptors,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * one for each mask, specifying the bitmask names, and
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * a mask of the bits that are not defined by the system.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fmt_flags - CONV_FMT_* values, used to specify formatting details.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_buf - Buffer to receive formatted results
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_buf_size - Size of conv_buf, including room for NULL termination
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abstatic const char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami const conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab int i, need_sep = 0;
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* If every bit of every mask is 0, return 0 as the result */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < n_mask; i++)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (maskarr[i] != 0)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * At least one bit is non-zero. Move through the masks
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * and process each one.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_expn_field() orders its output with the most significant
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * bits on the left. To preserve this ordering across the
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * subwords or our "virtual bitmask", we need to process
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the sub-words in the same order, from most significant down
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * to least significant. Since unassigned bits tend to be at
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the MSB end of the word, we process the unused bits first.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * One implication of this is that the caller should not use
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * the unassigned bits for "abandoned" bits in the middle of
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * a used range, but should instead define the string for
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that bit as being the string representation of that decimal
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * value (i.e. "65"). That will cause the bit to be properly
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sorted among the named bits to either side of it.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab for (i = 0; i < n_mask; i++) {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab if (mask != 0) {
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami bitmask_descarr[i].vdp, fmt_flags | CONV_FMT_NOBKT);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return ((const char *) conv_buf);
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sigset_t [0] - Signals [1 - 32] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_SIGVTALRM_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_SIGWAITING_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sigset_t [1] - Signals [33 - 64] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 24 unused bits, each of which needs two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters plus a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_SIGFREEZE_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_SIGCANCEL_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sigset_t [2] - Signals [65 - 96] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 32 unused bits, each of which needs two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters plus a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * sigset_t [2] - Signals [97 - 128] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 32 unused bits. Three of these need two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters, and 29 need 3. Each one needs a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_sigset_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * SIGSET_FLAGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_sigset(). However, Conv_cnote_sigset_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_SIGSET_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of SIGSET_FLAGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_SIGSET_BUFSIZE != SIGSET_FLAGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_SIGSET_BUFSIZE does not match SIGSET_FLAGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab Conv_fmt_flags_t fmt_flags, Conv_cnote_sigset_buf_t *cnote_sigset_buf)
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fltset_t[0] - Faults [1 - 32] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 19 unused bits, each of which needs two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters plus a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_FLTACCESS_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_FLTBOUNDS_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab MSG_FLTCPCOVF_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fltset_t [1] - Faults [33 - 64] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 32 unused bits, each of which needs two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters plus a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fltset_t [2] - Faults [65 - 96] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 32 unused bits, each of which needs two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters plus a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * fltset_t [3] - Faults [97 - 128] \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * There are 32 unused bits. Three of these need two \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * characters, and 29 need 3. Each one needs a separator. \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_fltset_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * FLTSET_FLAGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_fltset(). However, Conv_cnote_fltset_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_FLTSET_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of FLTSET_FLAGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_FLTSET_BUFSIZE != FLTSET_FLAGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_FLTSET_BUFSIZE does not match FLTSET_FLAGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab Conv_fmt_flags_t fmt_flags, Conv_cnote_fltset_buf_t *cnote_fltset_buf)
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[0] - System Calls [1 - 32] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[1] - System Calls [33 - 64] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[2] - System Calls [65 - 96] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[3] - System Calls [97 - 128] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[4] - System Calls [129 - 160] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[5] - System Calls [161 - 192] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[6] - System Calls [193 - 224] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[7] - System Calls [225 - 256] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[8] - System Calls [257 - 288] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[9] - System Calls [289 - 320] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[10] - System Calls [321 - 352] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[11] - System Calls [353 - 384] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[12] - System Calls [385 - 416] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[13] - System Calls [417 - 448] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[14] - System Calls [449 - 480] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* sysset_t[15] - System Calls [481 - 512] */ \
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * Ensure that Conv_cnote_sysset_buf_t is large enough:
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * SYSSET_FLAGSZ is the real minimum size of the buffer required by
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * conv_cnote_sysset(). However, Conv_cnote_sysset_buf_t
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * uses CONV_CNOTE_SYSSET_BUFSIZE to set the buffer size. We do
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * things this way because the definition of SYSSET_FLAGSZ uses information
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that is not available in the environment of other programs
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab * that include the conv.h header file.
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#if (CONV_CNOTE_SYSSET_BUFSIZE != SYSSET_FLAGSZ) && !defined(__lint)
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab#error "CONV_CNOTE_SYSSET_BUFSIZE does not match SYSSET_FLAGSZ"
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87abconst char *
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab Conv_fmt_flags_t fmt_flags, Conv_cnote_sysset_buf_t *cnote_sysset_buf)
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda0[] = { /* System Calls [1 - 32] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda1[] = { /* System Calls [33 - 64] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda2[] = { /* System Calls [65 - 96] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda3[] = { /* System Calls [97 - 128] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda4[] = { /* System Calls [129 - 160] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda5[] = { /* System Calls [161 - 192] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda6[] = { /* System Calls [193 - 224] */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { 0x00008000, MSG_SYS_SPARC_UTRAP_INSTALL_ALT },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami { 0x00020000, MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT },
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const Val_desc vda7[] = { /* System Calls [225 - 256] */
c6c9aed4d309e3d11be652b85e3bf8bb72f20c87ab /* 256 (unused) */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {