Home | History | Annotate | Download | only in common
      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 2009 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 /*
     28  * String conversion routines the system structs found in
     29  * Solaris core file note sections. These items are not
     30  * ELF constructs. However, elfdump contains code for decoding
     31  * them, and therefore requires formatting support.
     32  */
     33 #include	<stdio.h>
     34 #include	<procfs.h>
     35 #include	<sys/corectl.h>
     36 #include	<string.h>
     37 #include	<_conv.h>
     38 #include	<corenote_msg.h>
     39 
     40 const char *
     41 conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
     42     Conv_inv_buf_t *inv_buf)
     43 {
     44 	static const Msg	types[] = {
     45 		MSG_NT_PRSTATUS,	MSG_NT_PRFPREG,
     46 		MSG_NT_PRPSINFO,	MSG_NT_PRXREG,
     47 		MSG_NT_PLATFORM,	MSG_NT_AUXV,
     48 		MSG_NT_GWINDOWS,	MSG_NT_ASRS,
     49 		MSG_NT_LDT,		MSG_NT_PSTATUS,
     50 		0,			0,
     51 		MSG_NT_PSINFO,		MSG_NT_PRCRED,
     52 		MSG_NT_UTSNAME,		MSG_NT_LWPSTATUS,
     53 		MSG_NT_LWPSINFO,	MSG_NT_PRPRIV,
     54 		MSG_NT_PRPRIVINFO,	MSG_NT_CONTENT,
     55 		MSG_NT_ZONENAME
     56 	};
     57 #if NT_NUM != NT_ZONENAME
     58 #error "NT_NUM has grown. Update core note types[]"
     59 #endif
     60 	static const conv_ds_msg_t ds_types = {
     61 	    CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
     62 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_types), NULL };
     63 
     64 
     65 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
     66 	    inv_buf));
     67 }
     68 
     69 
     70 const char *
     71 conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
     72     Conv_inv_buf_t *inv_buf)
     73 {
     74 	static const Msg	types_0_22[] = {
     75 		MSG_AUXV_AT_NULL,		MSG_AUXV_AT_IGNORE,
     76 		MSG_AUXV_AT_EXECFD,		MSG_AUXV_AT_PHDR,
     77 		MSG_AUXV_AT_PHENT,		MSG_AUXV_AT_PHNUM,
     78 		MSG_AUXV_AT_PAGESZ,		MSG_AUXV_AT_BASE,
     79 		MSG_AUXV_AT_FLAGS,		MSG_AUXV_AT_ENTRY,
     80 		MSG_AUXV_AT_NOTELF,		MSG_AUXV_AT_UID,
     81 		MSG_AUXV_AT_EUID,		MSG_AUXV_AT_GID,
     82 		MSG_AUXV_AT_EGID,		MSG_AUXV_AT_PLATFORM,
     83 		MSG_AUXV_AT_HWCAP,		MSG_AUXV_AT_CLKTCK,
     84 		MSG_AUXV_AT_FPUCW,		MSG_AUXV_AT_DCACHEBSIZE,
     85 		MSG_AUXV_AT_ICACHEBSIZE,	MSG_AUXV_AT_UCACHEBSIZE,
     86 		MSG_AUXV_AT_IGNOREPPC
     87 	};
     88 	static const conv_ds_msg_t ds_types_0_22 = {
     89 	    CONV_DS_MSG_INIT(0, types_0_22) };
     90 
     91 	static const Msg	types_2000_2011[] = {
     92 		MSG_AUXV_AT_SUN_UID,		MSG_AUXV_AT_SUN_RUID,
     93 		MSG_AUXV_AT_SUN_GID,		MSG_AUXV_AT_SUN_RGID,
     94 		MSG_AUXV_AT_SUN_LDELF,		MSG_AUXV_AT_SUN_LDSHDR,
     95 		MSG_AUXV_AT_SUN_LDNAME,		MSG_AUXV_AT_SUN_LPAGESZ,
     96 		MSG_AUXV_AT_SUN_PLATFORM,	MSG_AUXV_AT_SUN_HWCAP,
     97 		MSG_AUXV_AT_SUN_IFLUSH,		MSG_AUXV_AT_SUN_CPU
     98 	};
     99 	static const conv_ds_msg_t ds_types_2000_2011 = {
    100 	    CONV_DS_MSG_INIT(2000, types_2000_2011) };
    101 
    102 	static const Msg	types_2014_2022[] = {
    103 		MSG_AUXV_AT_SUN_EXECNAME,	MSG_AUXV_AT_SUN_MMU,
    104 		MSG_AUXV_AT_SUN_LDDATA,		MSG_AUXV_AT_SUN_AUXFLAGS,
    105 		MSG_AUXV_AT_SUN_EMULATOR,	MSG_AUXV_AT_SUN_BRANDNAME,
    106 		MSG_AUXV_AT_SUN_BRAND_AUX1,	MSG_AUXV_AT_SUN_BRAND_AUX2,
    107 		MSG_AUXV_AT_SUN_BRAND_AUX3
    108 	};
    109 	static const conv_ds_msg_t ds_types_2014_2022 = {
    110 	    CONV_DS_MSG_INIT(2014, types_2014_2022) };
    111 
    112 	static const conv_ds_t	*ds[] = {
    113 		CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
    114 		CONV_DS_ADDR(ds_types_2014_2022), NULL };
    115 
    116 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
    117 	    inv_buf));
    118 }
    119 
    120 
    121 const char *
    122 conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
    123     Conv_inv_buf_t *inv_buf)
    124 {
    125 	static const Msg	sigarr[] = {
    126 		MSG_SIGHUP,		MSG_SIGINT,
    127 		MSG_SIGQUIT,		MSG_SIGILL,
    128 		MSG_SIGTRAP,		MSG_SIGABRT,
    129 		MSG_SIGEMT,		MSG_SIGFPE,
    130 		MSG_SIGKILL,		MSG_SIGBUS,
    131 		MSG_SIGSEGV,		MSG_SIGSYS,
    132 		MSG_SIGPIPE,		MSG_SIGALRM,
    133 		MSG_SIGTERM,		MSG_SIGUSR1,
    134 		MSG_SIGUSR2,		MSG_SIGCHLD,
    135 		MSG_SIGPWR,		MSG_SIGWINCH,
    136 		MSG_SIGURG,		MSG_SIGPOLL,
    137 		MSG_SIGSTOP,		MSG_SIGTSTP,
    138 		MSG_SIGCONT,		MSG_SIGTTIN,
    139 		MSG_SIGTTOU,		MSG_SIGVTALRM,
    140 		MSG_SIGPROF,		MSG_SIGXCPU,
    141 		MSG_SIGXFSZ,		MSG_SIGWAITING,
    142 		MSG_SIGLWP,		MSG_SIGFREEZE,
    143 		MSG_SIGTHAW,		MSG_SIGCANCEL,
    144 		MSG_SIGLOST,		MSG_SIGXRES,
    145 		MSG_SIGJVM1,		MSG_SIGJVM2,
    146 	};
    147 	static const conv_ds_msg_t ds_sigarr = {
    148 	    CONV_DS_MSG_INIT(SIGHUP, sigarr) };
    149 
    150 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_sigarr), NULL };
    151 
    152 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sig, ds, fmt_flags,
    153 	    inv_buf));
    154 }
    155 
    156 
    157 const char *
    158 conv_cnote_fault(Word flt, Conv_fmt_flags_t fmt_flags,
    159     Conv_inv_buf_t *inv_buf)
    160 {
    161 	static const Msg	fltarr[] = {
    162 		MSG_FLTILL,		MSG_FLTPRIV,
    163 		MSG_FLTBPT,		MSG_FLTTRACE,
    164 		MSG_FLTACCESS,		MSG_FLTBOUNDS,
    165 		MSG_FLTIOVF,		MSG_FLTIZDIV,
    166 		MSG_FLTFPE,		MSG_FLTSTACK,
    167 		MSG_FLTPAGE,		MSG_FLTWATCH,
    168 		MSG_FLTCPCOVF
    169 
    170 	};
    171 	static const conv_ds_msg_t ds_fltarr = {
    172 	    CONV_DS_MSG_INIT(FLTILL, fltarr) };
    173 
    174 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_fltarr), NULL };
    175 
    176 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, flt, ds, fmt_flags,
    177 	    inv_buf));
    178 }
    179 
    180 
    181 const char *
    182 conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
    183     Conv_inv_buf_t *inv_buf)
    184 {
    185 	static const Msg	sysnumarr[] = {
    186 		MSG_SYS_EXIT,			MSG_SYS_FORKALL,
    187 		MSG_SYS_READ,			MSG_SYS_WRITE,
    188 		MSG_SYS_OPEN,			MSG_SYS_CLOSE,
    189 		MSG_SYS_WAIT,			MSG_SYS_CREAT,
    190 		MSG_SYS_LINK,			MSG_SYS_UNLINK,
    191 		MSG_SYS_EXEC,			MSG_SYS_CHDIR,
    192 		MSG_SYS_TIME,			MSG_SYS_MKNOD,
    193 		MSG_SYS_CHMOD,			MSG_SYS_CHOWN,
    194 		MSG_SYS_BRK,			MSG_SYS_STAT,
    195 		MSG_SYS_LSEEK,			MSG_SYS_GETPID,
    196 		MSG_SYS_MOUNT,			MSG_SYS_UMOUNT,
    197 		MSG_SYS_SETUID,			MSG_SYS_GETUID,
    198 		MSG_SYS_STIME,			MSG_SYS_PCSAMPLE,
    199 		MSG_SYS_ALARM,			MSG_SYS_FSTAT,
    200 		MSG_SYS_PAUSE,			MSG_SYS_UTIME,
    201 		MSG_SYS_STTY,			MSG_SYS_GTTY,
    202 		MSG_SYS_ACCESS,			MSG_SYS_NICE,
    203 		MSG_SYS_STATFS,			MSG_SYS_SYNC,
    204 		MSG_SYS_KILL,			MSG_SYS_FSTATFS,
    205 		MSG_SYS_PGRPSYS,		MSG_SYS_UUCOPYSTR,
    206 		MSG_SYS_DUP,			MSG_SYS_PIPE,
    207 		MSG_SYS_TIMES,			MSG_SYS_PROFIL,
    208 		MSG_SYS_PLOCK,			MSG_SYS_SETGID,
    209 		MSG_SYS_GETGID,			MSG_SYS_SIGNAL,
    210 		MSG_SYS_MSGSYS,			MSG_SYS_SYSI86,
    211 		MSG_SYS_ACCT,			MSG_SYS_SHMSYS,
    212 		MSG_SYS_SEMSYS,			MSG_SYS_IOCTL,
    213 		MSG_SYS_UADMIN,			MSG_SYS_56,
    214 		MSG_SYS_UTSSYS,			MSG_SYS_FDSYNC,
    215 		MSG_SYS_EXECVE,			MSG_SYS_UMASK,
    216 		MSG_SYS_CHROOT,			MSG_SYS_FCNTL,
    217 		MSG_SYS_ULIMIT,			MSG_SYS_64,
    218 		MSG_SYS_65,			MSG_SYS_66,
    219 		MSG_SYS_67,			MSG_SYS_68,
    220 		MSG_SYS_69,			MSG_SYS_TASKSYS,
    221 		MSG_SYS_ACCTCTL,		MSG_SYS_EXACCTSYS,
    222 		MSG_SYS_GETPAGESIZES,		MSG_SYS_RCTLSYS,
    223 		MSG_SYS_SIDSYS,			MSG_SYS_FSAT,
    224 		MSG_SYS_LWP_PARK,		MSG_SYS_SENDFILEV,
    225 		MSG_SYS_RMDIR,			MSG_SYS_MKDIR,
    226 		MSG_SYS_GETDENTS,		MSG_SYS_PRIVSYS,
    227 		MSG_SYS_UCREDSYS,		MSG_SYS_SYSFS,
    228 		MSG_SYS_GETMSG,			MSG_SYS_PUTMSG,
    229 		MSG_SYS_POLL,			MSG_SYS_LSTAT,
    230 		MSG_SYS_SYMLINK,		MSG_SYS_READLINK,
    231 		MSG_SYS_SETGROUPS,		MSG_SYS_GETGROUPS,
    232 		MSG_SYS_FCHMOD,			MSG_SYS_FCHOWN,
    233 		MSG_SYS_SIGPROCMASK,		MSG_SYS_SIGSUSPEND,
    234 		MSG_SYS_SIGALTSTACK,		MSG_SYS_SIGACTION,
    235 		MSG_SYS_SIGPENDING,		MSG_SYS_CONTEXT,
    236 		MSG_SYS_EVSYS,			MSG_SYS_EVTRAPRET,
    237 		MSG_SYS_STATVFS,		MSG_SYS_FSTATVFS,
    238 		MSG_SYS_GETLOADAVG,		MSG_SYS_NFSSYS,
    239 		MSG_SYS_WAITID,			MSG_SYS_SIGSENDSYS,
    240 		MSG_SYS_HRTSYS,			MSG_SYS_110,
    241 		MSG_SYS_SIGRESEND,		MSG_SYS_PRIOCNTLSYS,
    242 		MSG_SYS_PATHCONF,		MSG_SYS_MINCORE,
    243 		MSG_SYS_MMAP,			MSG_SYS_MPROTECT,
    244 		MSG_SYS_MUNMAP,			MSG_SYS_FPATHCONF,
    245 		MSG_SYS_VFORK,			MSG_SYS_FCHDIR,
    246 		MSG_SYS_READV,			MSG_SYS_WRITEV,
    247 		MSG_SYS_XSTAT,			MSG_SYS_LXSTAT,
    248 		MSG_SYS_FXSTAT,			MSG_SYS_XMKNOD,
    249 		MSG_SYS_127,			MSG_SYS_SETRLIMIT,
    250 		MSG_SYS_GETRLIMIT,		MSG_SYS_LCHOWN,
    251 		MSG_SYS_MEMCNTL,		MSG_SYS_GETPMSG,
    252 		MSG_SYS_PUTPMSG,		MSG_SYS_RENAME,
    253 		MSG_SYS_UNAME,			MSG_SYS_SETEGID,
    254 		MSG_SYS_SYSCONFIG,		MSG_SYS_ADJTIME,
    255 		MSG_SYS_SYSTEMINFO,		MSG_SYS_SHAREFS,
    256 		MSG_SYS_SETEUID,		MSG_SYS_FORKSYS,
    257 		MSG_SYS_FORK1,			MSG_SYS_SIGTIMEDWAIT,
    258 		MSG_SYS_LWP_INFO,		MSG_SYS_YIELD,
    259 		MSG_SYS_LWP_SEMA_WAIT,		MSG_SYS_LWP_SEMA_POST,
    260 		MSG_SYS_LWP_SEMA_TRYWAIT,	MSG_SYS_LWP_DETACH,
    261 		MSG_SYS_CORECTL,		MSG_SYS_MODCTL,
    262 		MSG_SYS_FCHROOT,		MSG_SYS_UTIMES,
    263 		MSG_SYS_VHANGUP,		MSG_SYS_GETTIMEOFDAY,
    264 		MSG_SYS_GETITIMER,		MSG_SYS_SETITIMER,
    265 		MSG_SYS_LWP_CREATE,		MSG_SYS_LWP_EXIT,
    266 		MSG_SYS_LWP_SUSPEND,		MSG_SYS_LWP_CONTINUE,
    267 		MSG_SYS_LWP_KILL,		MSG_SYS_LWP_SELF,
    268 		MSG_SYS_LWP_SIGMASK,		MSG_SYS_LWP_PRIVATE,
    269 		MSG_SYS_LWP_WAIT,		MSG_SYS_LWP_MUTEX_WAKEUP,
    270 		MSG_SYS_LWP_MUTEX_LOCK,		MSG_SYS_LWP_COND_WAIT,
    271 		MSG_SYS_LWP_COND_SIGNAL,	MSG_SYS_LWP_COND_BROADCAST,
    272 		MSG_SYS_PREAD,			MSG_SYS_PWRITE,
    273 		MSG_SYS_LLSEEK,			MSG_SYS_INST_SYNC,
    274 		MSG_SYS_BRAND,			MSG_SYS_KAIO,
    275 		MSG_SYS_CPC,			MSG_SYS_LGRPSYS,
    276 		MSG_SYS_RUSAGESYS,		MSG_SYS_PORT,
    277 		MSG_SYS_POLLSYS,		MSG_SYS_LABELSYS,
    278 		MSG_SYS_ACL,			MSG_SYS_AUDITSYS,
    279 		MSG_SYS_PROCESSOR_BIND,		MSG_SYS_PROCESSOR_INFO,
    280 		MSG_SYS_P_ONLINE,		MSG_SYS_SIGQUEUE,
    281 		MSG_SYS_CLOCK_GETTIME,		MSG_SYS_CLOCK_SETTIME,
    282 		MSG_SYS_CLOCK_GETRES,		MSG_SYS_TIMER_CREATE,
    283 		MSG_SYS_TIMER_DELETE,		MSG_SYS_TIMER_SETTIME,
    284 		MSG_SYS_TIMER_GETTIME,		MSG_SYS_TIMER_GETOVERRUN,
    285 		MSG_SYS_NANOSLEEP,		MSG_SYS_FACL,
    286 		MSG_SYS_DOOR,			MSG_SYS_SETREUID,
    287 		MSG_SYS_SETREGID,		MSG_SYS_INSTALL_UTRAP,
    288 		MSG_SYS_SIGNOTIFY,		MSG_SYS_SCHEDCTL,
    289 		MSG_SYS_PSET,			MSG_SYS_SPARC_UTRAP_INSTALL,
    290 		MSG_SYS_RESOLVEPATH,		MSG_SYS_LWP_MUTEX_TIMEDLOCK,
    291 		MSG_SYS_LWP_SEMA_TIMEDWAIT,	MSG_SYS_LWP_RWLOCK_SYS,
    292 		MSG_SYS_GETDENTS64,		MSG_SYS_MMAP64,
    293 		MSG_SYS_STAT64,			MSG_SYS_LSTAT64,
    294 		MSG_SYS_FSTAT64,		MSG_SYS_STATVFS64,
    295 		MSG_SYS_FSTATVFS64,		MSG_SYS_SETRLIMIT64,
    296 		MSG_SYS_GETRLIMIT64,		MSG_SYS_PREAD64,
    297 		MSG_SYS_PWRITE64,		MSG_SYS_CREAT64,
    298 		MSG_SYS_OPEN64,			MSG_SYS_RPCSYS,
    299 		MSG_SYS_ZONE,			MSG_SYS_AUTOFSSYS,
    300 		MSG_SYS_GETCWD,			MSG_SYS_SO_SOCKET,
    301 		MSG_SYS_SO_SOCKETPAIR,		MSG_SYS_BIND,
    302 		MSG_SYS_LISTEN,			MSG_SYS_ACCEPT,
    303 		MSG_SYS_CONNECT,		MSG_SYS_SHUTDOWN,
    304 		MSG_SYS_RECV,			MSG_SYS_RECVFROM,
    305 		MSG_SYS_RECVMSG,		MSG_SYS_SEND,
    306 		MSG_SYS_SENDMSG,		MSG_SYS_SENDTO,
    307 		MSG_SYS_GETPEERNAME,		MSG_SYS_GETSOCKNAME,
    308 		MSG_SYS_GETSOCKOPT,		MSG_SYS_SETSOCKOPT,
    309 		MSG_SYS_SOCKCONFIG,		MSG_SYS_NTP_GETTIME,
    310 		MSG_SYS_NTP_ADJTIME,		MSG_SYS_LWP_MUTEX_UNLOCK,
    311 		MSG_SYS_LWP_MUTEX_TRYLOCK,	MSG_SYS_LWP_MUTEX_REGISTER,
    312 		MSG_SYS_CLADM,			MSG_SYS_UUCOPY,
    313 		MSG_SYS_UMOUNT2
    314 	};
    315 	static const conv_ds_msg_t ds_sysnumarr = {
    316 	    CONV_DS_MSG_INIT(1, sysnumarr) };
    317 
    318 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_sysnumarr), NULL };
    319 
    320 	int	use_num = 0;
    321 
    322 	/*
    323 	 * Range check, and handle the unused values in the middle
    324 	 * of the range. Although the missing values have strings,
    325 	 * we still prefer to format them, because those strings are
    326 	 * decimal, and the default behavior, unless the CONV_FMT_DECIMAL
    327 	 * flag is set, is to display such things in hex.
    328 	 */
    329 	switch (sysnum) {
    330 	case 0:
    331 	case 56:
    332 	case SYS_reserved_64:
    333 	case SYS_reserved_65:
    334 	case SYS_reserved_66:
    335 	case SYS_reserved_67:
    336 	case SYS_reserved_68:
    337 	case SYS_reserved_69:
    338 	case 110:
    339 	case 127:
    340 		use_num = 1;
    341 		break;
    342 	default:
    343 		use_num = (sysnum > SYS_umount2);
    344 		break;
    345 	}
    346 	if (use_num)
    347 		return (conv_invalid_val(inv_buf, sysnum, fmt_flags));
    348 
    349 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sysnum, ds, fmt_flags,
    350 	    inv_buf));
    351 }
    352 
    353 
    354 const char *
    355 conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
    356     Conv_inv_buf_t *inv_buf)
    357 {
    358 	static const Msg	errarr_1_74[74] = {
    359 		MSG_ERRNO_EPERM,		MSG_ERRNO_ENOENT,
    360 		MSG_ERRNO_ESRCH,		MSG_ERRNO_EINTR,
    361 		MSG_ERRNO_EIO,			MSG_ERRNO_ENXIO,
    362 		MSG_ERRNO_E2BIG,		MSG_ERRNO_ENOEXEC,
    363 		MSG_ERRNO_EBADF,		MSG_ERRNO_ECHILD,
    364 		MSG_ERRNO_EAGAIN,		MSG_ERRNO_ENOMEM,
    365 		MSG_ERRNO_EACCES,		MSG_ERRNO_EFAULT,
    366 		MSG_ERRNO_ENOTBLK,		MSG_ERRNO_EBUSY,
    367 		MSG_ERRNO_EEXIST,		MSG_ERRNO_EXDEV,
    368 		MSG_ERRNO_ENODEV,		MSG_ERRNO_ENOTDIR,
    369 		MSG_ERRNO_EISDIR,		MSG_ERRNO_EINVAL,
    370 		MSG_ERRNO_ENFILE,		MSG_ERRNO_EMFILE,
    371 		MSG_ERRNO_ENOTTY,		MSG_ERRNO_ETXTBSY,
    372 		MSG_ERRNO_EFBIG,		MSG_ERRNO_ENOSPC,
    373 		MSG_ERRNO_ESPIPE,		MSG_ERRNO_EROFS,
    374 		MSG_ERRNO_EMLINK,		MSG_ERRNO_EPIPE,
    375 		MSG_ERRNO_EDOM,			MSG_ERRNO_ERANGE,
    376 		MSG_ERRNO_ENOMSG,		MSG_ERRNO_EIDRM,
    377 		MSG_ERRNO_ECHRNG,		MSG_ERRNO_EL2NSYNC,
    378 		MSG_ERRNO_EL3HLT,		MSG_ERRNO_EL3RST,
    379 		MSG_ERRNO_ELNRNG,		MSG_ERRNO_EUNATCH,
    380 		MSG_ERRNO_ENOCSI,		MSG_ERRNO_EL2HLT,
    381 		MSG_ERRNO_EDEADLK,		MSG_ERRNO_ENOLCK,
    382 		MSG_ERRNO_ECANCELED,		MSG_ERRNO_ENOTSUP,
    383 		MSG_ERRNO_EDQUOT,		MSG_ERRNO_EBADE,
    384 		MSG_ERRNO_EBADR,		MSG_ERRNO_EXFULL,
    385 		MSG_ERRNO_ENOANO,		MSG_ERRNO_EBADRQC,
    386 		MSG_ERRNO_EBADSLT,		MSG_ERRNO_EDEADLOCK,
    387 		MSG_ERRNO_EBFONT,		MSG_ERRNO_EOWNERDEAD,
    388 		MSG_ERRNO_ENOTRECOVERABLE,	MSG_ERRNO_ENOSTR,
    389 		MSG_ERRNO_ENODATA,		MSG_ERRNO_ETIME,
    390 		MSG_ERRNO_ENOSR,		MSG_ERRNO_ENONET,
    391 		MSG_ERRNO_ENOPKG,		MSG_ERRNO_EREMOTE,
    392 		MSG_ERRNO_ENOLINK,		MSG_ERRNO_EADV,
    393 		MSG_ERRNO_ESRMNT,		MSG_ERRNO_ECOMM,
    394 		MSG_ERRNO_EPROTO,		MSG_ERRNO_ELOCKUNMAPPED,
    395 		MSG_ERRNO_ENOTACTIVE,		MSG_ERRNO_EMULTIHOP
    396 	};
    397 	static const conv_ds_msg_t ds_errarr_1_74 = {
    398 	    CONV_DS_MSG_INIT(1, errarr_1_74) };
    399 
    400 	static const Msg	errarr_77_99[23] = {
    401 		MSG_ERRNO_EBADMSG,		MSG_ERRNO_ENAMETOOLONG,
    402 		MSG_ERRNO_EOVERFLOW,		MSG_ERRNO_ENOTUNIQ,
    403 		MSG_ERRNO_EBADFD,		MSG_ERRNO_EREMCHG,
    404 		MSG_ERRNO_ELIBACC,		MSG_ERRNO_ELIBBAD,
    405 		MSG_ERRNO_ELIBSCN,		MSG_ERRNO_ELIBMAX,
    406 		MSG_ERRNO_ELIBEXEC,		MSG_ERRNO_EILSEQ,
    407 		MSG_ERRNO_ENOSYS,		MSG_ERRNO_ELOOP,
    408 		MSG_ERRNO_ERESTART,		MSG_ERRNO_ESTRPIPE,
    409 		MSG_ERRNO_ENOTEMPTY,		MSG_ERRNO_EUSERS,
    410 		MSG_ERRNO_ENOTSOCK,		MSG_ERRNO_EDESTADDRREQ,
    411 		MSG_ERRNO_EMSGSIZE,		MSG_ERRNO_EPROTOTYPE,
    412 		MSG_ERRNO_ENOPROTOOPT
    413 	};
    414 	static const conv_ds_msg_t ds_errarr_77_99 = {
    415 	    CONV_DS_MSG_INIT(77, errarr_77_99) };
    416 
    417 	static const Msg	errarr_120_134[15] = {
    418 		MSG_ERRNO_EPROTONOSUPPORT,	MSG_ERRNO_ESOCKTNOSUPPORT,
    419 		MSG_ERRNO_EOPNOTSUPP,		MSG_ERRNO_EPFNOSUPPORT,
    420 		MSG_ERRNO_EAFNOSUPPORT,		MSG_ERRNO_EADDRINUSE,
    421 		MSG_ERRNO_EADDRNOTAVAIL,	MSG_ERRNO_ENETDOWN,
    422 		MSG_ERRNO_ENETUNREACH,		MSG_ERRNO_ENETRESET,
    423 		MSG_ERRNO_ECONNABORTED,		MSG_ERRNO_ECONNRESET,
    424 		MSG_ERRNO_ENOBUFS,		MSG_ERRNO_EISCONN,
    425 		MSG_ERRNO_ENOTCONN
    426 	};
    427 	static const conv_ds_msg_t ds_errarr_120_134 = {
    428 	    CONV_DS_MSG_INIT(120, errarr_120_134) };
    429 
    430 	static const Msg	errarr_143_151[9] = {
    431 		MSG_ERRNO_ESHUTDOWN,		MSG_ERRNO_ETOOMANYREFS,
    432 		MSG_ERRNO_ETIMEDOUT,		MSG_ERRNO_ECONNREFUSED,
    433 		MSG_ERRNO_EHOSTDOWN,		MSG_ERRNO_EHOSTUNREACH,
    434 		MSG_ERRNO_EALREADY,		MSG_ERRNO_EINPROGRESS,
    435 		MSG_ERRNO_ESTALE
    436 	};
    437 	static const conv_ds_msg_t ds_errarr_143_151 = {
    438 	    CONV_DS_MSG_INIT(143, errarr_143_151) };
    439 
    440 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_errarr_1_74),
    441 		CONV_DS_ADDR(ds_errarr_77_99), CONV_DS_ADDR(ds_errarr_120_134),
    442 		CONV_DS_ADDR(ds_errarr_143_151), NULL };
    443 
    444 
    445 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, errno_val, ds, fmt_flags,
    446 	    inv_buf));
    447 }
    448 
    449 
    450 const char *
    451 conv_cnote_pr_dmodel(Word dmodel, Conv_fmt_flags_t fmt_flags,
    452     Conv_inv_buf_t *inv_buf)
    453 {
    454 	static const Msg	models[] = {
    455 		MSG_PR_MODEL_UNKNOWN,
    456 		MSG_PR_MODEL_ILP32,
    457 		MSG_PR_MODEL_LP64
    458 	};
    459 	static const conv_ds_msg_t ds_models = {
    460 	    CONV_DS_MSG_INIT(PR_MODEL_UNKNOWN, models) };
    461 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_models), NULL };
    462 
    463 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, dmodel, ds, fmt_flags,
    464 	    inv_buf));
    465 }
    466 
    467 
    468 const char *
    469 conv_cnote_pr_why(short why, Conv_fmt_flags_t fmt_flags,
    470     Conv_inv_buf_t *inv_buf)
    471 {
    472 	static const Msg	why_arr[] = {
    473 		MSG_PR_WHY_REQUESTED,
    474 		MSG_PR_WHY_SIGNALLED,
    475 		MSG_PR_WHY_SYSENTRY,
    476 		MSG_PR_WHY_SYSEXIT,
    477 		MSG_PR_WHY_JOBCONTROL,
    478 		MSG_PR_WHY_FAULTED,
    479 		MSG_PR_WHY_SUSPENDED,
    480 		MSG_PR_WHY_CHECKPOINT
    481 	};
    482 	static const conv_ds_msg_t ds_why_arr = {
    483 	    CONV_DS_MSG_INIT(1, why_arr) };
    484 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_why_arr), NULL };
    485 
    486 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, why, ds, fmt_flags,
    487 	    inv_buf));
    488 }
    489 
    490 
    491 const char *
    492 conv_cnote_pr_what(short why, short what, Conv_fmt_flags_t fmt_flags,
    493     Conv_inv_buf_t *inv_buf)
    494 {
    495 	/*
    496 	 * The meaning of pr_what depends on the corresponding
    497 	 * value of pr_why, as discussed in the proc(4) manpage.
    498 	 */
    499 	switch (why) {
    500 	case PR_SIGNALLED:
    501 	case PR_JOBCONTROL:
    502 		return (conv_cnote_signal(what, fmt_flags, inv_buf));
    503 	case PR_SYSENTRY:
    504 	case PR_SYSEXIT:
    505 		return (conv_cnote_syscall(what, fmt_flags, inv_buf));
    506 	case PR_FAULTED:
    507 		return (conv_cnote_fault(what, fmt_flags, inv_buf));
    508 	};
    509 
    510 	return (conv_invalid_val(inv_buf, what, fmt_flags));
    511 }
    512 
    513 
    514 /*
    515  * Return the name of the general purpose register indexed by
    516  * regno in the pr_reg array of lwpstatus_t (<sys/procfs.h>).
    517  */
    518 const char *
    519 conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
    520     Conv_inv_buf_t *inv_buf)
    521 {
    522 	static const Msg	sparc_gen_reg[32] = {
    523 		MSG_REG_SPARC_G0,		MSG_REG_SPARC_G1,
    524 		MSG_REG_SPARC_G2,		MSG_REG_SPARC_G3,
    525 		MSG_REG_SPARC_G4,		MSG_REG_SPARC_G5,
    526 		MSG_REG_SPARC_G6,		MSG_REG_SPARC_G7,
    527 		MSG_REG_SPARC_O0,		MSG_REG_SPARC_O1,
    528 		MSG_REG_SPARC_O2,		MSG_REG_SPARC_O3,
    529 		MSG_REG_SPARC_O4,		MSG_REG_SPARC_O5,
    530 		MSG_REG_SPARC_O6,		MSG_REG_SPARC_O7,
    531 		MSG_REG_SPARC_L0,		MSG_REG_SPARC_L1,
    532 		MSG_REG_SPARC_L2,		MSG_REG_SPARC_L3,
    533 		MSG_REG_SPARC_L4,		MSG_REG_SPARC_L5,
    534 		MSG_REG_SPARC_L6,		MSG_REG_SPARC_L7,
    535 		MSG_REG_SPARC_I0,		MSG_REG_SPARC_I1,
    536 		MSG_REG_SPARC_I2,		MSG_REG_SPARC_I3,
    537 		MSG_REG_SPARC_I4,		MSG_REG_SPARC_I5,
    538 		MSG_REG_SPARC_I6,		MSG_REG_SPARC_I7
    539 	};
    540 	static const conv_ds_msg_t ds_sparc_gen_reg = {
    541 	    CONV_DS_MSG_INIT(0, sparc_gen_reg) };
    542 
    543 	static const Msg	sparc_32_37_reg[6] = {
    544 		MSG_REG_SPARC_PSR,		MSG_REG_SPARC_PC,
    545 		MSG_REG_SPARC_nPC,		MSG_REG_SPARC_Y,
    546 		MSG_REG_SPARC_WIM,		MSG_REG_SPARC_TBR
    547 	};
    548 	static const conv_ds_msg_t ds_sparc_32_37_reg = {
    549 	    CONV_DS_MSG_INIT(32, sparc_32_37_reg) };
    550 
    551 	static const Msg	sparcv9_32_37_reg[6] = {
    552 		MSG_REG_SPARC_CCR,		MSG_REG_SPARC_PC,
    553 		MSG_REG_SPARC_nPC,		MSG_REG_SPARC_Y,
    554 		MSG_REG_SPARC_ASI,		MSG_REG_SPARC_FPRS
    555 	};
    556 	static const conv_ds_msg_t ds_sparcv9_32_37_reg = {
    557 	    CONV_DS_MSG_INIT(32, sparcv9_32_37_reg) };
    558 
    559 	static const Msg	amd64_reg[28] = {
    560 		MSG_REG_AMD64_R15,		MSG_REG_AMD64_R14,
    561 		MSG_REG_AMD64_R13,		MSG_REG_AMD64_R12,
    562 		MSG_REG_AMD64_R11,		MSG_REG_AMD64_R10,
    563 		MSG_REG_AMD64_R9,		MSG_REG_AMD64_R8,
    564 		MSG_REG_AMD64_RDI,		MSG_REG_AMD64_RSI,
    565 		MSG_REG_AMD64_RBP,		MSG_REG_AMD64_RBX,
    566 		MSG_REG_AMD64_RDX,		MSG_REG_AMD64_RCX,
    567 		MSG_REG_AMD64_RAX,		MSG_REG_AMD64_TRAPNO,
    568 		MSG_REG_AMD64_ERR,		MSG_REG_AMD64_RIP,
    569 		MSG_REG_AMD64_CS,		MSG_REG_AMD64_RFL,
    570 		MSG_REG_AMD64_RSP,		MSG_REG_AMD64_SS,
    571 		MSG_REG_AMD64_FS,		MSG_REG_AMD64_GS,
    572 		MSG_REG_AMD64_ES,		MSG_REG_AMD64_DS,
    573 		MSG_REG_AMD64_FSBASE,		MSG_REG_AMD64_GSBASE
    574 	};
    575 	static const conv_ds_msg_t ds_amd64_reg = {
    576 	    CONV_DS_MSG_INIT(0, amd64_reg) };
    577 
    578 	static const Msg	i86_reg[19] = {
    579 		MSG_REG_I86_GS,			MSG_REG_I86_FS,
    580 		MSG_REG_I86_ES,			MSG_REG_I86_DS,
    581 		MSG_REG_I86_EDI,		MSG_REG_I86_ESI,
    582 		MSG_REG_I86_EBP,		MSG_REG_I86_ESP,
    583 		MSG_REG_I86_EBX,		MSG_REG_I86_EDX,
    584 		MSG_REG_I86_ECX,		MSG_REG_I86_EAX,
    585 		MSG_REG_I86_TRAPNO,		MSG_REG_I86_ERR,
    586 		MSG_REG_I86_EIP,		MSG_REG_I86_CS,
    587 		MSG_REG_I86_EFL,		MSG_REG_I86_UESP,
    588 		MSG_REG_I86_SS
    589 	};
    590 	static const conv_ds_msg_t ds_i86_reg = {
    591 	    CONV_DS_MSG_INIT(0, i86_reg) };
    592 
    593 
    594 	static const conv_ds_t	*ds_sparc[] = {
    595 		CONV_DS_ADDR(ds_sparc_gen_reg),
    596 		CONV_DS_ADDR(ds_sparc_32_37_reg),
    597 		NULL
    598 	};
    599 	static const conv_ds_t	*ds_sparcv9[] = {
    600 		CONV_DS_ADDR(ds_sparc_gen_reg),
    601 		CONV_DS_ADDR(ds_sparcv9_32_37_reg),
    602 		NULL
    603 	};
    604 	static const conv_ds_t	*ds_amd64[] = {
    605 		CONV_DS_ADDR(ds_amd64_reg), NULL };
    606 	static const conv_ds_t	*ds_i86[] = {
    607 		CONV_DS_ADDR(ds_i86_reg), NULL };
    608 
    609 	const conv_ds_t **ds;
    610 
    611 	switch (mach) {
    612 	case EM_386:
    613 		ds = ds_i86;
    614 		break;
    615 
    616 	case EM_AMD64:
    617 		ds = ds_amd64;
    618 		break;
    619 
    620 	case EM_SPARC:
    621 	case EM_SPARC32PLUS:
    622 		ds = ds_sparc;
    623 		break;
    624 
    625 	case EM_SPARCV9:
    626 		ds = ds_sparcv9;
    627 		break;
    628 
    629 	default:
    630 		return (conv_invalid_val(inv_buf, regno, fmt_flags));
    631 	}
    632 
    633 	return (conv_map_ds(ELFOSABI_NONE, mach, regno, ds, fmt_flags,
    634 	    inv_buf));
    635 }
    636 
    637 const char *
    638 conv_cnote_pr_stype(Word stype, Conv_fmt_flags_t fmt_flags,
    639     Conv_inv_buf_t *inv_buf)
    640 {
    641 	static const Msg	types[] = {
    642 		MSG_SOBJ_NONE,		MSG_SOBJ_MUTEX,
    643 		MSG_SOBJ_RWLOCK,	MSG_SOBJ_CV,
    644 		MSG_SOBJ_SEMA,		MSG_SOBJ_USER,
    645 		MSG_SOBJ_USER_PI,	MSG_SOBJ_SHUTTLE
    646 	};
    647 	static const conv_ds_msg_t ds_types = { CONV_DS_MSG_INIT(0, types) };
    648 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_types), NULL };
    649 
    650 
    651 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, stype, ds, fmt_flags,
    652 	    inv_buf));
    653 }
    654 
    655 
    656 const char *
    657 conv_cnote_priv(int priv, Conv_fmt_flags_t fmt_flags,
    658     Conv_inv_buf_t *inv_buf)
    659 {
    660 	const char *fmt;
    661 
    662 	/*
    663 	 * The PRIV_ constants defined in <sys/priv.h> are unusual
    664 	 * in that they are negative values. The libconv code is all
    665 	 * built around the Word type, which is unsigned. Rather than
    666 	 * modify libconv for this one case, we simply handle
    667 	 * these constants differently that the usual approach,
    668 	 * and stay away from conv_invalid_val() and conv_map_ds().
    669 	 */
    670 	switch (priv) {
    671 	case PRIV_ALL:
    672 		return (MSG_ORIG(MSG_PRIV_ALL));
    673 	case PRIV_MULTIPLE:
    674 		return (MSG_ORIG(MSG_PRIV_MULTIPLE));
    675 	case PRIV_NONE:
    676 		return (MSG_ORIG(MSG_PRIV_NONE));
    677 	case PRIV_ALLZONE:
    678 		return (MSG_ORIG(MSG_PRIV_ALLZONE));
    679 	case PRIV_GLOBAL:
    680 		return (MSG_ORIG(MSG_PRIV_GLOBAL));
    681 	}
    682 
    683 	fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
    684 	    MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
    685 	(void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, priv);
    686 	return (inv_buf->buf);
    687 }
    688 
    689 
    690 const char *
    691 conv_cnote_psetid(int id, Conv_fmt_flags_t fmt_flags,
    692     Conv_inv_buf_t *inv_buf)
    693 {
    694 	const char *fmt;
    695 
    696 	/*
    697 	 * The PS_ constants defined in <sys/pset.h> are unusual
    698 	 * in that they are negative values. The libconv code is all
    699 	 * built around the Word type, which is unsigned. Rather than
    700 	 * modify libconv for this one case, we simply handle
    701 	 * these constants differently that the usual approach,
    702 	 * and stay away from conv_invalid_val() and conv_map_ds().
    703 	 */
    704 	switch (id) {
    705 	case PS_NONE:
    706 		return (MSG_ORIG(MSG_PS_NONE));
    707 	case PS_QUERY:
    708 		return (MSG_ORIG(MSG_PS_QUERY));
    709 	case PS_MYID:
    710 		return (MSG_ORIG(MSG_PS_MYID));
    711 	case PS_SOFT:
    712 		return (MSG_ORIG(MSG_PS_SOFT));
    713 	case PS_HARD:
    714 		return (MSG_ORIG(MSG_PS_HARD));
    715 	case PS_QUERY_TYPE:
    716 		return (MSG_ORIG(MSG_PS_QUERY_TYPE));
    717 	}
    718 
    719 	fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
    720 	    MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
    721 	(void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, id);
    722 	return (inv_buf->buf);
    723 }
    724 
    725 
    726 /*
    727  * Return a string describing the si_code field of
    728  * the siginfo_t struct.
    729  *
    730  * The meaning of si_code is dependent on both the target
    731  * machine (mach) as well as the signal (sig).
    732  */
    733 const char *
    734 conv_cnote_si_code(Half mach, int sig, int si_code,
    735     Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
    736 {
    737 
    738 	/* Values of si_code for user generated signals */
    739 	static const Msg	user_arr[6] = {
    740 		MSG_SI_USER,		MSG_SI_LWP,
    741 		MSG_SI_QUEUE,		MSG_SI_TIMER,
    742 		MSG_SI_ASYNCIO,		MSG_SI_MESGQ
    743 	};
    744 	static const conv_ds_msg_t ds_msg_user_arr = {
    745 	    CONV_DS_MSG_INIT(0, user_arr) };
    746 	static const conv_ds_t	*ds_user_arr[] = {
    747 		CONV_DS_ADDR(ds_msg_user_arr), NULL };
    748 
    749 
    750 	/*
    751 	 * Architecture dependent system generated signals. All
    752 	 * versions of Solaris use the same set of these values.
    753 	 */
    754 	static const Msg	trap_arr[6] = {
    755 		MSG_SI_TRAP_BRKPT,	MSG_SI_TRAP_TRACE,
    756 		MSG_SI_TRAP_RWATCH,	MSG_SI_TRAP_WWATCH,
    757 		MSG_SI_TRAP_XWATCH,	MSG_SI_TRAP_DTRACE
    758 	};
    759 	static const conv_ds_msg_t ds_msg_trap_arr = {
    760 	    CONV_DS_MSG_INIT(1, trap_arr) };
    761 	static const conv_ds_t	*ds_trap_arr[] = {
    762 		CONV_DS_ADDR(ds_msg_trap_arr), NULL };
    763 
    764 	static const Msg	cld_arr[6] = {
    765 		MSG_SI_CLD_EXITED,	MSG_SI_CLD_KILLED,
    766 		MSG_SI_CLD_DUMPED,	MSG_SI_CLD_TRAPPED,
    767 		MSG_SI_CLD_STOPPED,	MSG_SI_CLD_CONTINUED
    768 	};
    769 	static const conv_ds_msg_t ds_msg_cld_arr = {
    770 	    CONV_DS_MSG_INIT(1, cld_arr) };
    771 	static const conv_ds_t	*ds_cld_arr[] = {
    772 		CONV_DS_ADDR(ds_msg_cld_arr), NULL };
    773 
    774 	static const Msg	poll_arr[6] = {
    775 		MSG_SI_POLL_IN,		MSG_SI_POLL_OUT,
    776 		MSG_SI_POLL_MSG,	MSG_SI_POLL_ERR,
    777 		MSG_SI_POLL_PRI,	MSG_SI_POLL_HUP
    778 	};
    779 	static const conv_ds_msg_t ds_msg_poll_arr = {
    780 	    CONV_DS_MSG_INIT(1, poll_arr) };
    781 	static const conv_ds_t	*ds_poll_arr[] = {
    782 		CONV_DS_ADDR(ds_msg_poll_arr), NULL };
    783 
    784 	/*
    785 	 * Architecture dependent system generated signals.
    786 	 * These items (ILL, EMT, FPE, SEGV, BUS) are platform
    787 	 * dependent. Some architectures have extra codes.
    788 	 * The same name may have a different integer value.
    789 	 * Multiple arrays are used when they differ, and one
    790 	 * array when all the architectures agree.
    791 	 */
    792 
    793 	/* ILL */
    794 	static const Msg	ill_arr[8] = {
    795 		MSG_SI_ILL_ILLOPC,	MSG_SI_ILL_ILLOPN,
    796 		MSG_SI_ILL_ILLADR,	MSG_SI_ILL_ILLTRP,
    797 		MSG_SI_ILL_PRVOPC,	MSG_SI_ILL_PRVREG,
    798 		MSG_SI_ILL_COPROC,	MSG_SI_ILL_BADSTK
    799 	};
    800 	static const conv_ds_msg_t ds_msg_ill_arr = {
    801 	    CONV_DS_MSG_INIT(1, ill_arr) };
    802 	static const conv_ds_t	*ds_ill_arr[] = {
    803 		CONV_DS_ADDR(ds_msg_ill_arr), NULL };
    804 
    805 	/* EMT */
    806 	static const Msg	emt_arr_sparc[2] = {
    807 		MSG_SI_EMT_TAGOVF,	MSG_SI_EMT_CPCOVF
    808 	};
    809 	static const conv_ds_msg_t ds_msg_emt_arr_sparc = {
    810 	    CONV_DS_MSG_INIT(1, emt_arr_sparc) };
    811 	static const conv_ds_t	*ds_emt_arr_sparc[] = {
    812 		CONV_DS_ADDR(ds_msg_emt_arr_sparc), NULL };
    813 
    814 	static const Msg	emt_arr_x86[1] = {
    815 		MSG_SI_EMT_CPCOVF
    816 	};
    817 	static const conv_ds_msg_t ds_msg_emt_arr_x86 = {
    818 	    CONV_DS_MSG_INIT(1, emt_arr_x86) };
    819 	static const conv_ds_t	*ds_emt_arr_x86[] = {
    820 		CONV_DS_ADDR(ds_msg_emt_arr_x86), NULL };
    821 
    822 
    823 	/* FPE */
    824 	static const Msg	fpe_arr_sparc[8] = {
    825 		MSG_SI_FPE_INTDIV,	MSG_SI_FPE_INTOVF,
    826 		MSG_SI_FPE_FLTDIV,	MSG_SI_FPE_FLTOVF,
    827 		MSG_SI_FPE_FLTUND,	MSG_SI_FPE_FLTRES,
    828 		MSG_SI_FPE_FLTINV,	MSG_SI_FPE_FLTSUB
    829 	};
    830 	static const conv_ds_msg_t ds_msg_fpe_arr_sparc = {
    831 	    CONV_DS_MSG_INIT(1, fpe_arr_sparc) };
    832 	static const conv_ds_t	*ds_fpe_arr_sparc[] = {
    833 		CONV_DS_ADDR(ds_msg_fpe_arr_sparc), NULL };
    834 
    835 	static const Msg	fpe_arr_x86[9] = {
    836 		MSG_SI_FPE_INTDIV,	MSG_SI_FPE_INTOVF,
    837 		MSG_SI_FPE_FLTDIV,	MSG_SI_FPE_FLTOVF,
    838 		MSG_SI_FPE_FLTUND,	MSG_SI_FPE_FLTRES,
    839 		MSG_SI_FPE_FLTINV,	MSG_SI_FPE_FLTSUB,
    840 		MSG_SI_FPE_FLTDEN
    841 	};
    842 	static const conv_ds_msg_t ds_msg_fpe_arr_x86 = {
    843 	    CONV_DS_MSG_INIT(1, fpe_arr_x86) };
    844 	static const conv_ds_t	*ds_fpe_arr_x86[] = {
    845 		CONV_DS_ADDR(ds_msg_fpe_arr_x86), NULL };
    846 
    847 	/* SEGV */
    848 	static const Msg	segv_arr[2] = {
    849 		MSG_SI_SEGV_MAPERR,	MSG_SI_SEGV_ACCERR
    850 	};
    851 	static const conv_ds_msg_t ds_msg_segv_arr = {
    852 	    CONV_DS_MSG_INIT(1, segv_arr) };
    853 	static const conv_ds_t	*ds_segv_arr[] = {
    854 		CONV_DS_ADDR(ds_msg_segv_arr), NULL };
    855 
    856 	/* BUS */
    857 	static const Msg	bus_arr[3] = {
    858 		MSG_SI_BUS_ADRALN,	MSG_SI_BUS_ADRERR,
    859 		MSG_SI_BUS_OBJERR
    860 	};
    861 	static const conv_ds_msg_t ds_msg_bus_arr = {
    862 	    CONV_DS_MSG_INIT(1, bus_arr) };
    863 	static const conv_ds_t	*ds_bus_arr[] = {
    864 		CONV_DS_ADDR(ds_msg_bus_arr), NULL };
    865 
    866 	enum { ARCH_NONE, ARCH_X86, ARCH_SPARC } arch;
    867 
    868 
    869 	/* Handle the si_code values that do not depend on the signal */
    870 	switch (si_code) {
    871 	case SI_NOINFO:
    872 		return (MSG_ORIG(MSG_SI_NOINFO));
    873 	case SI_DTRACE:
    874 		return (MSG_ORIG(MSG_SI_DTRACE));
    875 	case SI_RCTL:
    876 		return (MSG_ORIG(MSG_SI_RCTL));
    877 	default:
    878 		/* User generated signal codes are <= 0 */
    879 		if (si_code <= 0) {
    880 			int ndx = -si_code;
    881 
    882 			/*
    883 			 * If no signal was delivered, and si_code is
    884 			 * 0, return "0" rather than "SI_USER".
    885 			 */
    886 			if ((si_code == 0) && (sig == 0))
    887 				return (MSG_ORIG(MSG_GBL_ZERO));
    888 
    889 			if (ndx >= ARRAY_NELTS(user_arr)) {
    890 				const char *fmt;
    891 
    892 				fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
    893 				    MSG_ORIG(MSG_FMT_INT) :
    894 				    MSG_ORIG(MSG_FMT_HEXINT);
    895 
    896 				(void) snprintf(inv_buf->buf,
    897 				    sizeof (inv_buf->buf), fmt, si_code);
    898 				return (inv_buf->buf);
    899 			}
    900 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, ndx,
    901 			    ds_user_arr, fmt_flags, inv_buf));
    902 		}
    903 	}
    904 
    905 	/*
    906 	 * If we didn't return above, then this is a
    907 	 * system generated signal, and the meaning of si_code
    908 	 * depends on the signal that was delivered, and possibly
    909 	 * on the target architecture.
    910 	 */
    911 	switch (mach) {
    912 	case EM_386:
    913 	case EM_AMD64:
    914 		arch = ARCH_X86;
    915 		break;
    916 
    917 	case EM_SPARC:
    918 	case EM_SPARC32PLUS:
    919 	case EM_SPARCV9:
    920 		arch = ARCH_X86;
    921 		break;
    922 
    923 	default:
    924 		arch = ARCH_NONE;
    925 		break;
    926 	}
    927 
    928 	switch (sig) {
    929 	case SIGTRAP:
    930 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    931 		    ds_trap_arr, fmt_flags, inv_buf));
    932 
    933 	case SIGCLD:
    934 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    935 		    ds_cld_arr, fmt_flags, inv_buf));
    936 
    937 	case SIGPOLL:
    938 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    939 		    ds_poll_arr, fmt_flags, inv_buf));
    940 
    941 	case SIGILL:
    942 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    943 		    ds_ill_arr, fmt_flags, inv_buf));
    944 
    945 	case SIGEMT:
    946 		switch (arch) {
    947 		case ARCH_SPARC:
    948 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    949 			    ds_emt_arr_sparc, fmt_flags, inv_buf));
    950 		case ARCH_X86:
    951 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    952 			    ds_emt_arr_x86, fmt_flags, inv_buf));
    953 		}
    954 		break;
    955 
    956 	case SIGFPE:
    957 		switch (arch) {
    958 		case ARCH_SPARC:
    959 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    960 			    ds_fpe_arr_sparc, fmt_flags, inv_buf));
    961 		case ARCH_X86:
    962 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    963 			    ds_fpe_arr_x86, fmt_flags, inv_buf));
    964 		}
    965 		break;
    966 
    967 	case SIGSEGV:
    968 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    969 		    ds_segv_arr, fmt_flags, inv_buf));
    970 
    971 	case SIGBUS:
    972 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
    973 		    ds_bus_arr, fmt_flags, inv_buf));
    974 	}
    975 
    976 	/* If not recognized, format as a number */
    977 	return (conv_invalid_val(inv_buf, si_code, fmt_flags));
    978 
    979 }
    980 
    981 
    982 #define	AUXAFFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
    983 	MSG_AUXV_AF_SUN_SETUGID_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
    984 	MSG_AUXV_AF_SUN_HWCAPVERIFY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
    985 	MSG_AUXV_AF_SUN_NOPLM_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
    986 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
    987 
    988 /*
    989  * Ensure that Conv_cnote_auxv_af_buf_t is large enough:
    990  *
    991  * AUXAFFLGSZ is the real minimum size of the buffer required by
    992  * conv_cnote_auxv_af(). However, Conv_cnote_auxv_af_buf_t
    993  * uses CONV_CNOTE_AUXV_AF_BUFSIZE to set the buffer size. We do
    994  * things this way because the definition of AUXAFFLGSZ uses information
    995  * that is not available in the environment of other programs
    996  * that include the conv.h header file.
    997  */
    998 #if (CONV_CNOTE_AUXV_AF_BUFSIZE != AUXAFFLGSZ) && !defined(__lint)
    999 #define	REPORT_BUFSIZE AUXAFFLGSZ
   1000 #include "report_bufsize.h"
   1001 #error "CONV_CNOTE_AUXV_AF_BUFSIZE does not match AUXAFFLGSZ"
   1002 #endif
   1003 
   1004 const char *
   1005 conv_cnote_auxv_af(Word flags, Conv_fmt_flags_t fmt_flags,
   1006     Conv_cnote_auxv_af_buf_t *cnote_auxv_af_buf)
   1007 {
   1008 	static const Val_desc vda[] = {
   1009 		{ AF_SUN_SETUGID,	MSG_AUXV_AF_SUN_SETUGID },
   1010 		{ AF_SUN_HWCAPVERIFY,	MSG_AUXV_AF_SUN_HWCAPVERIFY },
   1011 		{ AF_SUN_NOPLM,		MSG_AUXV_AF_SUN_NOPLM },
   1012 		{ 0,			0 }
   1013 	};
   1014 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1015 	    NULL, sizeof (cnote_auxv_af_buf->buf) };
   1016 
   1017 	if (flags == 0)
   1018 		return (MSG_ORIG(MSG_GBL_ZERO));
   1019 
   1020 	conv_arg.buf = cnote_auxv_af_buf->buf;
   1021 	conv_arg.oflags = conv_arg.rflags = flags;
   1022 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1023 
   1024 	return ((const char *)cnote_auxv_af_buf->buf);
   1025 }
   1026 
   1027 
   1028 #define	CCFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1029 	MSG_CC_CONTENT_STACK_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1030 	MSG_CC_CONTENT_HEAP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1031 	MSG_CC_CONTENT_SHFILE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1032 	MSG_CC_CONTENT_SHANON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1033 	MSG_CC_CONTENT_TEXT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1034 	MSG_CC_CONTENT_DATA_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1035 	MSG_CC_CONTENT_RODATA_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1036 	MSG_CC_CONTENT_ANON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1037 	MSG_CC_CONTENT_SHM_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1038 	MSG_CC_CONTENT_ISM_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1039 	MSG_CC_CONTENT_DISM_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1040 	MSG_CC_CONTENT_CTF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1041 	MSG_CC_CONTENT_SYMTAB_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1042 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1043 
   1044 /*
   1045  * Ensure that Conv_cnote_cc_content_buf_t is large enough:
   1046  *
   1047  * CCFLGSZ is the real minimum size of the buffer required by
   1048  * conv_cnote_cc_content(). However, Conv_cnote_cc_content_buf_t
   1049  * uses CONV_CNOTE_CC_CONTENT_BUFSIZE to set the buffer size. We do
   1050  * things this way because the definition of CCFLGSZ uses information
   1051  * that is not available in the environment of other programs
   1052  * that include the conv.h header file.
   1053  */
   1054 #if (CONV_CNOTE_CC_CONTENT_BUFSIZE != CCFLGSZ) && !defined(__lint)
   1055 #define	REPORT_BUFSIZE CCFLGSZ
   1056 #include "report_bufsize.h"
   1057 #error "CONV_CNOTE_CC_CONTENT_BUFSIZE does not match CCFLGSZ"
   1058 #endif
   1059 
   1060 const char *
   1061 conv_cnote_cc_content(Lword flags, Conv_fmt_flags_t fmt_flags,
   1062     Conv_cnote_cc_content_buf_t *cnote_cc_content_buf)
   1063 {
   1064 	/*
   1065 	 * Note: core_content_t is a 64-bit integer value, but our
   1066 	 * conv_expn_field() logic is all built around 32-bit
   1067 	 * Word values. This will probably need changing someday,
   1068 	 * but for now, we make do with the 32-bit engine. This works
   1069 	 * because the number of bits actually assigned in
   1070 	 * the core_content_t data type (<sys/corectl.h>) bits within
   1071 	 * 32-bits.
   1072 	 *
   1073 	 * The downside is that any bits set in the upper half of
   1074 	 * the flags will be ignored. At the time of this writing,
   1075 	 * that can only occur via core file corruption, which presumably
   1076 	 * would be evident in other ways.
   1077 	 */
   1078 	static const Val_desc vda[] = {
   1079 		{ (Word) CC_CONTENT_STACK,	MSG_CC_CONTENT_STACK },
   1080 		{ (Word) CC_CONTENT_HEAP,	MSG_CC_CONTENT_HEAP },
   1081 		{ (Word) CC_CONTENT_SHFILE,	MSG_CC_CONTENT_SHFILE },
   1082 		{ (Word) CC_CONTENT_SHANON,	MSG_CC_CONTENT_SHANON },
   1083 		{ (Word) CC_CONTENT_TEXT,	MSG_CC_CONTENT_TEXT },
   1084 		{ (Word) CC_CONTENT_DATA,	MSG_CC_CONTENT_DATA },
   1085 		{ (Word) CC_CONTENT_RODATA,	MSG_CC_CONTENT_RODATA },
   1086 		{ (Word) CC_CONTENT_ANON,	MSG_CC_CONTENT_ANON },
   1087 		{ (Word) CC_CONTENT_SHM,	MSG_CC_CONTENT_SHM },
   1088 		{ (Word) CC_CONTENT_ISM,	MSG_CC_CONTENT_ISM },
   1089 		{ (Word) CC_CONTENT_DISM,	MSG_CC_CONTENT_DISM },
   1090 		{ (Word) CC_CONTENT_CTF,	MSG_CC_CONTENT_CTF },
   1091 		{ (Word) CC_CONTENT_SYMTAB,	MSG_CC_CONTENT_SYMTAB },
   1092 		{ 0,			0 }
   1093 	};
   1094 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1095 	    NULL, sizeof (cnote_cc_content_buf->buf) };
   1096 
   1097 	if (flags == 0)
   1098 		return (MSG_ORIG(MSG_GBL_ZERO));
   1099 
   1100 	conv_arg.buf = cnote_cc_content_buf->buf;
   1101 	conv_arg.oflags = conv_arg.rflags = flags;
   1102 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1103 
   1104 	return ((const char *)cnote_cc_content_buf->buf);
   1105 }
   1106 
   1107 
   1108 #define	PRFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1109 	MSG_PR_FLAGS_STOPPED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1110 	MSG_PR_FLAGS_ISTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1111 	MSG_PR_FLAGS_DSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1112 	MSG_PR_FLAGS_STEP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1113 	MSG_PR_FLAGS_ASLEEP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1114 	MSG_PR_FLAGS_PCINVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1115 	MSG_PR_FLAGS_ASLWP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1116 	MSG_PR_FLAGS_AGENT_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1117 	MSG_PR_FLAGS_DETACH_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1118 	MSG_PR_FLAGS_DAEMON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1119 	MSG_PR_FLAGS_IDLE_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1120 	MSG_PR_FLAGS_ISSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1121 	MSG_PR_FLAGS_VFORKP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1122 	MSG_PR_FLAGS_ORPHAN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1123 	MSG_PR_FLAGS_NOSIGCHLD_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1124 	MSG_PR_FLAGS_WAITPID_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1125 	MSG_PR_FLAGS_FORK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1126 	MSG_PR_FLAGS_RLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1127 	MSG_PR_FLAGS_KLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1128 	MSG_PR_FLAGS_ASYNC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1129 	MSG_PR_FLAGS_MSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1130 	MSG_PR_FLAGS_BPTADJ_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1131 	MSG_PR_FLAGS_PTRACE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1132 	MSG_PR_FLAGS_MSFORK_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1133 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1134 
   1135 /*
   1136  * Ensure that Conv_cnote_pr_flags_buf_t is large enough:
   1137  *
   1138  * PRFLGSZ is the real minimum size of the buffer required by
   1139  * conv_cnote_pr_flags(). However, Conv_cnote_pr_flags_buf_t
   1140  * uses CONV_CNOTE_PR_FLAGS_BUFSIZE to set the buffer size. We do
   1141  * things this way because the definition of PRFLGSZ uses information
   1142  * that is not available in the environment of other programs
   1143  * that include the conv.h header file.
   1144  */
   1145 #if (CONV_CNOTE_PR_FLAGS_BUFSIZE != PRFLGSZ) && !defined(__lint)
   1146 #define	REPORT_BUFSIZE PRFLGSZ
   1147 #include "report_bufsize.h"
   1148 #error "CONV_CNOTE_PR_FLAGS_BUFSIZE does not match PRFLGSZ"
   1149 #endif
   1150 
   1151 const char *
   1152 conv_cnote_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
   1153     Conv_cnote_pr_flags_buf_t *cnote_pr_flags_buf)
   1154 {
   1155 	static const Val_desc vda[] = {
   1156 		{ PR_STOPPED, 		MSG_PR_FLAGS_STOPPED },
   1157 		{ PR_ISTOP,		MSG_PR_FLAGS_ISTOP },
   1158 		{ PR_DSTOP,		MSG_PR_FLAGS_DSTOP },
   1159 		{ PR_STEP,		MSG_PR_FLAGS_STEP },
   1160 		{ PR_ASLEEP,		MSG_PR_FLAGS_ASLEEP },
   1161 		{ PR_PCINVAL,		MSG_PR_FLAGS_PCINVAL },
   1162 		{ PR_ASLWP,		MSG_PR_FLAGS_ASLWP },
   1163 		{ PR_AGENT,		MSG_PR_FLAGS_AGENT },
   1164 		{ PR_DETACH,		MSG_PR_FLAGS_DETACH },
   1165 		{ PR_DAEMON,		MSG_PR_FLAGS_DAEMON },
   1166 		{ PR_IDLE,		MSG_PR_FLAGS_IDLE },
   1167 		{ PR_ISSYS,		MSG_PR_FLAGS_ISSYS },
   1168 		{ PR_VFORKP,		MSG_PR_FLAGS_VFORKP },
   1169 		{ PR_ORPHAN,		MSG_PR_FLAGS_ORPHAN },
   1170 		{ PR_NOSIGCHLD,		MSG_PR_FLAGS_NOSIGCHLD },
   1171 		{ PR_WAITPID,		MSG_PR_FLAGS_WAITPID },
   1172 		{ PR_FORK,		MSG_PR_FLAGS_FORK },
   1173 		{ PR_RLC,		MSG_PR_FLAGS_RLC },
   1174 		{ PR_KLC,		MSG_PR_FLAGS_KLC },
   1175 		{ PR_ASYNC,		MSG_PR_FLAGS_ASYNC },
   1176 		{ PR_MSACCT,		MSG_PR_FLAGS_MSACCT },
   1177 		{ PR_BPTADJ,		MSG_PR_FLAGS_BPTADJ },
   1178 		{ PR_PTRACE,		MSG_PR_FLAGS_PTRACE },
   1179 		{ PR_MSFORK,		MSG_PR_FLAGS_MSFORK },
   1180 		{ 0,			0 }
   1181 	};
   1182 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1183 	    NULL, sizeof (cnote_pr_flags_buf->buf) };
   1184 
   1185 	if (flags == 0)
   1186 		return (MSG_ORIG(MSG_GBL_ZERO));
   1187 
   1188 	conv_arg.buf = cnote_pr_flags_buf->buf;
   1189 	conv_arg.oflags = conv_arg.rflags = flags;
   1190 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1191 
   1192 	return ((const char *)cnote_pr_flags_buf->buf);
   1193 }
   1194 
   1195 
   1196 #define	OLDPRFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1197 	MSG_PR_FLAGS_STOPPED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1198 	MSG_PR_FLAGS_ISTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1199 	MSG_PR_FLAGS_DSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1200 	MSG_PR_FLAGS_ASLEEP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1201 	MSG_PR_FLAGS_FORK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1202 	MSG_PR_FLAGS_RLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1203 	MSG_PR_FLAGS_PTRACE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1204 	MSG_PR_FLAGS_PCINVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1205 	MSG_PR_FLAGS_ISSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1206 	MSG_PR_FLAGS_STEP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1207 	MSG_PR_FLAGS_KLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1208 	MSG_PR_FLAGS_ASYNC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1209 	MSG_PR_FLAGS_PCOMPAT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1210 	MSG_PR_FLAGS_MSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1211 	MSG_PR_FLAGS_BPTADJ_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1212 	MSG_PR_FLAGS_ASLWP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1213 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1214 
   1215 /*
   1216  * Ensure that Conv_cnote_old_pr_flags_buf_t is large enough:
   1217  *
   1218  * OLDPRFLGSZ is the real minimum size of the buffer required by
   1219  * conv_cnote_old_pr_flags(). However, Conv_cnote_old_pr_flags_buf_t
   1220  * uses CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE to set the buffer size. We do
   1221  * things this way because the definition of OLDPRFLGSZ uses information
   1222  * that is not available in the environment of other programs
   1223  * that include the conv.h header file.
   1224  */
   1225 #if (CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE != OLDPRFLGSZ) && !defined(__lint)
   1226 #define	REPORT_BUFSIZE OLDPRFLGSZ
   1227 #include "report_bufsize.h"
   1228 #error "CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE does not match OLDPRFLGSZ"
   1229 #endif
   1230 
   1231 const char *
   1232 conv_cnote_old_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
   1233     Conv_cnote_old_pr_flags_buf_t *cnote_old_pr_flags_buf)
   1234 {
   1235 	/*
   1236 	 * <sys/old_procfs.h> defines names for many of these flags
   1237 	 * that are also defined in <sys/procfs.h>, but with different
   1238 	 * values. To avoid confusion, we don't include <sys/old_procfs.h>,
   1239 	 * and specify the values directly.
   1240 	 */
   1241 	static const Val_desc vda[] = {
   1242 		{ 0x0001,		MSG_PR_FLAGS_STOPPED },
   1243 		{ 0x0002,		MSG_PR_FLAGS_ISTOP },
   1244 		{ 0x0004,		MSG_PR_FLAGS_DSTOP },
   1245 		{ 0x0008,		MSG_PR_FLAGS_ASLEEP },
   1246 		{ 0x0010,		MSG_PR_FLAGS_FORK },
   1247 		{ 0x0020,		MSG_PR_FLAGS_RLC },
   1248 		{ 0x0040,		MSG_PR_FLAGS_PTRACE },
   1249 		{ 0x0080,		MSG_PR_FLAGS_PCINVAL },
   1250 		{ 0x0100,		MSG_PR_FLAGS_ISSYS },
   1251 		{ 0x0200,		MSG_PR_FLAGS_STEP },
   1252 		{ 0x0400,		MSG_PR_FLAGS_KLC },
   1253 		{ 0x0800,		MSG_PR_FLAGS_ASYNC },
   1254 		{ 0x1000,		MSG_PR_FLAGS_PCOMPAT },
   1255 		{ 0x2000,		MSG_PR_FLAGS_MSACCT },
   1256 		{ 0x4000,		MSG_PR_FLAGS_BPTADJ },
   1257 		{ 0x8000,		MSG_PR_FLAGS_ASLWP },
   1258 		{ 0,			0 }
   1259 	};
   1260 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1261 	    NULL, sizeof (cnote_old_pr_flags_buf->buf) };
   1262 
   1263 	if (flags == 0)
   1264 		return (MSG_ORIG(MSG_GBL_ZERO));
   1265 
   1266 	conv_arg.buf = cnote_old_pr_flags_buf->buf;
   1267 	conv_arg.oflags = conv_arg.rflags = flags;
   1268 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1269 
   1270 	return ((const char *)cnote_old_pr_flags_buf->buf);
   1271 }
   1272 
   1273 
   1274 #define	PROCFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1275 	MSG_PROC_FLAG_SSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1276 	MSG_PROC_FLAG_SMSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1277 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1278 
   1279 /*
   1280  * Ensure that Conv_cnote_proc_flag_buf_t is large enough:
   1281  *
   1282  * PROCFLGSZ is the real minimum size of the buffer required by
   1283  * conv_cnote_proc_flag(). However, Conv_cnote_proc_flag_buf_t
   1284  * uses CONV_CNOTE_PROC_FLAG_BUFSIZE to set the buffer size. We do
   1285  * things this way because the definition of PROCFLGSZ uses information
   1286  * that is not available in the environment of other programs
   1287  * that include the conv.h header file.
   1288  */
   1289 #if (CONV_CNOTE_PROC_FLAG_BUFSIZE != PROCFLGSZ) && !defined(__lint)
   1290 #define	REPORT_BUFSIZE PROCFLGSZ
   1291 #include "report_bufsize.h"
   1292 #error "CONV_CNOTE_PROC_FLAG_BUFSIZE does not match PROCFLGSZ"
   1293 #endif
   1294 
   1295 const char *
   1296 conv_cnote_proc_flag(int flags, Conv_fmt_flags_t fmt_flags,
   1297     Conv_cnote_proc_flag_buf_t *cnote_proc_flag_buf)
   1298 {
   1299 	/*
   1300 	 * Most of the proc flags are implementation dependant, and can
   1301 	 * change between releases. As such, we do not attempt to translate
   1302 	 * them to symbolic form, but simply report them in hex form.
   1303 	 * However, SMSACCT and SSYS are special, and their bit values
   1304 	 * are maintained between releases so they can be used in the
   1305 	 * psinfo_t.p_flag field. We therefore translate these items.
   1306 	 *
   1307 	 * See <system/proc.h>
   1308 	 *
   1309 	 * Note: We don't want to include <sys/proc.h> in this file, because
   1310 	 * it redefines 'struct list', which we have defined in sgs.h. As
   1311 	 * SMSACCT and SSYS are stable public values, we simply use
   1312 	 * their numeric value.
   1313 	 */
   1314 	static const Val_desc vda[] = {
   1315 		{ 0x00000001, 		MSG_PROC_FLAG_SSYS },
   1316 		{ 0x02000000,		MSG_PROC_FLAG_SMSACCT },
   1317 		{ 0,			0 }
   1318 	};
   1319 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1320 	    NULL, sizeof (cnote_proc_flag_buf->buf) };
   1321 
   1322 	if (flags == 0)
   1323 		return (MSG_ORIG(MSG_GBL_ZERO));
   1324 
   1325 	conv_arg.buf = cnote_proc_flag_buf->buf;
   1326 	conv_arg.oflags = conv_arg.rflags = flags;
   1327 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1328 
   1329 	return ((const char *)cnote_proc_flag_buf->buf);
   1330 }
   1331 
   1332 
   1333 #define	SAFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1334 	MSG_SA_ONSTACK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1335 	MSG_SA_RESETHAND_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1336 	MSG_SA_RESTART_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1337 	MSG_SA_SIGINFO_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1338 	MSG_SA_NODEFER_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1339 	MSG_SA_NOCLDWAIT_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1340 	MSG_SA_NOCLDSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1341 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1342 
   1343 /*
   1344  * Ensure that Conv_cnote_sa_flags_buf_t is large enough:
   1345  *
   1346  * SAFLGSZ is the real minimum size of the buffer required by
   1347  * conv_cnote_sa_flags(). However, Conv_cnote_sa_flags_buf_t
   1348  * uses CONV_CNOTE_SA_FLAGS_BUFSIZE to set the buffer size. We do
   1349  * things this way because the definition of SAFLGSZ uses information
   1350  * that is not available in the environment of other programs
   1351  * that include the conv.h header file.
   1352  */
   1353 #if (CONV_CNOTE_SA_FLAGS_BUFSIZE != SAFLGSZ) && !defined(__lint)
   1354 #define	REPORT_BUFSIZE SAFLGSZ
   1355 #include "report_bufsize.h"
   1356 #error "CONV_CNOTE_SA_FLAGS_BUFSIZE does not match SAFLGSZ"
   1357 #endif
   1358 
   1359 const char *
   1360 conv_cnote_sa_flags(int flags, Conv_fmt_flags_t fmt_flags,
   1361     Conv_cnote_sa_flags_buf_t *cnote_sa_flags_buf)
   1362 {
   1363 	static const Val_desc vda[] = {
   1364 		{ SA_ONSTACK,		MSG_SA_ONSTACK },
   1365 		{ SA_RESETHAND,		MSG_SA_RESETHAND },
   1366 		{ SA_RESTART,		MSG_SA_RESTART },
   1367 		{ SA_SIGINFO,		MSG_SA_SIGINFO },
   1368 		{ SA_NODEFER,		MSG_SA_NODEFER },
   1369 		{ SA_NOCLDWAIT,		MSG_SA_NOCLDWAIT },
   1370 		{ SA_NOCLDSTOP,		MSG_SA_NOCLDSTOP },
   1371 		{ 0,			0 }
   1372 	};
   1373 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1374 	    NULL, sizeof (cnote_sa_flags_buf->buf) };
   1375 
   1376 	if (flags == 0)
   1377 		return (MSG_ORIG(MSG_GBL_ZERO));
   1378 
   1379 	conv_arg.buf = cnote_sa_flags_buf->buf;
   1380 	conv_arg.oflags = conv_arg.rflags = flags;
   1381 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1382 
   1383 	return ((const char *)cnote_sa_flags_buf->buf);
   1384 }
   1385 
   1386 
   1387 #define	SSFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1388 	MSG_SS_ONSTACK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1389 	MSG_SS_DISABLE_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1390 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1391 
   1392 /*
   1393  * Ensure that Conv_cnote_ss_flags_buf_t is large enough:
   1394  *
   1395  * SSFLGSZ is the real minimum size of the buffer required by
   1396  * conv_cnote_ss_flags(). However, Conv_cnote_ss_flags_buf_t
   1397  * uses CONV_CNOTE_SS_FLAGS_BUFSIZE to set the buffer size. We do
   1398  * things this way because the definition of SSFLGSZ uses information
   1399  * that is not available in the environment of other programs
   1400  * that include the conv.h header file.
   1401  */
   1402 #if (CONV_CNOTE_SS_FLAGS_BUFSIZE != SSFLGSZ) && !defined(__lint)
   1403 #define	REPORT_BUFSIZE SSFLGSZ
   1404 #include "report_bufsize.h"
   1405 #error "CONV_CNOTE_SS_FLAGS_BUFSIZE does not match SSFLGSZ"
   1406 #endif
   1407 
   1408 const char *
   1409 conv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
   1410     Conv_cnote_ss_flags_buf_t *cnote_ss_flags_buf)
   1411 {
   1412 	static const Val_desc vda[] = {
   1413 		{ SS_ONSTACK,		MSG_SS_ONSTACK },
   1414 		{ SS_DISABLE,		MSG_SS_DISABLE },
   1415 		{ 0,			0 }
   1416 	};
   1417 	static CONV_EXPN_FIELD_ARG conv_arg = {
   1418 	    NULL, sizeof (cnote_ss_flags_buf->buf) };
   1419 
   1420 	if (flags == 0)
   1421 		return (MSG_ORIG(MSG_GBL_ZERO));
   1422 
   1423 	conv_arg.buf = cnote_ss_flags_buf->buf;
   1424 	conv_arg.oflags = conv_arg.rflags = flags;
   1425 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
   1426 
   1427 	return ((const char *)cnote_ss_flags_buf->buf);
   1428 }
   1429 
   1430 
   1431 /*
   1432  * Solaris has a variety of types that use bitmasks to represent
   1433  * sets of things like signals (sigset_t), faults (fltset_t), and
   1434  * system calls (sysset_t). These types use arrays of unsigned 32-bit
   1435  * integers to represent the set. These are public types that
   1436  * cannot be changed, so they are generously oversized to allow
   1437  * for future growth. Hence, there are usually unused bits.
   1438  *
   1439  * conv_bitmaskset() generalizes the process of displaying these items.
   1440  */
   1441 
   1442 typedef struct {
   1443 	const Val_desc	*vdp;		/* NULL, or bitmask description */
   1444 	uint32_t	unused_bits;	/* Mask of undefined bits */
   1445 } conv_bitmaskset_desc_t;
   1446 
   1447 /*
   1448  * entry:
   1449  *	n_mask - # of 32-bit masks that make up this bitmask type.
   1450  *	maskarr - Array of n_mask 32-bit mask values
   1451  *	bitmask_descarr - Array of n_mask bitmask_desc_t descriptors,
   1452  *		one for each mask, specifying the bitmask names, and
   1453  *		a mask of the bits that are not defined by the system.
   1454  *	fmt_flags - CONV_FMT_* values, used to specify formatting details.
   1455  *	conv_buf - Buffer to receive formatted results
   1456  *	conv_buf_size - Size of conv_buf, including room for NULL termination
   1457  */
   1458 static const char *
   1459 conv_bitmaskset(uint32_t *maskarr, int n_mask,
   1460     const conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
   1461     char *conv_buf, size_t conv_buf_size)
   1462 {
   1463 	CONV_EXPN_FIELD_ARG	conv_arg;
   1464 	int	i, need_sep = 0;
   1465 
   1466 	/* If every bit of every mask is 0, return 0 as the result */
   1467 	for (i = 0; i < n_mask; i++)
   1468 		if (maskarr[i] != 0)
   1469 			break;
   1470 	if (i == n_mask)
   1471 		return (MSG_ORIG(MSG_GBL_ZERO));
   1472 
   1473 	/*
   1474 	 * At least one bit is non-zero. Move through the masks
   1475 	 * and process each one.
   1476 	 */
   1477 	(void) memset(&conv_arg, 0, sizeof (conv_arg));
   1478 	conv_arg.bufsize = conv_buf_size;
   1479 	conv_arg.buf = conv_buf;
   1480 	if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
   1481 		*conv_arg.buf++ = '[';
   1482 		*conv_arg.buf++ = ' ';
   1483 		conv_arg.bufsize -= 2;
   1484 	}
   1485 
   1486 	/*
   1487 	 * conv_expn_field() orders its output with the most significant
   1488 	 * bits on the left. To preserve this ordering across the
   1489 	 * subwords or our "virtual bitmask", we need to process
   1490 	 * the sub-words in the same order, from most significant down
   1491 	 * to least significant. Since unassigned bits tend to be at
   1492 	 * the MSB end of the word, we process the unused bits first.
   1493 	 *
   1494 	 * One implication of this is that the caller should not use
   1495 	 * the unassigned bits for "abandoned" bits in the middle of
   1496 	 * a used range, but should instead define the string for
   1497 	 * that bit as being the string representation of that decimal
   1498 	 * value (i.e. "65"). That will cause the bit to be properly
   1499 	 * sorted among the named bits to either side of it.
   1500 	 */
   1501 	for (i = 0; i < n_mask; i++) {
   1502 		size_t		n;
   1503 		uint32_t	mask, unused_bits;
   1504 		const int	bits_per_mask = sizeof (mask) * 8;
   1505 
   1506 		mask = maskarr[i];
   1507 		unused_bits = mask & bitmask_descarr[i].unused_bits;
   1508 		mask &= ~unused_bits;
   1509 
   1510 		if (mask != 0) {
   1511 
   1512 			conv_arg.oflags = conv_arg.rflags = mask;
   1513 			if (need_sep) {
   1514 				*conv_arg.buf++ = ' ';
   1515 				conv_arg.bufsize--;
   1516 			}
   1517 			need_sep = 1;
   1518 			(void) conv_expn_field(&conv_arg,
   1519 			    bitmask_descarr[i].vdp, fmt_flags | CONV_FMT_NOBKT);
   1520 			n = strlen(conv_arg.buf);
   1521 			conv_arg.bufsize -= n;
   1522 			conv_arg.buf += n;
   1523 		}
   1524 
   1525 		if (unused_bits != 0) {
   1526 			uint32_t	bit = 0x00000001;
   1527 			int		j;
   1528 
   1529 			for (j = 1; j <= bits_per_mask; j++, bit *= 2) {
   1530 				if ((unused_bits & bit) == 0)
   1531 					continue;
   1532 
   1533 				if (need_sep) {
   1534 					*conv_arg.buf++ = ' ';
   1535 					conv_arg.bufsize--;
   1536 				}
   1537 				need_sep = 1;
   1538 				n = snprintf(conv_arg.buf, conv_arg.bufsize,
   1539 				    MSG_ORIG(MSG_FMT_WORD),
   1540 				    EC_WORD(j + (bits_per_mask * i)));
   1541 				conv_arg.buf += n;
   1542 				conv_arg.bufsize -= n;
   1543 			}
   1544 		}
   1545 	}
   1546 	if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
   1547 		*conv_arg.buf++ = ' ';
   1548 		*conv_arg.buf++ = ']';
   1549 	}
   1550 	*conv_arg.buf = '\0';
   1551 
   1552 	return ((const char *) conv_buf);
   1553 }
   1554 
   1555 
   1556 #define	SIGSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1557 	/* sigset_t [0] - Signals [1 - 32] */ \
   1558 	MSG_SIGHUP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1559 	MSG_SIGINT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1560 	MSG_SIGQUIT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1561 	MSG_SIGILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1562 	MSG_SIGTRAP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1563 	MSG_SIGABRT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1564 	MSG_SIGEMT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1565 	MSG_SIGFPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1566 	MSG_SIGKILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1567 	MSG_SIGBUS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1568 	MSG_SIGSEGV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1569 	MSG_SIGSYS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1570 	MSG_SIGPIPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1571 	MSG_SIGALRM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1572 	MSG_SIGTERM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1573 	MSG_SIGUSR1_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1574 	MSG_SIGUSR2_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1575 	MSG_SIGCHLD_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1576 	MSG_SIGPWR_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1577 	MSG_SIGWINCH_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1578 	MSG_SIGURG_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1579 	MSG_SIGPOLL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1580 	MSG_SIGSTOP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1581 	MSG_SIGTSTP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1582 	MSG_SIGCONT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1583 	MSG_SIGTTIN_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1584 	MSG_SIGTTOU_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1585 	MSG_SIGVTALRM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1586 	MSG_SIGPROF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1587 	MSG_SIGXCPU_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1588 	MSG_SIGXFSZ_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1589 	MSG_SIGWAITING_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1590 	\
   1591 	/* \
   1592 	 * sigset_t [1] - Signals [33 - 64] \
   1593 	 * There are 24 unused bits, each of which needs two \
   1594 	 * characters plus a separator. \
   1595 	 */ \
   1596 	MSG_SIGLWP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1597 	MSG_SIGFREEZE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1598 	MSG_SIGTHAW_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1599 	MSG_SIGCANCEL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1600 	MSG_SIGLOST_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1601 	MSG_SIGXRES_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1602 	MSG_SIGJVM1_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1603 	MSG_SIGJVM2_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1604 	(24 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1605 	\
   1606 	/* \
   1607 	 * sigset_t [2] - Signals [65 - 96] \
   1608 	 * There are 32 unused bits, each of which needs two \
   1609 	 * characters plus a separator. \
   1610 	 */ \
   1611 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1612 	\
   1613 	/* \
   1614 	 * sigset_t [2] - Signals [97 - 128] \
   1615 	 * There are 32 unused bits. Three of these need two \
   1616 	 * characters, and 29 need 3. Each one needs a separator. \
   1617 	 */ \
   1618 	(3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1619 	(29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1620 	\
   1621 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1622 
   1623 /*
   1624  * Ensure that Conv_cnote_sigset_buf_t is large enough:
   1625  *
   1626  * SIGSET_FLAGSZ is the real minimum size of the buffer required by
   1627  * conv_cnote_sigset(). However, Conv_cnote_sigset_buf_t
   1628  * uses CONV_CNOTE_SIGSET_BUFSIZE to set the buffer size. We do
   1629  * things this way because the definition of SIGSET_FLAGSZ uses information
   1630  * that is not available in the environment of other programs
   1631  * that include the conv.h header file.
   1632  */
   1633 #if (CONV_CNOTE_SIGSET_BUFSIZE != SIGSET_FLAGSZ) && !defined(__lint)
   1634 #define	REPORT_BUFSIZE SIGSET_FLAGSZ
   1635 #include "report_bufsize.h"
   1636 #error "CONV_CNOTE_SIGSET_BUFSIZE does not match SIGSET_FLAGSZ"
   1637 #endif
   1638 
   1639 const char *
   1640 conv_cnote_sigset(uint32_t *maskarr, int n_mask,
   1641     Conv_fmt_flags_t fmt_flags, Conv_cnote_sigset_buf_t *cnote_sigset_buf)
   1642 {
   1643 #define	N_MASK 4
   1644 
   1645 	static const Val_desc vda0[] = {
   1646 		{ 0x00000001,		MSG_SIGHUP_ALT },
   1647 		{ 0x00000002,		MSG_SIGINT_ALT },
   1648 		{ 0x00000004,		MSG_SIGQUIT_ALT },
   1649 		{ 0x00000008,		MSG_SIGILL_ALT },
   1650 		{ 0x00000010,		MSG_SIGTRAP_ALT },
   1651 		{ 0x00000020,		MSG_SIGABRT_ALT },
   1652 		{ 0x00000040,		MSG_SIGEMT_ALT },
   1653 		{ 0x00000080,		MSG_SIGFPE_ALT },
   1654 		{ 0x00000100,		MSG_SIGKILL_ALT },
   1655 		{ 0x00000200,		MSG_SIGBUS_ALT },
   1656 		{ 0x00000400,		MSG_SIGSEGV_ALT },
   1657 		{ 0x00000800,		MSG_SIGSYS_ALT },
   1658 		{ 0x00001000,		MSG_SIGPIPE_ALT },
   1659 		{ 0x00002000,		MSG_SIGALRM_ALT },
   1660 		{ 0x00004000,		MSG_SIGTERM_ALT },
   1661 		{ 0x00008000,		MSG_SIGUSR1_ALT },
   1662 		{ 0x00010000,		MSG_SIGUSR2_ALT },
   1663 		{ 0x00020000,		MSG_SIGCHLD_ALT },
   1664 		{ 0x00040000,		MSG_SIGPWR_ALT },
   1665 		{ 0x00080000,		MSG_SIGWINCH_ALT },
   1666 		{ 0x00100000,		MSG_SIGURG_ALT },
   1667 		{ 0x00200000,		MSG_SIGPOLL_ALT },
   1668 		{ 0x00400000,		MSG_SIGSTOP_ALT },
   1669 		{ 0x00800000,		MSG_SIGTSTP_ALT },
   1670 		{ 0x01000000,		MSG_SIGCONT_ALT },
   1671 		{ 0x02000000,		MSG_SIGTTIN_ALT },
   1672 		{ 0x04000000,		MSG_SIGTTOU_ALT },
   1673 		{ 0x08000000,		MSG_SIGVTALRM_ALT },
   1674 		{ 0x10000000,		MSG_SIGPROF_ALT },
   1675 		{ 0x20000000,		MSG_SIGXCPU_ALT },
   1676 		{ 0x40000000,		MSG_SIGXFSZ_ALT },
   1677 		{ 0x80000000,		MSG_SIGWAITING_ALT },
   1678 		{ 0,			0 }
   1679 	};
   1680 	static const Val_desc vda1[] = {
   1681 		{ 0x00000001,		MSG_SIGLWP_ALT },
   1682 		{ 0x00000002,		MSG_SIGFREEZE_ALT },
   1683 		{ 0x00000004,		MSG_SIGTHAW_ALT },
   1684 		{ 0x00000008,		MSG_SIGCANCEL_ALT },
   1685 		{ 0x00000010,		MSG_SIGLOST_ALT },
   1686 		{ 0x00000020,		MSG_SIGXRES_ALT },
   1687 		{ 0x00000040,		MSG_SIGJVM1_ALT },
   1688 		{ 0x00000080,		MSG_SIGJVM2_ALT },
   1689 		{ 0,			0 }
   1690 	};
   1691 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
   1692 		{ vda0, 0 },
   1693 		{ vda1, 0xffffff00 },
   1694 		{ NULL, 0xffffffff },
   1695 		{ NULL, 0xffffffff }
   1696 	};
   1697 
   1698 	if (n_mask > N_MASK)
   1699 		n_mask = N_MASK;
   1700 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
   1701 	    cnote_sigset_buf->buf, CONV_CNOTE_SIGSET_BUFSIZE));
   1702 
   1703 #undef N_MASK
   1704 }
   1705 
   1706 
   1707 #define	FLTSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1708 	/* \
   1709 	 * fltset_t[0] - Faults [1 - 32] \
   1710 	 * There are 19 unused bits, each of which needs two \
   1711 	 * characters plus a separator. \
   1712 	 */ \
   1713 	MSG_FLTILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1714 	MSG_FLTPRIV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1715 	MSG_FLTBPT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1716 	MSG_FLTTRACE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1717 	MSG_FLTACCESS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1718 	MSG_FLTBOUNDS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1719 	MSG_FLTIOVF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1720 	MSG_FLTIZDIV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1721 	MSG_FLTFPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1722 	MSG_FLTSTACK_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1723 	MSG_FLTPAGE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1724 	MSG_FLTWATCH_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1725 	MSG_FLTCPCOVF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
   1726 	(19 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1727 	/* \
   1728 	 * fltset_t [1] - Faults [33 - 64] \
   1729 	 * There are 32 unused bits, each of which needs two \
   1730 	 * characters plus a separator. \
   1731 	 */ \
   1732 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1733 	/* \
   1734 	 * fltset_t [2] - Faults [65 - 96] \
   1735 	 * There are 32 unused bits, each of which needs two \
   1736 	 * characters plus a separator. \
   1737 	 */ \
   1738 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1739 	/* \
   1740 	 * fltset_t [3] - Faults [97 - 128] \
   1741 	 * There are 32 unused bits. Three of these need two \
   1742 	 * characters, and 29 need 3. Each one needs a separator. \
   1743 	 */ \
   1744 	(3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1745 	(29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
   1746 	\
   1747 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   1748 
   1749 /*
   1750  * Ensure that Conv_cnote_fltset_buf_t is large enough:
   1751  *
   1752  * FLTSET_FLAGSZ is the real minimum size of the buffer required by
   1753  * conv_cnote_fltset(). However, Conv_cnote_fltset_buf_t
   1754  * uses CONV_CNOTE_FLTSET_BUFSIZE to set the buffer size. We do
   1755  * things this way because the definition of FLTSET_FLAGSZ uses information
   1756  * that is not available in the environment of other programs
   1757  * that include the conv.h header file.
   1758  */
   1759 #if (CONV_CNOTE_FLTSET_BUFSIZE != FLTSET_FLAGSZ) && !defined(__lint)
   1760 #define	REPORT_BUFSIZE FLTSET_FLAGSZ
   1761 #include "report_bufsize.h"
   1762 #error "CONV_CNOTE_FLTSET_BUFSIZE does not match FLTSET_FLAGSZ"
   1763 #endif
   1764 
   1765 const char *
   1766 conv_cnote_fltset(uint32_t *maskarr, int n_mask,
   1767     Conv_fmt_flags_t fmt_flags, Conv_cnote_fltset_buf_t *cnote_fltset_buf)
   1768 {
   1769 #define	N_MASK 4
   1770 
   1771 	static const Val_desc vda0[] = {
   1772 		{ 0x00000001,		MSG_FLTILL_ALT },
   1773 		{ 0x00000002,		MSG_FLTPRIV_ALT },
   1774 		{ 0x00000004,		MSG_FLTBPT_ALT },
   1775 		{ 0x00000008,		MSG_FLTTRACE_ALT },
   1776 		{ 0x00000010,		MSG_FLTACCESS_ALT },
   1777 		{ 0x00000020,		MSG_FLTBOUNDS_ALT },
   1778 		{ 0x00000040,		MSG_FLTIOVF_ALT },
   1779 		{ 0x00000080,		MSG_FLTIZDIV_ALT },
   1780 		{ 0x00000100,		MSG_FLTFPE_ALT },
   1781 		{ 0x00000200,		MSG_FLTSTACK_ALT },
   1782 		{ 0x00000400,		MSG_FLTPAGE_ALT },
   1783 		{ 0x00000800,		MSG_FLTWATCH_ALT },
   1784 		{ 0x00001000,		MSG_FLTCPCOVF_ALT },
   1785 		{ 0,			0 }
   1786 	};
   1787 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
   1788 		{ vda0, 0xffffe000 },
   1789 		{ NULL, 0xffffffff },
   1790 		{ NULL, 0xffffffff },
   1791 		{ NULL, 0xffffffff }
   1792 	};
   1793 
   1794 	if (n_mask > N_MASK)
   1795 		n_mask = N_MASK;
   1796 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
   1797 	    cnote_fltset_buf->buf, CONV_CNOTE_FLTSET_BUFSIZE));
   1798 
   1799 #undef N_MASK
   1800 }
   1801 
   1802 
   1803 
   1804 #define	SYSSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
   1805 	(512 * CONV_EXPN_FIELD_DEF_SEP_SIZE) + \
   1806 	\
   1807 	/* sysset_t[0] - System Calls [1 - 32] */ \
   1808 	MSG_SYS_EXIT_ALT_SIZE			/* 1 */ + \
   1809 	MSG_SYS_FORKALL_ALT_SIZE		/* 2 */ + \
   1810 	MSG_SYS_READ_ALT_SIZE			/* 3 */ + \
   1811 	MSG_SYS_WRITE_ALT_SIZE			/* 4 */ + \
   1812 	MSG_SYS_OPEN_ALT_SIZE			/* 5 */ + \
   1813 	MSG_SYS_CLOSE_ALT_SIZE			/* 6 */ + \
   1814 	MSG_SYS_WAIT_ALT_SIZE			/* 7 */ + \
   1815 	MSG_SYS_CREAT_ALT_SIZE			/* 8 */ + \
   1816 	MSG_SYS_LINK_ALT_SIZE			/* 9 */ + \
   1817 	MSG_SYS_UNLINK_ALT_SIZE			/* 10 */ + \
   1818 	MSG_SYS_EXEC_ALT_SIZE			/* 11 */ + \
   1819 	MSG_SYS_CHDIR_ALT_SIZE			/* 12 */ + \
   1820 	MSG_SYS_TIME_ALT_SIZE			/* 13 */ + \
   1821 	MSG_SYS_MKNOD_ALT_SIZE			/* 14 */ + \
   1822 	MSG_SYS_CHMOD_ALT_SIZE			/* 15 */ + \
   1823 	MSG_SYS_CHOWN_ALT_SIZE			/* 16 */ + \
   1824 	MSG_SYS_BRK_ALT_SIZE			/* 17 */ + \
   1825 	MSG_SYS_STAT_ALT_SIZE			/* 18 */ + \
   1826 	MSG_SYS_LSEEK_ALT_SIZE			/* 19 */ + \
   1827 	MSG_SYS_GETPID_ALT_SIZE			/* 20 */ + \
   1828 	MSG_SYS_MOUNT_ALT_SIZE			/* 21 */ + \
   1829 	MSG_SYS_UMOUNT_ALT_SIZE			/* 22 */ + \
   1830 	MSG_SYS_SETUID_ALT_SIZE			/* 23 */ + \
   1831 	MSG_SYS_GETUID_ALT_SIZE			/* 24 */ + \
   1832 	MSG_SYS_STIME_ALT_SIZE			/* 25 */ + \
   1833 	MSG_SYS_PCSAMPLE_ALT_SIZE		/* 26 */ + \
   1834 	MSG_SYS_ALARM_ALT_SIZE			/* 27 */ + \
   1835 	MSG_SYS_FSTAT_ALT_SIZE			/* 28 */ + \
   1836 	MSG_SYS_PAUSE_ALT_SIZE			/* 29 */ + \
   1837 	MSG_SYS_UTIME_ALT_SIZE			/* 30 */ + \
   1838 	MSG_SYS_STTY_ALT_SIZE			/* 31 */ + \
   1839 	MSG_SYS_GTTY_ALT_SIZE			/* 32 */ + \
   1840 	\
   1841 	/* sysset_t[1] - System Calls [33 - 64] */ \
   1842 	MSG_SYS_ACCESS_ALT_SIZE			/* 33 */ + \
   1843 	MSG_SYS_NICE_ALT_SIZE			/* 34 */ + \
   1844 	MSG_SYS_STATFS_ALT_SIZE			/* 35 */ + \
   1845 	MSG_SYS_SYNC_ALT_SIZE			/* 36 */ + \
   1846 	MSG_SYS_KILL_ALT_SIZE			/* 37 */ + \
   1847 	MSG_SYS_FSTATFS_ALT_SIZE		/* 38 */ + \
   1848 	MSG_SYS_PGRPSYS_ALT_SIZE		/* 39 */ + \
   1849 	MSG_SYS_UUCOPYSTR_ALT_SIZE		/* 40 */ + \
   1850 	MSG_SYS_DUP_ALT_SIZE			/* 41 */ + \
   1851 	MSG_SYS_PIPE_ALT_SIZE			/* 42 */ + \
   1852 	MSG_SYS_TIMES_ALT_SIZE			/* 43 */ + \
   1853 	MSG_SYS_PROFIL_ALT_SIZE			/* 44 */ + \
   1854 	MSG_SYS_PLOCK_ALT_SIZE			/* 45 */ + \
   1855 	MSG_SYS_SETGID_ALT_SIZE			/* 46 */ + \
   1856 	MSG_SYS_GETGID_ALT_SIZE			/* 47 */ + \
   1857 	MSG_SYS_SIGNAL_ALT_SIZE			/* 48 */ + \
   1858 	MSG_SYS_MSGSYS_ALT_SIZE			/* 49 */ + \
   1859 	MSG_SYS_SYSI86_ALT_SIZE			/* 50 */ + \
   1860 	MSG_SYS_ACCT_ALT_SIZE			/* 51 */ + \
   1861 	MSG_SYS_SHMSYS_ALT_SIZE			/* 52 */ + \
   1862 	MSG_SYS_SEMSYS_ALT_SIZE			/* 53 */ + \
   1863 	MSG_SYS_IOCTL_ALT_SIZE			/* 54 */ + \
   1864 	MSG_SYS_UADMIN_ALT_SIZE			/* 55 */ + \
   1865 	MSG_SYS_56_SIZE				/* 56 (unused) */ + \
   1866 	MSG_SYS_UTSSYS_ALT_SIZE			/* 57 */ + \
   1867 	MSG_SYS_FDSYNC_ALT_SIZE			/* 58 */ + \
   1868 	MSG_SYS_EXECVE_ALT_SIZE			/* 59 */ + \
   1869 	MSG_SYS_UMASK_ALT_SIZE			/* 60 */ + \
   1870 	MSG_SYS_CHROOT_ALT_SIZE			/* 61 */ + \
   1871 	MSG_SYS_FCNTL_ALT_SIZE			/* 62 */ + \
   1872 	MSG_SYS_ULIMIT_ALT_SIZE			/* 63 */ + \
   1873 	MSG_SYS_64_SIZE				/* 64 (reserved) */ + \
   1874 	\
   1875 	/* sysset_t[2] - System Calls [65 - 96] */ \
   1876 	MSG_SYS_65_SIZE				/* 65 (reserved) */ + \
   1877 	MSG_SYS_66_SIZE				/* 66 (reserved) */ + \
   1878 	MSG_SYS_67_SIZE				/* 67 (reserved) */ + \
   1879 	MSG_SYS_68_SIZE				/* 68 (reserved) */ + \
   1880 	MSG_SYS_69_SIZE				/* 69 (reserved) */ + \
   1881 	MSG_SYS_TASKSYS_ALT_SIZE		/* 70 */ + \
   1882 	MSG_SYS_ACCTCTL_ALT_SIZE		/* 71 */ + \
   1883 	MSG_SYS_EXACCTSYS_ALT_SIZE		/* 72 */ + \
   1884 	MSG_SYS_GETPAGESIZES_ALT_SIZE		/* 73 */ + \
   1885 	MSG_SYS_RCTLSYS_ALT_SIZE		/* 74 */ + \
   1886 	MSG_SYS_SIDSYS_ALT_SIZE			/* 75 */ + \
   1887 	MSG_SYS_FSAT_ALT_SIZE			/* 76 */ + \
   1888 	MSG_SYS_LWP_PARK_ALT_SIZE		/* 77 */ + \
   1889 	MSG_SYS_SENDFILEV_ALT_SIZE		/* 78 */ + \
   1890 	MSG_SYS_RMDIR_ALT_SIZE			/* 79 */ + \
   1891 	MSG_SYS_MKDIR_ALT_SIZE			/* 80 */ + \
   1892 	MSG_SYS_GETDENTS_ALT_SIZE		/* 81 */ + \
   1893 	MSG_SYS_PRIVSYS_ALT_SIZE		/* 82 */ + \
   1894 	MSG_SYS_UCREDSYS_ALT_SIZE		/* 83 */ + \
   1895 	MSG_SYS_SYSFS_ALT_SIZE			/* 84 */ + \
   1896 	MSG_SYS_GETMSG_ALT_SIZE			/* 85 */ + \
   1897 	MSG_SYS_PUTMSG_ALT_SIZE			/* 86 */ + \
   1898 	MSG_SYS_POLL_ALT_SIZE			/* 87 */ + \
   1899 	MSG_SYS_LSTAT_ALT_SIZE			/* 88 */ + \
   1900 	MSG_SYS_SYMLINK_ALT_SIZE		/* 89 */ + \
   1901 	MSG_SYS_READLINK_ALT_SIZE		/* 90 */ + \
   1902 	MSG_SYS_SETGROUPS_ALT_SIZE		/* 91 */ + \
   1903 	MSG_SYS_GETGROUPS_ALT_SIZE		/* 92 */ + \
   1904 	MSG_SYS_FCHMOD_ALT_SIZE			/* 93 */ + \
   1905 	MSG_SYS_FCHOWN_ALT_SIZE			/* 94 */ + \
   1906 	MSG_SYS_SIGPROCMASK_ALT_SIZE		/* 95 */ + \
   1907 	MSG_SYS_SIGSUSPEND_ALT_SIZE		/* 96 */ + \
   1908 	\
   1909 	/* sysset_t[3] - System Calls [97 - 128] */ \
   1910 	MSG_SYS_SIGALTSTACK_ALT_SIZE		/* 97 */ + \
   1911 	MSG_SYS_SIGACTION_ALT_SIZE		/* 98 */ + \
   1912 	MSG_SYS_SIGPENDING_ALT_SIZE		/* 99 */ + \
   1913 	MSG_SYS_CONTEXT_ALT_SIZE		/* 100 */ + \
   1914 	MSG_SYS_EVSYS_ALT_SIZE			/* 101 */ + \
   1915 	MSG_SYS_EVTRAPRET_ALT_SIZE		/* 102 */ + \
   1916 	MSG_SYS_STATVFS_ALT_SIZE		/* 103 */ + \
   1917 	MSG_SYS_FSTATVFS_ALT_SIZE		/* 104 */ + \
   1918 	MSG_SYS_GETLOADAVG_ALT_SIZE		/* 105 */ + \
   1919 	MSG_SYS_NFSSYS_ALT_SIZE			/* 106 */ + \
   1920 	MSG_SYS_WAITID_ALT_SIZE			/* 107 */ + \
   1921 	MSG_SYS_SIGSENDSYS_ALT_SIZE		/* 108 */ + \
   1922 	MSG_SYS_HRTSYS_ALT_SIZE			/* 109 */ + \
   1923 	MSG_SYS_110_SIZE			/* 110 (unused) */ + \
   1924 	MSG_SYS_SIGRESEND_ALT_SIZE		/* 111 */ + \
   1925 	MSG_SYS_PRIOCNTLSYS_ALT_SIZE		/* 112 */ + \
   1926 	MSG_SYS_PATHCONF_ALT_SIZE		/* 113 */ + \
   1927 	MSG_SYS_MINCORE_ALT_SIZE		/* 114 */ + \
   1928 	MSG_SYS_MMAP_ALT_SIZE			/* 115 */ + \
   1929 	MSG_SYS_MPROTECT_ALT_SIZE		/* 116 */ + \
   1930 	MSG_SYS_MUNMAP_ALT_SIZE			/* 117 */ + \
   1931 	MSG_SYS_FPATHCONF_ALT_SIZE		/* 118 */ + \
   1932 	MSG_SYS_VFORK_ALT_SIZE			/* 119 */ + \
   1933 	MSG_SYS_FCHDIR_ALT_SIZE			/* 120 */ + \
   1934 	MSG_SYS_READV_ALT_SIZE			/* 121 */ + \
   1935 	MSG_SYS_WRITEV_ALT_SIZE			/* 122 */ + \
   1936 	MSG_SYS_XSTAT_ALT_SIZE			/* 123 */ + \
   1937 	MSG_SYS_LXSTAT_ALT_SIZE			/* 124 */ + \
   1938 	MSG_SYS_FXSTAT_ALT_SIZE			/* 125 */ + \
   1939 	MSG_SYS_XMKNOD_ALT_SIZE			/* 126 */ + \
   1940 	MSG_SYS_127_SIZE			/* 127 (unused) */ + \
   1941 	MSG_SYS_SETRLIMIT_ALT_SIZE		/* 128 */ + \
   1942 	\
   1943 	/* sysset_t[4] - System Calls [129 - 160] */ \
   1944 	MSG_SYS_GETRLIMIT_ALT_SIZE		/* 129 */ + \
   1945 	MSG_SYS_LCHOWN_ALT_SIZE			/* 130 */ + \
   1946 	MSG_SYS_MEMCNTL_ALT_SIZE		/* 131 */ + \
   1947 	MSG_SYS_GETPMSG_ALT_SIZE		/* 132 */ + \
   1948 	MSG_SYS_PUTPMSG_ALT_SIZE		/* 133 */ + \
   1949 	MSG_SYS_RENAME_ALT_SIZE			/* 134 */ + \
   1950 	MSG_SYS_UNAME_ALT_SIZE			/* 135 */ + \
   1951 	MSG_SYS_SETEGID_ALT_SIZE		/* 136 */ + \
   1952 	MSG_SYS_SYSCONFIG_ALT_SIZE		/* 137 */ + \
   1953 	MSG_SYS_ADJTIME_ALT_SIZE		/* 138 */ + \
   1954 	MSG_SYS_SYSTEMINFO_ALT_SIZE		/* 139 */ + \
   1955 	MSG_SYS_SHAREFS_ALT_SIZE		/* 140 */ + \
   1956 	MSG_SYS_SETEUID_ALT_SIZE		/* 141 */ + \
   1957 	MSG_SYS_FORKSYS_ALT_SIZE		/* 142 */ + \
   1958 	MSG_SYS_FORK1_ALT_SIZE			/* 143 */ + \
   1959 	MSG_SYS_SIGTIMEDWAIT_ALT_SIZE		/* 144 */ + \
   1960 	MSG_SYS_LWP_INFO_ALT_SIZE		/* 145 */ + \
   1961 	MSG_SYS_YIELD_ALT_SIZE			/* 146 */ + \
   1962 	MSG_SYS_LWP_SEMA_WAIT_ALT_SIZE		/* 147 */ + \
   1963 	MSG_SYS_LWP_SEMA_POST_ALT_SIZE		/* 148 */ + \
   1964 	MSG_SYS_LWP_SEMA_TRYWAIT_ALT_SIZE	/* 149 */ + \
   1965 	MSG_SYS_LWP_DETACH_ALT_SIZE		/* 150 */ + \
   1966 	MSG_SYS_CORECTL_ALT_SIZE		/* 151 */ + \
   1967 	MSG_SYS_MODCTL_ALT_SIZE			/* 152 */ + \
   1968 	MSG_SYS_FCHROOT_ALT_SIZE		/* 153 */ + \
   1969 	MSG_SYS_UTIMES_ALT_SIZE			/* 154 */ + \
   1970 	MSG_SYS_VHANGUP_ALT_SIZE		/* 155 */ + \
   1971 	MSG_SYS_GETTIMEOFDAY_ALT_SIZE		/* 156 */ + \
   1972 	MSG_SYS_GETITIMER_ALT_SIZE		/* 157 */ + \
   1973 	MSG_SYS_SETITIMER_ALT_SIZE		/* 158 */ + \
   1974 	MSG_SYS_LWP_CREATE_ALT_SIZE		/* 159 */ + \
   1975 	MSG_SYS_LWP_EXIT_ALT_SIZE		/* 160 */ + \
   1976 	\
   1977 	/* sysset_t[5] - System Calls [161 - 192] */ \
   1978 	MSG_SYS_LWP_SUSPEND_ALT_SIZE		/* 161 */ + \
   1979 	MSG_SYS_LWP_CONTINUE_ALT_SIZE		/* 162 */ + \
   1980 	MSG_SYS_LWP_KILL_ALT_SIZE		/* 163 */ + \
   1981 	MSG_SYS_LWP_SELF_ALT_SIZE		/* 164 */ + \
   1982 	MSG_SYS_LWP_SIGMASK_ALT_SIZE		/* 165 */ + \
   1983 	MSG_SYS_LWP_PRIVATE_ALT_SIZE		/* 166 */ + \
   1984 	MSG_SYS_LWP_WAIT_ALT_SIZE		/* 167 */ + \
   1985 	MSG_SYS_LWP_MUTEX_WAKEUP_ALT_SIZE	/* 168 */ + \
   1986 	MSG_SYS_LWP_MUTEX_LOCK_ALT_SIZE		/* 169 */ + \
   1987 	MSG_SYS_LWP_COND_WAIT_ALT_SIZE		/* 170 */ + \
   1988 	MSG_SYS_LWP_COND_SIGNAL_ALT_SIZE	/* 171 */ + \
   1989 	MSG_SYS_LWP_COND_BROADCAST_ALT_SIZE	/* 172 */ + \
   1990 	MSG_SYS_PREAD_ALT_SIZE			/* 173 */ + \
   1991 	MSG_SYS_PWRITE_ALT_SIZE			/* 174 */ + \
   1992 	MSG_SYS_LLSEEK_ALT_SIZE			/* 175 */ + \
   1993 	MSG_SYS_INST_SYNC_ALT_SIZE		/* 176 */ + \
   1994 	MSG_SYS_BRAND_ALT_SIZE			/* 177 */ + \
   1995 	MSG_SYS_KAIO_ALT_SIZE			/* 178 */ + \
   1996 	MSG_SYS_CPC_ALT_SIZE			/* 179 */ + \
   1997 	MSG_SYS_LGRPSYS_ALT_SIZE		/* 180 */ + \
   1998 	MSG_SYS_RUSAGESYS_ALT_SIZE		/* 181 */ + \
   1999 	MSG_SYS_PORT_ALT_SIZE			/* 182 */ + \
   2000 	MSG_SYS_POLLSYS_ALT_SIZE		/* 183 */ + \
   2001 	MSG_SYS_LABELSYS_ALT_SIZE		/* 184 */ + \
   2002 	MSG_SYS_ACL_ALT_SIZE			/* 185 */ + \
   2003 	MSG_SYS_AUDITSYS_ALT_SIZE		/* 186 */ + \
   2004 	MSG_SYS_PROCESSOR_BIND_ALT_SIZE		/* 187 */ + \
   2005 	MSG_SYS_PROCESSOR_INFO_ALT_SIZE		/* 188 */ + \
   2006 	MSG_SYS_P_ONLINE_ALT_SIZE		/* 189 */ + \
   2007 	MSG_SYS_SIGQUEUE_ALT_SIZE		/* 190 */ + \
   2008 	MSG_SYS_CLOCK_GETTIME_ALT_SIZE		/* 191 */ + \
   2009 	MSG_SYS_CLOCK_SETTIME_ALT_SIZE		/* 192 */ + \
   2010 	\
   2011 	/* sysset_t[6] - System Calls [193 - 224] */ \
   2012 	MSG_SYS_CLOCK_GETRES_ALT_SIZE		/* 193 */ + \
   2013 	MSG_SYS_TIMER_CREATE_ALT_SIZE		/* 194 */ + \
   2014 	MSG_SYS_TIMER_DELETE_ALT_SIZE		/* 195 */ + \
   2015 	MSG_SYS_TIMER_SETTIME_ALT_SIZE		/* 196 */ + \
   2016 	MSG_SYS_TIMER_GETTIME_ALT_SIZE		/* 197 */ + \
   2017 	MSG_SYS_TIMER_GETOVERRUN_ALT_SIZE	/* 198 */ + \
   2018 	MSG_SYS_NANOSLEEP_ALT_SIZE		/* 199 */ + \
   2019 	MSG_SYS_FACL_ALT_SIZE			/* 200 */ + \
   2020 	MSG_SYS_DOOR_ALT_SIZE			/* 201 */ + \
   2021 	MSG_SYS_SETREUID_ALT_SIZE		/* 202 */ + \
   2022 	MSG_SYS_SETREGID_ALT_SIZE		/* 203 */ + \
   2023 	MSG_SYS_INSTALL_UTRAP_ALT_SIZE		/* 204 */ + \
   2024 	MSG_SYS_SIGNOTIFY_ALT_SIZE		/* 205 */ + \
   2025 	MSG_SYS_SCHEDCTL_ALT_SIZE		/* 206 */ + \
   2026 	MSG_SYS_PSET_ALT_SIZE			/* 207 */ + \
   2027 	MSG_SYS_SPARC_UTRAP_INSTALL_ALT_SIZE	/* 208 */ + \
   2028 	MSG_SYS_RESOLVEPATH_ALT_SIZE		/* 209 */ + \
   2029 	MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT_SIZE	/* 210 */ + \
   2030 	MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT_SIZE	/* 211 */ + \
   2031 	MSG_SYS_LWP_RWLOCK_SYS_ALT_SIZE		/* 212 */ + \
   2032 	MSG_SYS_GETDENTS64_ALT_SIZE		/* 213 */ + \
   2033 	MSG_SYS_MMAP64_ALT_SIZE			/* 214 */ + \
   2034 	MSG_SYS_STAT64_ALT_SIZE			/* 215 */ + \
   2035 	MSG_SYS_LSTAT64_ALT_SIZE		/* 216 */ + \
   2036 	MSG_SYS_FSTAT64_ALT_SIZE		/* 217 */ + \
   2037 	MSG_SYS_STATVFS64_ALT_SIZE		/* 218 */ + \
   2038 	MSG_SYS_FSTATVFS64_ALT_SIZE		/* 219 */ + \
   2039 	MSG_SYS_SETRLIMIT64_ALT_SIZE		/* 220 */ + \
   2040 	MSG_SYS_GETRLIMIT64_ALT_SIZE		/* 221 */ + \
   2041 	MSG_SYS_PREAD64_ALT_SIZE		/* 222 */ + \
   2042 	MSG_SYS_PWRITE64_ALT_SIZE		/* 223 */ + \
   2043 	MSG_SYS_CREAT64_ALT_SIZE		/* 224 */ + \
   2044 	\
   2045 	/* sysset_t[7] - System Calls [225 - 256] */ \
   2046 	MSG_SYS_OPEN64_ALT_SIZE			/* 225 */ + \
   2047 	MSG_SYS_RPCSYS_ALT_SIZE			/* 226 */ + \
   2048 	MSG_SYS_ZONE_ALT_SIZE			/* 227 */ + \
   2049 	MSG_SYS_AUTOFSSYS_ALT_SIZE		/* 228 */ + \
   2050 	MSG_SYS_GETCWD_ALT_SIZE			/* 229 */ + \
   2051 	MSG_SYS_SO_SOCKET_ALT_SIZE		/* 230 */ + \
   2052 	MSG_SYS_SO_SOCKETPAIR_ALT_SIZE		/* 231 */ + \
   2053 	MSG_SYS_BIND_ALT_SIZE			/* 232 */ + \
   2054 	MSG_SYS_LISTEN_ALT_SIZE			/* 233 */ + \
   2055 	MSG_SYS_ACCEPT_ALT_SIZE			/* 234 */ + \
   2056 	MSG_SYS_CONNECT_ALT_SIZE		/* 235 */ + \
   2057 	MSG_SYS_SHUTDOWN_ALT_SIZE		/* 236 */ + \
   2058 	MSG_SYS_RECV_ALT_SIZE			/* 237 */ + \
   2059 	MSG_SYS_RECVFROM_ALT_SIZE		/* 238 */ + \
   2060 	MSG_SYS_RECVMSG_ALT_SIZE		/* 239 */ + \
   2061 	MSG_SYS_SEND_ALT_SIZE			/* 240 */ + \
   2062 	MSG_SYS_SENDMSG_ALT_SIZE		/* 241 */ + \
   2063 	MSG_SYS_SENDTO_ALT_SIZE			/* 242 */ + \
   2064 	MSG_SYS_GETPEERNAME_ALT_SIZE		/* 243 */ + \
   2065 	MSG_SYS_GETSOCKNAME_ALT_SIZE		/* 244 */ + \
   2066 	MSG_SYS_GETSOCKOPT_ALT_SIZE		/* 245 */ + \
   2067 	MSG_SYS_SETSOCKOPT_ALT_SIZE		/* 246 */ + \
   2068 	MSG_SYS_SOCKCONFIG_ALT_SIZE		/* 247 */ + \
   2069 	MSG_SYS_NTP_GETTIME_ALT_SIZE		/* 248 */ + \
   2070 	MSG_SYS_NTP_ADJTIME_ALT_SIZE		/* 249 */ + \
   2071 	MSG_SYS_LWP_MUTEX_UNLOCK_ALT_SIZE	/* 250 */ + \
   2072 	MSG_SYS_LWP_MUTEX_TRYLOCK_ALT_SIZE	/* 251 */ + \
   2073 	MSG_SYS_LWP_MUTEX_REGISTER_ALT_SIZE	/* 252 */ + \
   2074 	MSG_SYS_CLADM_ALT_SIZE			/* 253 */ + \
   2075 	MSG_SYS_UUCOPY_ALT_SIZE			/* 254 */ + \
   2076 	MSG_SYS_UMOUNT2_ALT_SIZE		/* 255 */ + \
   2077 	3					/* 256 (unused) */ + \
   2078 	\
   2079 	/* sysset_t[8] - System Calls [257 - 288] */ \
   2080 	(32 * 3)				/* 257 - 288 (unused) */ + \
   2081 	\
   2082 	/* sysset_t[9] - System Calls [289 - 320] */ \
   2083 	(32 * 3)				/* 289 - 320 (unused) */ + \
   2084 	\
   2085 	/* sysset_t[10] - System Calls [321 - 352] */ \
   2086 	(32 * 3)				/* 321 - 352 (unused) */ + \
   2087 	\
   2088 	/* sysset_t[11] - System Calls [353 - 384] */ \
   2089 	(32 * 3)				/* 353 - 384 (unused) */ + \
   2090 	\
   2091 	/* sysset_t[12] - System Calls [385 - 416] */ \
   2092 	(32 * 3)				/* 385 - 416 (unused) */ + \
   2093 	\
   2094 	/* sysset_t[13] - System Calls [417 - 448] */ \
   2095 	(32 * 3)				/* 417 - 448 (unused) */ + \
   2096 	\
   2097 	/* sysset_t[14] - System Calls [449 - 480] */ \
   2098 	(32 * 3)				/* 449 - 480 (unused) */ + \
   2099 	\
   2100 	/* sysset_t[15] - System Calls [481 - 512] */ \
   2101 	(32 * 3)				/* 481 - 512 (unused) */ + \
   2102 	\
   2103 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
   2104 
   2105 /*
   2106  * Ensure that Conv_cnote_sysset_buf_t is large enough:
   2107  *
   2108  * SYSSET_FLAGSZ is the real minimum size of the buffer required by
   2109  * conv_cnote_sysset(). However, Conv_cnote_sysset_buf_t
   2110  * uses CONV_CNOTE_SYSSET_BUFSIZE to set the buffer size. We do
   2111  * things this way because the definition of SYSSET_FLAGSZ uses information
   2112  * that is not available in the environment of other programs
   2113  * that include the conv.h header file.
   2114  */
   2115 #if (CONV_CNOTE_SYSSET_BUFSIZE != SYSSET_FLAGSZ) && !defined(__lint)
   2116 #define	REPORT_BUFSIZE SYSSET_FLAGSZ
   2117 #include "report_bufsize.h"
   2118 #error "CONV_CNOTE_SYSSET_BUFSIZE does not match SYSSET_FLAGSZ"
   2119 #endif
   2120 
   2121 const char *
   2122 conv_cnote_sysset(uint32_t *maskarr, int n_mask,
   2123     Conv_fmt_flags_t fmt_flags, Conv_cnote_sysset_buf_t *cnote_sysset_buf)
   2124 {
   2125 #define	N_MASK 16
   2126 
   2127 	static const Val_desc vda0[] = {	/* System Calls [1 - 32] */
   2128 		{ 0x00000001,	MSG_SYS_EXIT_ALT },
   2129 		{ 0x00000002,	MSG_SYS_FORKALL_ALT },
   2130 		{ 0x00000004,	MSG_SYS_READ_ALT },
   2131 		{ 0x00000008,	MSG_SYS_WRITE_ALT },
   2132 		{ 0x00000010,	MSG_SYS_OPEN_ALT },
   2133 		{ 0x00000020,	MSG_SYS_CLOSE_ALT },
   2134 		{ 0x00000040,	MSG_SYS_WAIT_ALT },
   2135 		{ 0x00000080,	MSG_SYS_CREAT_ALT },
   2136 		{ 0x00000100,	MSG_SYS_LINK_ALT },
   2137 		{ 0x00000200,	MSG_SYS_UNLINK_ALT },
   2138 		{ 0x00000400,	MSG_SYS_EXEC_ALT },
   2139 		{ 0x00000800,	MSG_SYS_CHDIR_ALT },
   2140 		{ 0x00001000,	MSG_SYS_TIME_ALT },
   2141 		{ 0x00002000,	MSG_SYS_MKNOD_ALT },
   2142 		{ 0x00004000,	MSG_SYS_CHMOD_ALT },
   2143 		{ 0x00008000,	MSG_SYS_CHOWN_ALT },
   2144 		{ 0x00010000,	MSG_SYS_BRK_ALT },
   2145 		{ 0x00020000,	MSG_SYS_STAT_ALT },
   2146 		{ 0x00040000,	MSG_SYS_LSEEK_ALT },
   2147 		{ 0x00080000,	MSG_SYS_GETPID_ALT },
   2148 		{ 0x00100000,	MSG_SYS_MOUNT_ALT },
   2149 		{ 0x00200000,	MSG_SYS_UMOUNT_ALT },
   2150 		{ 0x00400000,	MSG_SYS_SETUID_ALT },
   2151 		{ 0x00800000,	MSG_SYS_GETUID_ALT },
   2152 		{ 0x01000000,	MSG_SYS_STIME_ALT },
   2153 		{ 0x02000000,	MSG_SYS_PCSAMPLE_ALT },
   2154 		{ 0x04000000,	MSG_SYS_ALARM_ALT },
   2155 		{ 0x08000000,	MSG_SYS_FSTAT_ALT },
   2156 		{ 0x10000000,	MSG_SYS_PAUSE_ALT },
   2157 		{ 0x20000000,	MSG_SYS_UTIME_ALT },
   2158 		{ 0x40000000,	MSG_SYS_STTY_ALT },
   2159 		{ 0x80000000,	MSG_SYS_GTTY_ALT },
   2160 		{ 0,		0 }
   2161 	};
   2162 	static const Val_desc vda1[] = {	/* System Calls [33 - 64] */
   2163 		{ 0x00000001,	MSG_SYS_ACCESS_ALT },
   2164 		{ 0x00000002,	MSG_SYS_NICE_ALT },
   2165 		{ 0x00000004,	MSG_SYS_STATFS_ALT },
   2166 		{ 0x00000008,	MSG_SYS_SYNC_ALT },
   2167 		{ 0x00000010,	MSG_SYS_KILL_ALT },
   2168 		{ 0x00000020,	MSG_SYS_FSTATFS_ALT },
   2169 		{ 0x00000040,	MSG_SYS_PGRPSYS_ALT },
   2170 		{ 0x00000080,	MSG_SYS_UUCOPYSTR_ALT },
   2171 		{ 0x00000100,	MSG_SYS_DUP_ALT },
   2172 		{ 0x00000200,	MSG_SYS_PIPE_ALT },
   2173 		{ 0x00000400,	MSG_SYS_TIMES_ALT },
   2174 		{ 0x00000800,	MSG_SYS_PROFIL_ALT },
   2175 		{ 0x00001000,	MSG_SYS_PLOCK_ALT },
   2176 		{ 0x00002000,	MSG_SYS_SETGID_ALT },
   2177 		{ 0x00004000,	MSG_SYS_GETGID_ALT },
   2178 		{ 0x00008000,	MSG_SYS_SIGNAL_ALT },
   2179 		{ 0x00010000,	MSG_SYS_MSGSYS_ALT },
   2180 		{ 0x00020000,	MSG_SYS_SYSI86_ALT },
   2181 		{ 0x00040000,	MSG_SYS_ACCT_ALT },
   2182 		{ 0x00080000,	MSG_SYS_SHMSYS_ALT },
   2183 		{ 0x00100000,	MSG_SYS_SEMSYS_ALT },
   2184 		{ 0x00200000,	MSG_SYS_IOCTL_ALT },
   2185 		{ 0x00400000,	MSG_SYS_UADMIN_ALT },
   2186 		{ 0x00800000,	MSG_SYS_56 },
   2187 		{ 0x01000000,	MSG_SYS_UTSSYS_ALT },
   2188 		{ 0x0200000,	MSG_SYS_FDSYNC_ALT },
   2189 		{ 0x04000000,	MSG_SYS_EXECVE_ALT },
   2190 		{ 0x08000000,	MSG_SYS_UMASK_ALT },
   2191 		{ 0x10000000,	MSG_SYS_CHROOT_ALT },
   2192 		{ 0x20000000,	MSG_SYS_FCNTL_ALT },
   2193 		{ 0x40000000,	MSG_SYS_ULIMIT_ALT },
   2194 		{ 0x80000000,	MSG_SYS_64 },
   2195 		{ 0,		0 }
   2196 	};
   2197 	static const Val_desc vda2[] = {	/* System Calls [65 - 96] */
   2198 		{ 0x00000001,	MSG_SYS_65 },
   2199 		{ 0x00000002,	MSG_SYS_66 },
   2200 		{ 0x00000004,	MSG_SYS_67 },
   2201 		{ 0x00000008,	MSG_SYS_68 },
   2202 		{ 0x00000010,	MSG_SYS_69 },
   2203 		{ 0x00000020,	MSG_SYS_TASKSYS_ALT },
   2204 		{ 0x00000040,	MSG_SYS_ACCTCTL_ALT },
   2205 		{ 0x00000080,	MSG_SYS_EXACCTSYS_ALT },
   2206 		{ 0x00000100,	MSG_SYS_GETPAGESIZES_ALT },
   2207 		{ 0x00000200,	MSG_SYS_RCTLSYS_ALT },
   2208 		{ 0x00000400,	MSG_SYS_SIDSYS_ALT },
   2209 		{ 0x00000800,	MSG_SYS_FSAT_ALT },
   2210 		{ 0x00001000,	MSG_SYS_LWP_PARK_ALT },
   2211 		{ 0x00002000,	MSG_SYS_SENDFILEV_ALT },
   2212 		{ 0x00004000,	MSG_SYS_RMDIR_ALT },
   2213 		{ 0x00008000,	MSG_SYS_MKDIR_ALT },
   2214 		{ 0x00010000,	MSG_SYS_GETDENTS_ALT },
   2215 		{ 0x00020000,	MSG_SYS_PRIVSYS_ALT },
   2216 		{ 0x00040000,	MSG_SYS_UCREDSYS_ALT },
   2217 		{ 0x00080000,	MSG_SYS_SYSFS_ALT },
   2218 		{ 0x00100000,	MSG_SYS_GETMSG_ALT },
   2219 		{ 0x00200000,	MSG_SYS_PUTMSG_ALT },
   2220 		{ 0x00400000,	MSG_SYS_POLL_ALT },
   2221 		{ 0x00800000,	MSG_SYS_LSTAT_ALT },
   2222 		{ 0x01000000,	MSG_SYS_SYMLINK_ALT },
   2223 		{ 0x02000000,	MSG_SYS_READLINK_ALT },
   2224 		{ 0x04000000,	MSG_SYS_SETGROUPS_ALT },
   2225 		{ 0x08000000,	MSG_SYS_GETGROUPS_ALT },
   2226 		{ 0x10000000,	MSG_SYS_FCHMOD_ALT },
   2227 		{ 0x20000000,	MSG_SYS_FCHOWN_ALT },
   2228 		{ 0x40000000,	MSG_SYS_SIGPROCMASK_ALT },
   2229 		{ 0x80000000,	MSG_SYS_SIGSUSPEND_ALT },
   2230 		{ 0,		0 }
   2231 	};
   2232 	static const Val_desc vda3[] = {	/* System Calls [97 - 128] */
   2233 		{ 0x00000001,	MSG_SYS_SIGALTSTACK_ALT },
   2234 		{ 0x00000002,	MSG_SYS_SIGACTION_ALT },
   2235 		{ 0x00000004,	MSG_SYS_SIGPENDING_ALT },
   2236 		{ 0x00000008,	MSG_SYS_CONTEXT_ALT },
   2237 		{ 0x00000010,	MSG_SYS_EVSYS_ALT },
   2238 		{ 0x00000020,	MSG_SYS_EVTRAPRET_ALT },
   2239 		{ 0x00000040,	MSG_SYS_STATVFS_ALT },
   2240 		{ 0x00000080,	MSG_SYS_FSTATVFS_ALT },
   2241 		{ 0x00000100,	MSG_SYS_GETLOADAVG_ALT },
   2242 		{ 0x00000200,	MSG_SYS_NFSSYS_ALT },
   2243 		{ 0x00000400,	MSG_SYS_WAITID_ALT },
   2244 		{ 0x00000800,	MSG_SYS_SIGSENDSYS_ALT },
   2245 		{ 0x00001000,	MSG_SYS_HRTSYS_ALT },
   2246 		{ 0x00002000,	MSG_SYS_110 },
   2247 		{ 0x00004000,	MSG_SYS_SIGRESEND_ALT },
   2248 		{ 0x00008000,	MSG_SYS_PRIOCNTLSYS_ALT },
   2249 		{ 0x00010000,	MSG_SYS_PATHCONF_ALT },
   2250 		{ 0x00020000,	MSG_SYS_MINCORE_ALT },
   2251 		{ 0x00040000,	MSG_SYS_MMAP_ALT },
   2252 		{ 0x00080000,	MSG_SYS_MPROTECT_ALT },
   2253 		{ 0x00100000,	MSG_SYS_MUNMAP_ALT },
   2254 		{ 0x00200000,	MSG_SYS_FPATHCONF_ALT },
   2255 		{ 0x00400000,	MSG_SYS_VFORK_ALT },
   2256 		{ 0x00800000,	MSG_SYS_FCHDIR_ALT },
   2257 		{ 0x01000000,	MSG_SYS_READV_ALT },
   2258 		{ 0x02000000,	MSG_SYS_WRITEV_ALT },
   2259 		{ 0x04000000,	MSG_SYS_XSTAT_ALT },
   2260 		{ 0x08000000,	MSG_SYS_LXSTAT_ALT },
   2261 		{ 0x10000000,	MSG_SYS_FXSTAT_ALT },
   2262 		{ 0x20000000,	MSG_SYS_XMKNOD_ALT },
   2263 		{ 0x40000000,	MSG_SYS_127 },
   2264 		{ 0x80000000,	MSG_SYS_SETRLIMIT_ALT },
   2265 		{ 0,			0 }
   2266 	};
   2267 	static const Val_desc vda4[] = {	/* System Calls [129 - 160] */
   2268 		{ 0x00000001,	MSG_SYS_GETRLIMIT_ALT },
   2269 		{ 0x00000002,	MSG_SYS_LCHOWN_ALT },
   2270 		{ 0x00000004,	MSG_SYS_MEMCNTL_ALT },
   2271 		{ 0x00000008,	MSG_SYS_GETPMSG_ALT },
   2272 		{ 0x00000010,	MSG_SYS_PUTPMSG_ALT },
   2273 		{ 0x00000020,	MSG_SYS_RENAME_ALT },
   2274 		{ 0x00000040,	MSG_SYS_UNAME_ALT },
   2275 		{ 0x00000080,	MSG_SYS_SETEGID_ALT },
   2276 		{ 0x00000100,	MSG_SYS_SYSCONFIG_ALT },
   2277 		{ 0x00000200,	MSG_SYS_ADJTIME_ALT },
   2278 		{ 0x00000400,	MSG_SYS_SYSTEMINFO_ALT },
   2279 		{ 0x00000800,	MSG_SYS_SHAREFS_ALT },
   2280 		{ 0x00001000,	MSG_SYS_SETEUID_ALT },
   2281 		{ 0x00002000,	MSG_SYS_FORKSYS_ALT },
   2282 		{ 0x00004000,	MSG_SYS_FORK1_ALT },
   2283 		{ 0x00008000,	MSG_SYS_SIGTIMEDWAIT_ALT },
   2284 		{ 0x00010000,	MSG_SYS_LWP_INFO_ALT },
   2285 		{ 0x00020000,	MSG_SYS_YIELD_ALT },
   2286 		{ 0x00040000,	MSG_SYS_LWP_SEMA_WAIT_ALT },
   2287 		{ 0x00080000,	MSG_SYS_LWP_SEMA_POST_ALT },
   2288 		{ 0x00100000,	MSG_SYS_LWP_SEMA_TRYWAIT_ALT },
   2289 		{ 0x00200000,	MSG_SYS_LWP_DETACH_ALT },
   2290 		{ 0x00400000,	MSG_SYS_CORECTL_ALT },
   2291 		{ 0x00800000,	MSG_SYS_MODCTL_ALT },
   2292 		{ 0x01000000,	MSG_SYS_FCHROOT_ALT },
   2293 		{ 0x02000000,	MSG_SYS_UTIMES_ALT },
   2294 		{ 0x04000000,	MSG_SYS_VHANGUP_ALT },
   2295 		{ 0x08000000,	MSG_SYS_GETTIMEOFDAY_ALT },
   2296 		{ 0x10000000,	MSG_SYS_GETITIMER_ALT },
   2297 		{ 0x20000000,	MSG_SYS_SETITIMER_ALT },
   2298 		{ 0x40000000,	MSG_SYS_LWP_CREATE_ALT },
   2299 		{ 0x80000000,	MSG_SYS_LWP_EXIT_ALT },
   2300 		{ 0,		0 }
   2301 	};
   2302 	static const Val_desc vda5[] = {	/* System Calls [161 - 192] */
   2303 		{ 0x00000001,	MSG_SYS_LWP_SUSPEND_ALT },
   2304 		{ 0x00000002,	MSG_SYS_LWP_CONTINUE_ALT },
   2305 		{ 0x00000004,	MSG_SYS_LWP_KILL_ALT },
   2306 		{ 0x00000008,	MSG_SYS_LWP_SELF_ALT },
   2307 		{ 0x00000010,	MSG_SYS_LWP_SIGMASK_ALT },
   2308 		{ 0x00000020,	MSG_SYS_LWP_PRIVATE_ALT },
   2309 		{ 0x00000040,	MSG_SYS_LWP_WAIT_ALT },
   2310 		{ 0x00000080,	MSG_SYS_LWP_MUTEX_WAKEUP_ALT },
   2311 		{ 0x00000100,	MSG_SYS_LWP_MUTEX_LOCK_ALT },
   2312 		{ 0x00000200,	MSG_SYS_LWP_COND_WAIT_ALT },
   2313 		{ 0x00000400,	MSG_SYS_LWP_COND_SIGNAL_ALT },
   2314 		{ 0x00000800,	MSG_SYS_LWP_COND_BROADCAST_ALT },
   2315 		{ 0x00001000,	MSG_SYS_PREAD_ALT },
   2316 		{ 0x00002000,	MSG_SYS_PWRITE_ALT },
   2317 		{ 0x00004000,	MSG_SYS_LLSEEK_ALT },
   2318 		{ 0x00008000,	MSG_SYS_INST_SYNC_ALT },
   2319 		{ 0x00010000,	MSG_SYS_BRAND_ALT },
   2320 		{ 0x00020000,	MSG_SYS_KAIO_ALT },
   2321 		{ 0x00040000,	MSG_SYS_CPC_ALT },
   2322 		{ 0x00080000,	MSG_SYS_LGRPSYS_ALT },
   2323 		{ 0x00100000,	MSG_SYS_RUSAGESYS_ALT },
   2324 		{ 0x00200000,	MSG_SYS_PORT_ALT },
   2325 		{ 0x00400000,	MSG_SYS_POLLSYS_ALT },
   2326 		{ 0x00800000,	MSG_SYS_LABELSYS_ALT },
   2327 		{ 0x01000000,	MSG_SYS_ACL_ALT },
   2328 		{ 0x02000000,	MSG_SYS_AUDITSYS_ALT },
   2329 		{ 0x04000000,	MSG_SYS_PROCESSOR_BIND_ALT },
   2330 		{ 0x08000000,	MSG_SYS_PROCESSOR_INFO_ALT },
   2331 		{ 0x10000000,	MSG_SYS_P_ONLINE_ALT },
   2332 		{ 0x20000000,	MSG_SYS_SIGQUEUE_ALT },
   2333 		{ 0x40000000,	MSG_SYS_CLOCK_GETTIME_ALT },
   2334 		{ 0x80000000,	MSG_SYS_CLOCK_SETTIME_ALT },
   2335 		{ 0,		0 }
   2336 	};
   2337 	static const Val_desc vda6[] = {	/* System Calls [193 - 224] */
   2338 		{ 0x00000001,	MSG_SYS_CLOCK_GETRES_ALT },
   2339 		{ 0x00000002,	MSG_SYS_TIMER_CREATE_ALT },
   2340 		{ 0x00000004,	MSG_SYS_TIMER_DELETE_ALT },
   2341 		{ 0x00000008,	MSG_SYS_TIMER_SETTIME_ALT },
   2342 		{ 0x00000010,	MSG_SYS_TIMER_GETTIME_ALT },
   2343 		{ 0x00000020,	MSG_SYS_TIMER_GETOVERRUN_ALT },
   2344 		{ 0x00000040,	MSG_SYS_NANOSLEEP_ALT },
   2345 		{ 0x00000080,	MSG_SYS_FACL_ALT },
   2346 		{ 0x00000100,	MSG_SYS_DOOR_ALT },
   2347 		{ 0x00000200,	MSG_SYS_SETREUID_ALT },
   2348 		{ 0x00000400,	MSG_SYS_SETREGID_ALT },
   2349 		{ 0x00000800,	MSG_SYS_INSTALL_UTRAP_ALT },
   2350 		{ 0x00001000,	MSG_SYS_SIGNOTIFY_ALT },
   2351 		{ 0x00002000,	MSG_SYS_SCHEDCTL_ALT },
   2352 		{ 0x00004000,	MSG_SYS_PSET_ALT },
   2353 		{ 0x00008000,	MSG_SYS_SPARC_UTRAP_INSTALL_ALT },
   2354 		{ 0x00010000,	MSG_SYS_RESOLVEPATH_ALT },
   2355 		{ 0x00020000,	MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT },
   2356 		{ 0x00040000,	MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT },
   2357 		{ 0x00080000,	MSG_SYS_LWP_RWLOCK_SYS_ALT },
   2358 		{ 0x00100000,	MSG_SYS_GETDENTS64_ALT },
   2359 		{ 0x00200000,	MSG_SYS_MMAP64_ALT },
   2360 		{ 0x00400000,	MSG_SYS_STAT64_ALT },
   2361 		{ 0x00800000,	MSG_SYS_LSTAT64_ALT },
   2362 		{ 0x01000000,	MSG_SYS_FSTAT64_ALT },
   2363 		{ 0x02000000,	MSG_SYS_STATVFS64_ALT },
   2364 		{ 0x04000000,	MSG_SYS_FSTATVFS64_ALT },
   2365 		{ 0x08000000,	MSG_SYS_SETRLIMIT64_ALT },
   2366 		{ 0x10000000,	MSG_SYS_GETRLIMIT64_ALT },
   2367 		{ 0x20000000,	MSG_SYS_PREAD64_ALT },
   2368 		{ 0x40000000,	MSG_SYS_PWRITE64_ALT },
   2369 		{ 0x80000000,	MSG_SYS_CREAT64_ALT },
   2370 		{ 0,			0 }
   2371 	};
   2372 	static const Val_desc vda7[] = {	/* System Calls [225 - 256] */
   2373 		{ 0x00000001,	MSG_SYS_OPEN64_ALT },
   2374 		{ 0x00000002,	MSG_SYS_RPCSYS_ALT },
   2375 		{ 0x00000004,	MSG_SYS_ZONE_ALT },
   2376 		{ 0x00000008,	MSG_SYS_AUTOFSSYS_ALT },
   2377 		{ 0x00000010,	MSG_SYS_GETCWD_ALT },
   2378 		{ 0x00000020,	MSG_SYS_SO_SOCKET_ALT },
   2379 		{ 0x00000040,	MSG_SYS_SO_SOCKETPAIR_ALT },
   2380 		{ 0x00000080,	MSG_SYS_BIND_ALT },
   2381 		{ 0x00000100,	MSG_SYS_LISTEN_ALT },
   2382 		{ 0x00000200,	MSG_SYS_ACCEPT_ALT },
   2383 		{ 0x00000400,	MSG_SYS_CONNECT_ALT },
   2384 		{ 0x00000800,	MSG_SYS_SHUTDOWN_ALT },
   2385 		{ 0x00001000,	MSG_SYS_RECV_ALT },
   2386 		{ 0x00002000,	MSG_SYS_RECVFROM_ALT },
   2387 		{ 0x00004000,	MSG_SYS_RECVMSG_ALT },
   2388 		{ 0x00008000,	MSG_SYS_SEND_ALT },
   2389 		{ 0x00010000,	MSG_SYS_SENDMSG_ALT },
   2390 		{ 0x00020000,	MSG_SYS_SENDTO_ALT },
   2391 		{ 0x00040000,	MSG_SYS_GETPEERNAME_ALT },
   2392 		{ 0x00080000,	MSG_SYS_GETSOCKNAME_ALT },
   2393 		{ 0x00100000,	MSG_SYS_GETSOCKOPT_ALT },
   2394 		{ 0x00200000,	MSG_SYS_SETSOCKOPT_ALT },
   2395 		{ 0x00400000,	MSG_SYS_SOCKCONFIG_ALT },
   2396 		{ 0x00800000,	MSG_SYS_NTP_GETTIME_ALT },
   2397 		{ 0x01000000,	MSG_SYS_NTP_ADJTIME_ALT },
   2398 		{ 0x02000000,	MSG_SYS_LWP_MUTEX_UNLOCK_ALT },
   2399 		{ 0x04000000,	MSG_SYS_LWP_MUTEX_TRYLOCK_ALT },
   2400 		{ 0x08000000,	MSG_SYS_LWP_MUTEX_REGISTER_ALT },
   2401 		{ 0x10000000,	MSG_SYS_CLADM_ALT },
   2402 		{ 0x20000000,	MSG_SYS_UUCOPY_ALT },
   2403 		{ 0x40000000,	MSG_SYS_UMOUNT2_ALT },
   2404 		/* 256 (unused) */
   2405 		{ 0,		0 }
   2406 	};
   2407 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
   2408 		{ vda0, 0x00000000 },
   2409 		{ vda1, 0x00000000 },
   2410 		{ vda2, 0x00000000 },
   2411 		{ vda3, 0x00000000 },
   2412 		{ vda4, 0x00000000 },
   2413 		{ vda5, 0x00000000 },
   2414 		{ vda6, 0x00000000 },
   2415 		{ vda7, 0x80000000 },
   2416 		{ NULL, 0xffffffff },
   2417 		{ NULL, 0xffffffff },
   2418 		{ NULL, 0xffffffff },
   2419 		{ NULL, 0xffffffff },
   2420 		{ NULL, 0xffffffff },
   2421 		{ NULL, 0xffffffff },
   2422 		{ NULL, 0xffffffff },
   2423 		{ NULL, 0xffffffff }
   2424 	};
   2425 
   2426 	if (n_mask > N_MASK)
   2427 		n_mask = N_MASK;
   2428 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
   2429 	    cnote_sysset_buf->buf, CONV_CNOTE_SYSSET_BUFSIZE));
   2430 
   2431 #undef N_MASK
   2432 }
   2433