1c6c9aed4Sab /*
2c6c9aed4Sab  * CDDL HEADER START
3c6c9aed4Sab  *
4c6c9aed4Sab  * The contents of this file are subject to the terms of the
5c6c9aed4Sab  * Common Development and Distribution License (the "License").
6c6c9aed4Sab  * You may not use this file except in compliance with the License.
7c6c9aed4Sab  *
8c6c9aed4Sab  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9c6c9aed4Sab  * or http://www.opensolaris.org/os/licensing.
10c6c9aed4Sab  * See the License for the specific language governing permissions
11c6c9aed4Sab  * and limitations under the License.
12c6c9aed4Sab  *
13c6c9aed4Sab  * When distributing Covered Code, include this CDDL HEADER in each
14c6c9aed4Sab  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15c6c9aed4Sab  * If applicable, add the following below this CDDL HEADER, with the
16c6c9aed4Sab  * fields enclosed by brackets "[]" replaced with your own identifying
17c6c9aed4Sab  * information: Portions Copyright [yyyy] [name of copyright owner]
18c6c9aed4Sab  *
19c6c9aed4Sab  * CDDL HEADER END
20c6c9aed4Sab  */
21c6c9aed4Sab 
22c6c9aed4Sab /*
238fd04b83SRoger A. Faulkner  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24c6c9aed4Sab  * Use is subject to license terms.
25c6c9aed4Sab  */
2634bdffbfSGarrett D'Amore /*
2734bdffbfSGarrett D'Amore  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
28d0158222SRobert Mustacchi  * Copyright (c) 2018 Joyent, Inc.
2956726c7eSRobert Mustacchi  * Copyright 2022 Oxide Computer Company
3034bdffbfSGarrett D'Amore  */
31c6c9aed4Sab 
32c6c9aed4Sab /*
33c6c9aed4Sab  * String conversion routines the system structs found in
34c6c9aed4Sab  * Solaris core file note sections. These items are not
35c6c9aed4Sab  * ELF constructs. However, elfdump contains code for decoding
36c6c9aed4Sab  * them, and therefore requires formatting support.
37c6c9aed4Sab  */
38c6c9aed4Sab #include	<stdio.h>
39c6c9aed4Sab #include	<procfs.h>
40c6c9aed4Sab #include	<sys/corectl.h>
41d2a70789SRichard Lowe #include	<sys/secflags.h>
42c6c9aed4Sab #include	<string.h>
43c6c9aed4Sab #include	<_conv.h>
44c6c9aed4Sab #include	<corenote_msg.h>
45c6c9aed4Sab 
46c6c9aed4Sab const char *
conv_cnote_type(Word type,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)47c6c9aed4Sab conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
48c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
49c6c9aed4Sab {
50c6c9aed4Sab 	static const Msg	types[] = {
51c6c9aed4Sab 		MSG_NT_PRSTATUS,	MSG_NT_PRFPREG,
52c6c9aed4Sab 		MSG_NT_PRPSINFO,	MSG_NT_PRXREG,
53c6c9aed4Sab 		MSG_NT_PLATFORM,	MSG_NT_AUXV,
54c6c9aed4Sab 		MSG_NT_GWINDOWS,	MSG_NT_ASRS,
55c6c9aed4Sab 		MSG_NT_LDT,		MSG_NT_PSTATUS,
564f680cc6SAli Bahrami 		0,			0,
57c6c9aed4Sab 		MSG_NT_PSINFO,		MSG_NT_PRCRED,
58c6c9aed4Sab 		MSG_NT_UTSNAME,		MSG_NT_LWPSTATUS,
59c6c9aed4Sab 		MSG_NT_LWPSINFO,	MSG_NT_PRPRIV,
60c6c9aed4Sab 		MSG_NT_PRPRIVINFO,	MSG_NT_CONTENT,
61f971a346SBryan Cantrill 		MSG_NT_ZONENAME,	MSG_NT_FDINFO,
62ab618543SJohn Levon 		MSG_NT_SPYMASTER,	MSG_NT_SECFLAGS,
63350ffdd5SRobert Mustacchi 		MSG_NT_LWPNAME,		MSG_NT_UPANIC
64c6c9aed4Sab 	};
65350ffdd5SRobert Mustacchi #if NT_NUM != NT_UPANIC
66c6c9aed4Sab #error "NT_NUM has grown. Update core note types[]"
67c6c9aed4Sab #endif
684f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_types = {
694f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
704f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_types), NULL };
71c6c9aed4Sab 
72c6c9aed4Sab 
734f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
744f680cc6SAli Bahrami 	    inv_buf));
75c6c9aed4Sab }
76c6c9aed4Sab 
77c6c9aed4Sab 
78c6c9aed4Sab const char *
conv_cnote_auxv_type(Word type,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)79c6c9aed4Sab conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
80c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
81c6c9aed4Sab {
82c6c9aed4Sab 	static const Msg	types_0_22[] = {
83c6c9aed4Sab 		MSG_AUXV_AT_NULL,		MSG_AUXV_AT_IGNORE,
84c6c9aed4Sab 		MSG_AUXV_AT_EXECFD,		MSG_AUXV_AT_PHDR,
85c6c9aed4Sab 		MSG_AUXV_AT_PHENT,		MSG_AUXV_AT_PHNUM,
86c6c9aed4Sab 		MSG_AUXV_AT_PAGESZ,		MSG_AUXV_AT_BASE,
87c6c9aed4Sab 		MSG_AUXV_AT_FLAGS,		MSG_AUXV_AT_ENTRY,
88c6c9aed4Sab 		MSG_AUXV_AT_NOTELF,		MSG_AUXV_AT_UID,
89c6c9aed4Sab 		MSG_AUXV_AT_EUID,		MSG_AUXV_AT_GID,
90c6c9aed4Sab 		MSG_AUXV_AT_EGID,		MSG_AUXV_AT_PLATFORM,
91c6c9aed4Sab 		MSG_AUXV_AT_HWCAP,		MSG_AUXV_AT_CLKTCK,
92c6c9aed4Sab 		MSG_AUXV_AT_FPUCW,		MSG_AUXV_AT_DCACHEBSIZE,
93c6c9aed4Sab 		MSG_AUXV_AT_ICACHEBSIZE,	MSG_AUXV_AT_UCACHEBSIZE,
94c6c9aed4Sab 		MSG_AUXV_AT_IGNOREPPC
95c6c9aed4Sab 	};
964f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_types_0_22 = {
974f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(0, types_0_22) };
984f680cc6SAli Bahrami 
99c6c9aed4Sab 	static const Msg	types_2000_2011[] = {
100c6c9aed4Sab 		MSG_AUXV_AT_SUN_UID,		MSG_AUXV_AT_SUN_RUID,
101c6c9aed4Sab 		MSG_AUXV_AT_SUN_GID,		MSG_AUXV_AT_SUN_RGID,
102c6c9aed4Sab 		MSG_AUXV_AT_SUN_LDELF,		MSG_AUXV_AT_SUN_LDSHDR,
103c6c9aed4Sab 		MSG_AUXV_AT_SUN_LDNAME,		MSG_AUXV_AT_SUN_LPAGESZ,
104c6c9aed4Sab 		MSG_AUXV_AT_SUN_PLATFORM,	MSG_AUXV_AT_SUN_HWCAP,
105c6c9aed4Sab 		MSG_AUXV_AT_SUN_IFLUSH,		MSG_AUXV_AT_SUN_CPU
106c6c9aed4Sab 	};
1074f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_types_2000_2011 = {
1084f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(2000, types_2000_2011) };
1094f680cc6SAli Bahrami 
11056726c7eSRobert Mustacchi 	static const Msg	types_2014_2029[] = {
111c6c9aed4Sab 		MSG_AUXV_AT_SUN_EXECNAME,	MSG_AUXV_AT_SUN_MMU,
112c6c9aed4Sab 		MSG_AUXV_AT_SUN_LDDATA,		MSG_AUXV_AT_SUN_AUXFLAGS,
113c6c9aed4Sab 		MSG_AUXV_AT_SUN_EMULATOR,	MSG_AUXV_AT_SUN_BRANDNAME,
114c6c9aed4Sab 		MSG_AUXV_AT_SUN_BRAND_AUX1,	MSG_AUXV_AT_SUN_BRAND_AUX2,
115d2a70789SRichard Lowe 		MSG_AUXV_AT_SUN_BRAND_AUX3,	MSG_AUXV_AT_SUN_HWCAP2,
116ffca9b6bSToomas Soome 		0,				0,
117d0158222SRobert Mustacchi 		MSG_AUXV_AT_SUN_COMMPAGE,	MSG_AUXV_AT_SUN_FPTYPE,
11856726c7eSRobert Mustacchi 		MSG_AUXV_AT_SUN_FPSIZE,		MSG_AUXV_AT_SUN_HWCAP3
119c6c9aed4Sab 	};
12056726c7eSRobert Mustacchi 	static const conv_ds_msg_t ds_types_2014_2029 = {
12156726c7eSRobert Mustacchi 	    CONV_DS_MSG_INIT(2014, types_2014_2029) };
122c6c9aed4Sab 
1234f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = {
1244f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
12556726c7eSRobert Mustacchi 		CONV_DS_ADDR(ds_types_2014_2029), NULL };
126c6c9aed4Sab 
1274f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
1284f680cc6SAli Bahrami 	    inv_buf));
129c6c9aed4Sab }
130c6c9aed4Sab 
131c6c9aed4Sab 
132c6c9aed4Sab const char *
conv_cnote_signal(Word sig,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)133c6c9aed4Sab conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
134c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
135c6c9aed4Sab {
136c6c9aed4Sab 	static const Msg	sigarr[] = {
137c6c9aed4Sab 		MSG_SIGHUP,		MSG_SIGINT,
138c6c9aed4Sab 		MSG_SIGQUIT,		MSG_SIGILL,
139c6c9aed4Sab 		MSG_SIGTRAP,		MSG_SIGABRT,
140c6c9aed4Sab 		MSG_SIGEMT,		MSG_SIGFPE,
141c6c9aed4Sab 		MSG_SIGKILL,		MSG_SIGBUS,
142c6c9aed4Sab 		MSG_SIGSEGV,		MSG_SIGSYS,
143c6c9aed4Sab 		MSG_SIGPIPE,		MSG_SIGALRM,
144c6c9aed4Sab 		MSG_SIGTERM,		MSG_SIGUSR1,
145c6c9aed4Sab 		MSG_SIGUSR2,		MSG_SIGCHLD,
146c6c9aed4Sab 		MSG_SIGPWR,		MSG_SIGWINCH,
147c6c9aed4Sab 		MSG_SIGURG,		MSG_SIGPOLL,
148c6c9aed4Sab 		MSG_SIGSTOP,		MSG_SIGTSTP,
149c6c9aed4Sab 		MSG_SIGCONT,		MSG_SIGTTIN,
150c6c9aed4Sab 		MSG_SIGTTOU,		MSG_SIGVTALRM,
151c6c9aed4Sab 		MSG_SIGPROF,		MSG_SIGXCPU,
152c6c9aed4Sab 		MSG_SIGXFSZ,		MSG_SIGWAITING,
153c6c9aed4Sab 		MSG_SIGLWP,		MSG_SIGFREEZE,
154c6c9aed4Sab 		MSG_SIGTHAW,		MSG_SIGCANCEL,
155c6c9aed4Sab 		MSG_SIGLOST,		MSG_SIGXRES,
156c6c9aed4Sab 		MSG_SIGJVM1,		MSG_SIGJVM2,
157c6c9aed4Sab 	};
1584f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_sigarr = {
1594f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(SIGHUP, sigarr) };
160c6c9aed4Sab 
1614f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_sigarr), NULL };
162c6c9aed4Sab 
1634f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sig, ds, fmt_flags,
1644f680cc6SAli Bahrami 	    inv_buf));
165c6c9aed4Sab }
166c6c9aed4Sab 
167c6c9aed4Sab 
168c6c9aed4Sab const char *
conv_cnote_fault(Word flt,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)169c6c9aed4Sab conv_cnote_fault(Word flt, Conv_fmt_flags_t fmt_flags,
170c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
171c6c9aed4Sab {
172c6c9aed4Sab 	static const Msg	fltarr[] = {
173c6c9aed4Sab 		MSG_FLTILL,		MSG_FLTPRIV,
174c6c9aed4Sab 		MSG_FLTBPT,		MSG_FLTTRACE,
175c6c9aed4Sab 		MSG_FLTACCESS,		MSG_FLTBOUNDS,
176c6c9aed4Sab 		MSG_FLTIOVF,		MSG_FLTIZDIV,
177c6c9aed4Sab 		MSG_FLTFPE,		MSG_FLTSTACK,
178c6c9aed4Sab 		MSG_FLTPAGE,		MSG_FLTWATCH,
179c6c9aed4Sab 		MSG_FLTCPCOVF
180c6c9aed4Sab 
181c6c9aed4Sab 	};
1824f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_fltarr = {
1834f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(FLTILL, fltarr) };
184c6c9aed4Sab 
1854f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_fltarr), NULL };
186c6c9aed4Sab 
1874f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, flt, ds, fmt_flags,
1884f680cc6SAli Bahrami 	    inv_buf));
189c6c9aed4Sab }
190c6c9aed4Sab 
191c6c9aed4Sab 
192c6c9aed4Sab const char *
conv_cnote_syscall(Word sysnum,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)193c6c9aed4Sab conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
194c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
195c6c9aed4Sab {
196c6c9aed4Sab 	static const Msg	sysnumarr[] = {
1978fd04b83SRoger A. Faulkner 		MSG_SYS_EXIT,			MSG_SYS_2,
198c6c9aed4Sab 		MSG_SYS_READ,			MSG_SYS_WRITE,
199c6c9aed4Sab 		MSG_SYS_OPEN,			MSG_SYS_CLOSE,
2008fd04b83SRoger A. Faulkner 		MSG_SYS_7,			MSG_SYS_8,
201c6c9aed4Sab 		MSG_SYS_LINK,			MSG_SYS_UNLINK,
2028fd04b83SRoger A. Faulkner 		MSG_SYS_11,			MSG_SYS_CHDIR,
203c6c9aed4Sab 		MSG_SYS_TIME,			MSG_SYS_MKNOD,
204c6c9aed4Sab 		MSG_SYS_CHMOD,			MSG_SYS_CHOWN,
205c6c9aed4Sab 		MSG_SYS_BRK,			MSG_SYS_STAT,
206c6c9aed4Sab 		MSG_SYS_LSEEK,			MSG_SYS_GETPID,
2078fd04b83SRoger A. Faulkner 		MSG_SYS_MOUNT,			MSG_SYS_22,
208c6c9aed4Sab 		MSG_SYS_SETUID,			MSG_SYS_GETUID,
209c6c9aed4Sab 		MSG_SYS_STIME,			MSG_SYS_PCSAMPLE,
210c6c9aed4Sab 		MSG_SYS_ALARM,			MSG_SYS_FSTAT,
2118fd04b83SRoger A. Faulkner 		MSG_SYS_PAUSE,			MSG_SYS_30,
212c6c9aed4Sab 		MSG_SYS_STTY,			MSG_SYS_GTTY,
213c6c9aed4Sab 		MSG_SYS_ACCESS,			MSG_SYS_NICE,
214c6c9aed4Sab 		MSG_SYS_STATFS,			MSG_SYS_SYNC,
215c6c9aed4Sab 		MSG_SYS_KILL,			MSG_SYS_FSTATFS,
216c6c9aed4Sab 		MSG_SYS_PGRPSYS,		MSG_SYS_UUCOPYSTR,
2178fd04b83SRoger A. Faulkner 		MSG_SYS_41,			MSG_SYS_PIPE,
218c6c9aed4Sab 		MSG_SYS_TIMES,			MSG_SYS_PROFIL,
2198fd04b83SRoger A. Faulkner 		MSG_SYS_FACCESSAT,		MSG_SYS_SETGID,
2208fd04b83SRoger A. Faulkner 		MSG_SYS_GETGID,			MSG_SYS_48,
221c6c9aed4Sab 		MSG_SYS_MSGSYS,			MSG_SYS_SYSI86,
222c6c9aed4Sab 		MSG_SYS_ACCT,			MSG_SYS_SHMSYS,
223c6c9aed4Sab 		MSG_SYS_SEMSYS,			MSG_SYS_IOCTL,
2248fd04b83SRoger A. Faulkner 		MSG_SYS_UADMIN,			MSG_SYS_FCHOWNAT,
225c6c9aed4Sab 		MSG_SYS_UTSSYS,			MSG_SYS_FDSYNC,
226c6c9aed4Sab 		MSG_SYS_EXECVE,			MSG_SYS_UMASK,
227c6c9aed4Sab 		MSG_SYS_CHROOT,			MSG_SYS_FCNTL,
2288fd04b83SRoger A. Faulkner 		MSG_SYS_ULIMIT,			MSG_SYS_RENAMEAT,
2298fd04b83SRoger A. Faulkner 		MSG_SYS_UNLINKAT,		MSG_SYS_FSTATAT,
2308fd04b83SRoger A. Faulkner 		MSG_SYS_FSTATAT64,		MSG_SYS_OPENAT,
2318fd04b83SRoger A. Faulkner 		MSG_SYS_OPENAT64,		MSG_SYS_TASKSYS,
232c6c9aed4Sab 		MSG_SYS_ACCTCTL,		MSG_SYS_EXACCTSYS,
233c6c9aed4Sab 		MSG_SYS_GETPAGESIZES,		MSG_SYS_RCTLSYS,
2348fd04b83SRoger A. Faulkner 		MSG_SYS_SIDSYS,			MSG_SYS_76,
235c6c9aed4Sab 		MSG_SYS_LWP_PARK,		MSG_SYS_SENDFILEV,
236c6c9aed4Sab 		MSG_SYS_RMDIR,			MSG_SYS_MKDIR,
237c6c9aed4Sab 		MSG_SYS_GETDENTS,		MSG_SYS_PRIVSYS,
238c6c9aed4Sab 		MSG_SYS_UCREDSYS,		MSG_SYS_SYSFS,
239c6c9aed4Sab 		MSG_SYS_GETMSG,			MSG_SYS_PUTMSG,
2408fd04b83SRoger A. Faulkner 		MSG_SYS_87,			MSG_SYS_LSTAT,
241c6c9aed4Sab 		MSG_SYS_SYMLINK,		MSG_SYS_READLINK,
242c6c9aed4Sab 		MSG_SYS_SETGROUPS,		MSG_SYS_GETGROUPS,
243c6c9aed4Sab 		MSG_SYS_FCHMOD,			MSG_SYS_FCHOWN,
244c6c9aed4Sab 		MSG_SYS_SIGPROCMASK,		MSG_SYS_SIGSUSPEND,
245c6c9aed4Sab 		MSG_SYS_SIGALTSTACK,		MSG_SYS_SIGACTION,
246c6c9aed4Sab 		MSG_SYS_SIGPENDING,		MSG_SYS_CONTEXT,
2478fd04b83SRoger A. Faulkner 		MSG_SYS_101,			MSG_SYS_102,
248c6c9aed4Sab 		MSG_SYS_STATVFS,		MSG_SYS_FSTATVFS,
249c6c9aed4Sab 		MSG_SYS_GETLOADAVG,		MSG_SYS_NFSSYS,
250c6c9aed4Sab 		MSG_SYS_WAITID,			MSG_SYS_SIGSENDSYS,
2518fd04b83SRoger A. Faulkner 		MSG_SYS_HRTSYS,			MSG_SYS_UTIMESYS,
252c6c9aed4Sab 		MSG_SYS_SIGRESEND,		MSG_SYS_PRIOCNTLSYS,
253c6c9aed4Sab 		MSG_SYS_PATHCONF,		MSG_SYS_MINCORE,
254c6c9aed4Sab 		MSG_SYS_MMAP,			MSG_SYS_MPROTECT,
255c6c9aed4Sab 		MSG_SYS_MUNMAP,			MSG_SYS_FPATHCONF,
256c6c9aed4Sab 		MSG_SYS_VFORK,			MSG_SYS_FCHDIR,
257c6c9aed4Sab 		MSG_SYS_READV,			MSG_SYS_WRITEV,
258350ffdd5SRobert Mustacchi 		MSG_SYS_PREADV,			MSG_SYS_PWRITEV,
259350ffdd5SRobert Mustacchi 		MSG_SYS_UPANIC,			MSG_SYS_GETRANDOM,
2608fd04b83SRoger A. Faulkner 		MSG_SYS_MMAPOBJ,		MSG_SYS_SETRLIMIT,
261c6c9aed4Sab 		MSG_SYS_GETRLIMIT,		MSG_SYS_LCHOWN,
262c6c9aed4Sab 		MSG_SYS_MEMCNTL,		MSG_SYS_GETPMSG,
263c6c9aed4Sab 		MSG_SYS_PUTPMSG,		MSG_SYS_RENAME,
264c6c9aed4Sab 		MSG_SYS_UNAME,			MSG_SYS_SETEGID,
265c6c9aed4Sab 		MSG_SYS_SYSCONFIG,		MSG_SYS_ADJTIME,
266c6c9aed4Sab 		MSG_SYS_SYSTEMINFO,		MSG_SYS_SHAREFS,
267c6c9aed4Sab 		MSG_SYS_SETEUID,		MSG_SYS_FORKSYS,
2688fd04b83SRoger A. Faulkner 		MSG_SYS_143,			MSG_SYS_SIGTIMEDWAIT,
269c6c9aed4Sab 		MSG_SYS_LWP_INFO,		MSG_SYS_YIELD,
2708fd04b83SRoger A. Faulkner 		MSG_SYS_147,			MSG_SYS_LWP_SEMA_POST,
271c6c9aed4Sab 		MSG_SYS_LWP_SEMA_TRYWAIT,	MSG_SYS_LWP_DETACH,
272c6c9aed4Sab 		MSG_SYS_CORECTL,		MSG_SYS_MODCTL,
2738fd04b83SRoger A. Faulkner 		MSG_SYS_FCHROOT,		MSG_SYS_154,
274c6c9aed4Sab 		MSG_SYS_VHANGUP,		MSG_SYS_GETTIMEOFDAY,
275c6c9aed4Sab 		MSG_SYS_GETITIMER,		MSG_SYS_SETITIMER,
276c6c9aed4Sab 		MSG_SYS_LWP_CREATE,		MSG_SYS_LWP_EXIT,
277c6c9aed4Sab 		MSG_SYS_LWP_SUSPEND,		MSG_SYS_LWP_CONTINUE,
278c6c9aed4Sab 		MSG_SYS_LWP_KILL,		MSG_SYS_LWP_SELF,
279c6c9aed4Sab 		MSG_SYS_LWP_SIGMASK,		MSG_SYS_LWP_PRIVATE,
280c6c9aed4Sab 		MSG_SYS_LWP_WAIT,		MSG_SYS_LWP_MUTEX_WAKEUP,
2818fd04b83SRoger A. Faulkner 		MSG_SYS_169,			MSG_SYS_LWP_COND_WAIT,
282c6c9aed4Sab 		MSG_SYS_LWP_COND_SIGNAL,	MSG_SYS_LWP_COND_BROADCAST,
283c6c9aed4Sab 		MSG_SYS_PREAD,			MSG_SYS_PWRITE,
284c6c9aed4Sab 		MSG_SYS_LLSEEK,			MSG_SYS_INST_SYNC,
285c6c9aed4Sab 		MSG_SYS_BRAND,			MSG_SYS_KAIO,
286c6c9aed4Sab 		MSG_SYS_CPC,			MSG_SYS_LGRPSYS,
287c6c9aed4Sab 		MSG_SYS_RUSAGESYS,		MSG_SYS_PORT,
288c6c9aed4Sab 		MSG_SYS_POLLSYS,		MSG_SYS_LABELSYS,
289c6c9aed4Sab 		MSG_SYS_ACL,			MSG_SYS_AUDITSYS,
290c6c9aed4Sab 		MSG_SYS_PROCESSOR_BIND,		MSG_SYS_PROCESSOR_INFO,
291c6c9aed4Sab 		MSG_SYS_P_ONLINE,		MSG_SYS_SIGQUEUE,
292c6c9aed4Sab 		MSG_SYS_CLOCK_GETTIME,		MSG_SYS_CLOCK_SETTIME,
293c6c9aed4Sab 		MSG_SYS_CLOCK_GETRES,		MSG_SYS_TIMER_CREATE,
294c6c9aed4Sab 		MSG_SYS_TIMER_DELETE,		MSG_SYS_TIMER_SETTIME,
295c6c9aed4Sab 		MSG_SYS_TIMER_GETTIME,		MSG_SYS_TIMER_GETOVERRUN,
296c6c9aed4Sab 		MSG_SYS_NANOSLEEP,		MSG_SYS_FACL,
297c6c9aed4Sab 		MSG_SYS_DOOR,			MSG_SYS_SETREUID,
298c6c9aed4Sab 		MSG_SYS_SETREGID,		MSG_SYS_INSTALL_UTRAP,
299c6c9aed4Sab 		MSG_SYS_SIGNOTIFY,		MSG_SYS_SCHEDCTL,
300c6c9aed4Sab 		MSG_SYS_PSET,			MSG_SYS_SPARC_UTRAP_INSTALL,
301c6c9aed4Sab 		MSG_SYS_RESOLVEPATH,		MSG_SYS_LWP_MUTEX_TIMEDLOCK,
302c6c9aed4Sab 		MSG_SYS_LWP_SEMA_TIMEDWAIT,	MSG_SYS_LWP_RWLOCK_SYS,
303c6c9aed4Sab 		MSG_SYS_GETDENTS64,		MSG_SYS_MMAP64,
304c6c9aed4Sab 		MSG_SYS_STAT64,			MSG_SYS_LSTAT64,
305c6c9aed4Sab 		MSG_SYS_FSTAT64,		MSG_SYS_STATVFS64,
306c6c9aed4Sab 		MSG_SYS_FSTATVFS64,		MSG_SYS_SETRLIMIT64,
307c6c9aed4Sab 		MSG_SYS_GETRLIMIT64,		MSG_SYS_PREAD64,
3088fd04b83SRoger A. Faulkner 		MSG_SYS_PWRITE64,		MSG_SYS_224,
309c6c9aed4Sab 		MSG_SYS_OPEN64,			MSG_SYS_RPCSYS,
310c6c9aed4Sab 		MSG_SYS_ZONE,			MSG_SYS_AUTOFSSYS,
311c6c9aed4Sab 		MSG_SYS_GETCWD,			MSG_SYS_SO_SOCKET,
312c6c9aed4Sab 		MSG_SYS_SO_SOCKETPAIR,		MSG_SYS_BIND,
313c6c9aed4Sab 		MSG_SYS_LISTEN,			MSG_SYS_ACCEPT,
314c6c9aed4Sab 		MSG_SYS_CONNECT,		MSG_SYS_SHUTDOWN,
315c6c9aed4Sab 		MSG_SYS_RECV,			MSG_SYS_RECVFROM,
316c6c9aed4Sab 		MSG_SYS_RECVMSG,		MSG_SYS_SEND,
317c6c9aed4Sab 		MSG_SYS_SENDMSG,		MSG_SYS_SENDTO,
318c6c9aed4Sab 		MSG_SYS_GETPEERNAME,		MSG_SYS_GETSOCKNAME,
319c6c9aed4Sab 		MSG_SYS_GETSOCKOPT,		MSG_SYS_SETSOCKOPT,
320c6c9aed4Sab 		MSG_SYS_SOCKCONFIG,		MSG_SYS_NTP_GETTIME,
321c6c9aed4Sab 		MSG_SYS_NTP_ADJTIME,		MSG_SYS_LWP_MUTEX_UNLOCK,
322c6c9aed4Sab 		MSG_SYS_LWP_MUTEX_TRYLOCK,	MSG_SYS_LWP_MUTEX_REGISTER,
323c6c9aed4Sab 		MSG_SYS_CLADM,			MSG_SYS_UUCOPY,
324c6c9aed4Sab 		MSG_SYS_UMOUNT2
325c6c9aed4Sab 	};
3264f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_sysnumarr = {
3274f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, sysnumarr) };
3284f680cc6SAli Bahrami 
3294f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_sysnumarr), NULL };
330c6c9aed4Sab 
331c6c9aed4Sab 	int	use_num = 0;
332c6c9aed4Sab 
333c6c9aed4Sab 	/*
334c6c9aed4Sab 	 * Range check, and handle the unused values in the middle
335c6c9aed4Sab 	 * of the range. Although the missing values have strings,
336c6c9aed4Sab 	 * we still prefer to format them, because those strings are
337c6c9aed4Sab 	 * decimal, and the default behavior, unless the CONV_FMT_DECIMAL
338c6c9aed4Sab 	 * flag is set, is to display such things in hex.
339c6c9aed4Sab 	 */
340c6c9aed4Sab 	switch (sysnum) {
341c6c9aed4Sab 	case 0:
3428fd04b83SRoger A. Faulkner 	case 2:
3438fd04b83SRoger A. Faulkner 	case 7:
3448fd04b83SRoger A. Faulkner 	case 8:
3458fd04b83SRoger A. Faulkner 	case 11:
3468fd04b83SRoger A. Faulkner 	case 22:
3478fd04b83SRoger A. Faulkner 	case 30:
3488fd04b83SRoger A. Faulkner 	case 41:
3498fd04b83SRoger A. Faulkner 	case 48:
3508fd04b83SRoger A. Faulkner 	case 76:
3518fd04b83SRoger A. Faulkner 	case 87:
3528fd04b83SRoger A. Faulkner 	case 101:
3538fd04b83SRoger A. Faulkner 	case 102:
3548fd04b83SRoger A. Faulkner 	case 123:
3558fd04b83SRoger A. Faulkner 	case 124:
3568fd04b83SRoger A. Faulkner 	case 125:
3578fd04b83SRoger A. Faulkner 	case 126:
3588fd04b83SRoger A. Faulkner 	case 143:
3598fd04b83SRoger A. Faulkner 	case 147:
3608fd04b83SRoger A. Faulkner 	case 154:
3618fd04b83SRoger A. Faulkner 	case 169:
3628fd04b83SRoger A. Faulkner 	case 224:
363c6c9aed4Sab 		use_num = 1;
364c6c9aed4Sab 		break;
365c6c9aed4Sab 	default:
366c6c9aed4Sab 		use_num = (sysnum > SYS_umount2);
367c6c9aed4Sab 		break;
368c6c9aed4Sab 	}
369c6c9aed4Sab 	if (use_num)
370c6c9aed4Sab 		return (conv_invalid_val(inv_buf, sysnum, fmt_flags));
371c6c9aed4Sab 
3724f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sysnum, ds, fmt_flags,
3734f680cc6SAli Bahrami 	    inv_buf));
374c6c9aed4Sab }
375c6c9aed4Sab 
376c6c9aed4Sab 
377c6c9aed4Sab const char *
conv_cnote_errno(int errno_val,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)378c6c9aed4Sab conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
379c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
380c6c9aed4Sab {
381c6c9aed4Sab 	static const Msg	errarr_1_74[74] = {
382c6c9aed4Sab 		MSG_ERRNO_EPERM,		MSG_ERRNO_ENOENT,
383c6c9aed4Sab 		MSG_ERRNO_ESRCH,		MSG_ERRNO_EINTR,
384c6c9aed4Sab 		MSG_ERRNO_EIO,			MSG_ERRNO_ENXIO,
385c6c9aed4Sab 		MSG_ERRNO_E2BIG,		MSG_ERRNO_ENOEXEC,
386c6c9aed4Sab 		MSG_ERRNO_EBADF,		MSG_ERRNO_ECHILD,
387c6c9aed4Sab 		MSG_ERRNO_EAGAIN,		MSG_ERRNO_ENOMEM,
388c6c9aed4Sab 		MSG_ERRNO_EACCES,		MSG_ERRNO_EFAULT,
389c6c9aed4Sab 		MSG_ERRNO_ENOTBLK,		MSG_ERRNO_EBUSY,
390c6c9aed4Sab 		MSG_ERRNO_EEXIST,		MSG_ERRNO_EXDEV,
391c6c9aed4Sab 		MSG_ERRNO_ENODEV,		MSG_ERRNO_ENOTDIR,
392c6c9aed4Sab 		MSG_ERRNO_EISDIR,		MSG_ERRNO_EINVAL,
393c6c9aed4Sab 		MSG_ERRNO_ENFILE,		MSG_ERRNO_EMFILE,
394c6c9aed4Sab 		MSG_ERRNO_ENOTTY,		MSG_ERRNO_ETXTBSY,
395c6c9aed4Sab 		MSG_ERRNO_EFBIG,		MSG_ERRNO_ENOSPC,
396c6c9aed4Sab 		MSG_ERRNO_ESPIPE,		MSG_ERRNO_EROFS,
397c6c9aed4Sab 		MSG_ERRNO_EMLINK,		MSG_ERRNO_EPIPE,
398c6c9aed4Sab 		MSG_ERRNO_EDOM,			MSG_ERRNO_ERANGE,
399c6c9aed4Sab 		MSG_ERRNO_ENOMSG,		MSG_ERRNO_EIDRM,
400c6c9aed4Sab 		MSG_ERRNO_ECHRNG,		MSG_ERRNO_EL2NSYNC,
401c6c9aed4Sab 		MSG_ERRNO_EL3HLT,		MSG_ERRNO_EL3RST,
402c6c9aed4Sab 		MSG_ERRNO_ELNRNG,		MSG_ERRNO_EUNATCH,
403c6c9aed4Sab 		MSG_ERRNO_ENOCSI,		MSG_ERRNO_EL2HLT,
404c6c9aed4Sab 		MSG_ERRNO_EDEADLK,		MSG_ERRNO_ENOLCK,
405c6c9aed4Sab 		MSG_ERRNO_ECANCELED,		MSG_ERRNO_ENOTSUP,
406c6c9aed4Sab 		MSG_ERRNO_EDQUOT,		MSG_ERRNO_EBADE,
407c6c9aed4Sab 		MSG_ERRNO_EBADR,		MSG_ERRNO_EXFULL,
408c6c9aed4Sab 		MSG_ERRNO_ENOANO,		MSG_ERRNO_EBADRQC,
409c6c9aed4Sab 		MSG_ERRNO_EBADSLT,		MSG_ERRNO_EDEADLOCK,
410c6c9aed4Sab 		MSG_ERRNO_EBFONT,		MSG_ERRNO_EOWNERDEAD,
411c6c9aed4Sab 		MSG_ERRNO_ENOTRECOVERABLE,	MSG_ERRNO_ENOSTR,
412c6c9aed4Sab 		MSG_ERRNO_ENODATA,		MSG_ERRNO_ETIME,
413c6c9aed4Sab 		MSG_ERRNO_ENOSR,		MSG_ERRNO_ENONET,
414c6c9aed4Sab 		MSG_ERRNO_ENOPKG,		MSG_ERRNO_EREMOTE,
415c6c9aed4Sab 		MSG_ERRNO_ENOLINK,		MSG_ERRNO_EADV,
416c6c9aed4Sab 		MSG_ERRNO_ESRMNT,		MSG_ERRNO_ECOMM,
417c6c9aed4Sab 		MSG_ERRNO_EPROTO,		MSG_ERRNO_ELOCKUNMAPPED,
418c6c9aed4Sab 		MSG_ERRNO_ENOTACTIVE,		MSG_ERRNO_EMULTIHOP
419c6c9aed4Sab 	};
4204f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_errarr_1_74 = {
4214f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, errarr_1_74) };
4224f680cc6SAli Bahrami 
423c6c9aed4Sab 	static const Msg	errarr_77_99[23] = {
424c6c9aed4Sab 		MSG_ERRNO_EBADMSG,		MSG_ERRNO_ENAMETOOLONG,
425c6c9aed4Sab 		MSG_ERRNO_EOVERFLOW,		MSG_ERRNO_ENOTUNIQ,
426c6c9aed4Sab 		MSG_ERRNO_EBADFD,		MSG_ERRNO_EREMCHG,
427c6c9aed4Sab 		MSG_ERRNO_ELIBACC,		MSG_ERRNO_ELIBBAD,
428c6c9aed4Sab 		MSG_ERRNO_ELIBSCN,		MSG_ERRNO_ELIBMAX,
429c6c9aed4Sab 		MSG_ERRNO_ELIBEXEC,		MSG_ERRNO_EILSEQ,
430c6c9aed4Sab 		MSG_ERRNO_ENOSYS,		MSG_ERRNO_ELOOP,
431c6c9aed4Sab 		MSG_ERRNO_ERESTART,		MSG_ERRNO_ESTRPIPE,
432c6c9aed4Sab 		MSG_ERRNO_ENOTEMPTY,		MSG_ERRNO_EUSERS,
433c6c9aed4Sab 		MSG_ERRNO_ENOTSOCK,		MSG_ERRNO_EDESTADDRREQ,
434c6c9aed4Sab 		MSG_ERRNO_EMSGSIZE,		MSG_ERRNO_EPROTOTYPE,
435c6c9aed4Sab 		MSG_ERRNO_ENOPROTOOPT
436c6c9aed4Sab 	};
4374f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_errarr_77_99 = {
4384f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(77, errarr_77_99) };
4394f680cc6SAli Bahrami 
440c6c9aed4Sab 	static const Msg	errarr_120_134[15] = {
441c6c9aed4Sab 		MSG_ERRNO_EPROTONOSUPPORT,	MSG_ERRNO_ESOCKTNOSUPPORT,
442c6c9aed4Sab 		MSG_ERRNO_EOPNOTSUPP,		MSG_ERRNO_EPFNOSUPPORT,
443c6c9aed4Sab 		MSG_ERRNO_EAFNOSUPPORT,		MSG_ERRNO_EADDRINUSE,
444c6c9aed4Sab 		MSG_ERRNO_EADDRNOTAVAIL,	MSG_ERRNO_ENETDOWN,
445c6c9aed4Sab 		MSG_ERRNO_ENETUNREACH,		MSG_ERRNO_ENETRESET,
446c6c9aed4Sab 		MSG_ERRNO_ECONNABORTED,		MSG_ERRNO_ECONNRESET,
447c6c9aed4Sab 		MSG_ERRNO_ENOBUFS,		MSG_ERRNO_EISCONN,
448c6c9aed4Sab 		MSG_ERRNO_ENOTCONN
449c6c9aed4Sab 	};
4504f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_errarr_120_134 = {
4514f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(120, errarr_120_134) };
4524f680cc6SAli Bahrami 
453c6c9aed4Sab 	static const Msg	errarr_143_151[9] = {
454c6c9aed4Sab 		MSG_ERRNO_ESHUTDOWN,		MSG_ERRNO_ETOOMANYREFS,
455c6c9aed4Sab 		MSG_ERRNO_ETIMEDOUT,		MSG_ERRNO_ECONNREFUSED,
456c6c9aed4Sab 		MSG_ERRNO_EHOSTDOWN,		MSG_ERRNO_EHOSTUNREACH,
457c6c9aed4Sab 		MSG_ERRNO_EALREADY,		MSG_ERRNO_EINPROGRESS,
458c6c9aed4Sab 		MSG_ERRNO_ESTALE
459c6c9aed4Sab 	};
4604f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_errarr_143_151 = {
4614f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(143, errarr_143_151) };
462c6c9aed4Sab 
4634f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_errarr_1_74),
4644f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_errarr_77_99), CONV_DS_ADDR(ds_errarr_120_134),
4654f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_errarr_143_151), NULL };
466c6c9aed4Sab 
467c6c9aed4Sab 
4684f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, errno_val, ds, fmt_flags,
4694f680cc6SAli Bahrami 	    inv_buf));
470c6c9aed4Sab }
471c6c9aed4Sab 
472c6c9aed4Sab 
473c6c9aed4Sab const char *
conv_cnote_pr_dmodel(Word dmodel,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)474c6c9aed4Sab conv_cnote_pr_dmodel(Word dmodel, Conv_fmt_flags_t fmt_flags,
475c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
476c6c9aed4Sab {
477c6c9aed4Sab 	static const Msg	models[] = {
478c6c9aed4Sab 		MSG_PR_MODEL_UNKNOWN,
479c6c9aed4Sab 		MSG_PR_MODEL_ILP32,
480c6c9aed4Sab 		MSG_PR_MODEL_LP64
481c6c9aed4Sab 	};
4824f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_models = {
4834f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(PR_MODEL_UNKNOWN, models) };
4844f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_models), NULL };
485c6c9aed4Sab 
4864f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, dmodel, ds, fmt_flags,
4874f680cc6SAli Bahrami 	    inv_buf));
488c6c9aed4Sab }
489c6c9aed4Sab 
490c6c9aed4Sab 
491c6c9aed4Sab const char *
conv_cnote_pr_why(short why,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)492c6c9aed4Sab conv_cnote_pr_why(short why, Conv_fmt_flags_t fmt_flags,
493c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
494c6c9aed4Sab {
495c6c9aed4Sab 	static const Msg	why_arr[] = {
496c6c9aed4Sab 		MSG_PR_WHY_REQUESTED,
497c6c9aed4Sab 		MSG_PR_WHY_SIGNALLED,
498c6c9aed4Sab 		MSG_PR_WHY_SYSENTRY,
499c6c9aed4Sab 		MSG_PR_WHY_SYSEXIT,
500c6c9aed4Sab 		MSG_PR_WHY_JOBCONTROL,
501c6c9aed4Sab 		MSG_PR_WHY_FAULTED,
502c6c9aed4Sab 		MSG_PR_WHY_SUSPENDED,
503c6c9aed4Sab 		MSG_PR_WHY_CHECKPOINT
504c6c9aed4Sab 	};
5054f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_why_arr = {
5064f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, why_arr) };
5074f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_why_arr), NULL };
508c6c9aed4Sab 
5094f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, why, ds, fmt_flags,
5104f680cc6SAli Bahrami 	    inv_buf));
511c6c9aed4Sab }
512c6c9aed4Sab 
513c6c9aed4Sab 
514c6c9aed4Sab const char *
conv_cnote_pr_what(short why,short what,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)515c6c9aed4Sab conv_cnote_pr_what(short why, short what, Conv_fmt_flags_t fmt_flags,
516c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
517c6c9aed4Sab {
518c6c9aed4Sab 	/*
519c6c9aed4Sab 	 * The meaning of pr_what depends on the corresponding
520bbf21555SRichard Lowe 	 * value of pr_why, as discussed in the proc(5) manpage.
521c6c9aed4Sab 	 */
522c6c9aed4Sab 	switch (why) {
523c6c9aed4Sab 	case PR_SIGNALLED:
524c6c9aed4Sab 	case PR_JOBCONTROL:
525c6c9aed4Sab 		return (conv_cnote_signal(what, fmt_flags, inv_buf));
526c6c9aed4Sab 	case PR_SYSENTRY:
527c6c9aed4Sab 	case PR_SYSEXIT:
528c6c9aed4Sab 		return (conv_cnote_syscall(what, fmt_flags, inv_buf));
529c6c9aed4Sab 	case PR_FAULTED:
530c6c9aed4Sab 		return (conv_cnote_fault(what, fmt_flags, inv_buf));
531c6c9aed4Sab 	};
532c6c9aed4Sab 
533c6c9aed4Sab 	return (conv_invalid_val(inv_buf, what, fmt_flags));
534c6c9aed4Sab }
535c6c9aed4Sab 
536c6c9aed4Sab 
537c6c9aed4Sab /*
538c6c9aed4Sab  * Return the name of the general purpose register indexed by
539c6c9aed4Sab  * regno in the pr_reg array of lwpstatus_t (<sys/procfs.h>).
540c6c9aed4Sab  */
541c6c9aed4Sab const char *
conv_cnote_pr_regname(Half mach,int regno,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)542c6c9aed4Sab conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
543c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
544c6c9aed4Sab {
545c6c9aed4Sab 	static const Msg	sparc_gen_reg[32] = {
546c6c9aed4Sab 		MSG_REG_SPARC_G0,		MSG_REG_SPARC_G1,
547c6c9aed4Sab 		MSG_REG_SPARC_G2,		MSG_REG_SPARC_G3,
548c6c9aed4Sab 		MSG_REG_SPARC_G4,		MSG_REG_SPARC_G5,
549c6c9aed4Sab 		MSG_REG_SPARC_G6,		MSG_REG_SPARC_G7,
550c6c9aed4Sab 		MSG_REG_SPARC_O0,		MSG_REG_SPARC_O1,
551c6c9aed4Sab 		MSG_REG_SPARC_O2,		MSG_REG_SPARC_O3,
552c6c9aed4Sab 		MSG_REG_SPARC_O4,		MSG_REG_SPARC_O5,
553c6c9aed4Sab 		MSG_REG_SPARC_O6,		MSG_REG_SPARC_O7,
554c6c9aed4Sab 		MSG_REG_SPARC_L0,		MSG_REG_SPARC_L1,
555c6c9aed4Sab 		MSG_REG_SPARC_L2,		MSG_REG_SPARC_L3,
556c6c9aed4Sab 		MSG_REG_SPARC_L4,		MSG_REG_SPARC_L5,
557c6c9aed4Sab 		MSG_REG_SPARC_L6,		MSG_REG_SPARC_L7,
558c6c9aed4Sab 		MSG_REG_SPARC_I0,		MSG_REG_SPARC_I1,
559c6c9aed4Sab 		MSG_REG_SPARC_I2,		MSG_REG_SPARC_I3,
560c6c9aed4Sab 		MSG_REG_SPARC_I4,		MSG_REG_SPARC_I5,
561c6c9aed4Sab 		MSG_REG_SPARC_I6,		MSG_REG_SPARC_I7
562c6c9aed4Sab 	};
5634f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_sparc_gen_reg = {
5644f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(0, sparc_gen_reg) };
5654f680cc6SAli Bahrami 
566c6c9aed4Sab 	static const Msg	sparc_32_37_reg[6] = {
567c6c9aed4Sab 		MSG_REG_SPARC_PSR,		MSG_REG_SPARC_PC,
568c6c9aed4Sab 		MSG_REG_SPARC_nPC,		MSG_REG_SPARC_Y,
569c6c9aed4Sab 		MSG_REG_SPARC_WIM,		MSG_REG_SPARC_TBR
570c6c9aed4Sab 	};
5714f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_sparc_32_37_reg = {
5724f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(32, sparc_32_37_reg) };
5734f680cc6SAli Bahrami 
574c6c9aed4Sab 	static const Msg	sparcv9_32_37_reg[6] = {
575c6c9aed4Sab 		MSG_REG_SPARC_CCR,		MSG_REG_SPARC_PC,
576c6c9aed4Sab 		MSG_REG_SPARC_nPC,		MSG_REG_SPARC_Y,
577c6c9aed4Sab 		MSG_REG_SPARC_ASI,		MSG_REG_SPARC_FPRS
578c6c9aed4Sab 	};
5794f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_sparcv9_32_37_reg = {
5804f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(32, sparcv9_32_37_reg) };
5814f680cc6SAli Bahrami 
582c6c9aed4Sab 	static const Msg	amd64_reg[28] = {
583c6c9aed4Sab 		MSG_REG_AMD64_R15,		MSG_REG_AMD64_R14,
584c6c9aed4Sab 		MSG_REG_AMD64_R13,		MSG_REG_AMD64_R12,
585c6c9aed4Sab 		MSG_REG_AMD64_R11,		MSG_REG_AMD64_R10,
586c6c9aed4Sab 		MSG_REG_AMD64_R9,		MSG_REG_AMD64_R8,
587c6c9aed4Sab 		MSG_REG_AMD64_RDI,		MSG_REG_AMD64_RSI,
588c6c9aed4Sab 		MSG_REG_AMD64_RBP,		MSG_REG_AMD64_RBX,
589c6c9aed4Sab 		MSG_REG_AMD64_RDX,		MSG_REG_AMD64_RCX,
590c6c9aed4Sab 		MSG_REG_AMD64_RAX,		MSG_REG_AMD64_TRAPNO,
591c6c9aed4Sab 		MSG_REG_AMD64_ERR,		MSG_REG_AMD64_RIP,
592c6c9aed4Sab 		MSG_REG_AMD64_CS,		MSG_REG_AMD64_RFL,
593c6c9aed4Sab 		MSG_REG_AMD64_RSP,		MSG_REG_AMD64_SS,
594c6c9aed4Sab 		MSG_REG_AMD64_FS,		MSG_REG_AMD64_GS,
595c6c9aed4Sab 		MSG_REG_AMD64_ES,		MSG_REG_AMD64_DS,
596c6c9aed4Sab 		MSG_REG_AMD64_FSBASE,		MSG_REG_AMD64_GSBASE
597c6c9aed4Sab 	};
5984f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_amd64_reg = {
5994f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(0, amd64_reg) };
6004f680cc6SAli Bahrami 
601c6c9aed4Sab 	static const Msg	i86_reg[19] = {
6024f680cc6SAli Bahrami 		MSG_REG_I86_GS,			MSG_REG_I86_FS,
6034f680cc6SAli Bahrami 		MSG_REG_I86_ES,			MSG_REG_I86_DS,
604c6c9aed4Sab 		MSG_REG_I86_EDI,		MSG_REG_I86_ESI,
605c6c9aed4Sab 		MSG_REG_I86_EBP,		MSG_REG_I86_ESP,
606c6c9aed4Sab 		MSG_REG_I86_EBX,		MSG_REG_I86_EDX,
607c6c9aed4Sab 		MSG_REG_I86_ECX,		MSG_REG_I86_EAX,
608c6c9aed4Sab 		MSG_REG_I86_TRAPNO,		MSG_REG_I86_ERR,
609c6c9aed4Sab 		MSG_REG_I86_EIP,		MSG_REG_I86_CS,
610c6c9aed4Sab 		MSG_REG_I86_EFL,		MSG_REG_I86_UESP,
611c6c9aed4Sab 		MSG_REG_I86_SS
612c6c9aed4Sab 	};
6134f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_i86_reg = {
6144f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(0, i86_reg) };
6154f680cc6SAli Bahrami 
6164f680cc6SAli Bahrami 
6174f680cc6SAli Bahrami 	static const conv_ds_t	*ds_sparc[] = {
6184f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_sparc_gen_reg),
6194f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_sparc_32_37_reg),
6204f680cc6SAli Bahrami 		NULL
6214f680cc6SAli Bahrami 	};
6224f680cc6SAli Bahrami 	static const conv_ds_t	*ds_sparcv9[] = {
6234f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_sparc_gen_reg),
6244f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_sparcv9_32_37_reg),
6254f680cc6SAli Bahrami 		NULL
6264f680cc6SAli Bahrami 	};
6274f680cc6SAli Bahrami 	static const conv_ds_t	*ds_amd64[] = {
6284f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_amd64_reg), NULL };
6294f680cc6SAli Bahrami 	static const conv_ds_t	*ds_i86[] = {
6304f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_i86_reg), NULL };
6314f680cc6SAli Bahrami 
6324f680cc6SAli Bahrami 	const conv_ds_t **ds;
633c6c9aed4Sab 
634c6c9aed4Sab 	switch (mach) {
635c6c9aed4Sab 	case EM_386:
6364f680cc6SAli Bahrami 		ds = ds_i86;
637c6c9aed4Sab 		break;
638c6c9aed4Sab 
639c6c9aed4Sab 	case EM_AMD64:
6404f680cc6SAli Bahrami 		ds = ds_amd64;
641c6c9aed4Sab 		break;
642c6c9aed4Sab 
643c6c9aed4Sab 	case EM_SPARC:
644c6c9aed4Sab 	case EM_SPARC32PLUS:
6454f680cc6SAli Bahrami 		ds = ds_sparc;
646c6c9aed4Sab 		break;
6474f680cc6SAli Bahrami 
648c6c9aed4Sab 	case EM_SPARCV9:
6494f680cc6SAli Bahrami 		ds = ds_sparcv9;
650c6c9aed4Sab 		break;
6514f680cc6SAli Bahrami 
6524f680cc6SAli Bahrami 	default:
6534f680cc6SAli Bahrami 		return (conv_invalid_val(inv_buf, regno, fmt_flags));
654c6c9aed4Sab 	}
655c6c9aed4Sab 
6564f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, mach, regno, ds, fmt_flags,
6574f680cc6SAli Bahrami 	    inv_buf));
658c6c9aed4Sab }
659c6c9aed4Sab 
660c6c9aed4Sab const char *
conv_cnote_pr_stype(Word stype,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)661c6c9aed4Sab conv_cnote_pr_stype(Word stype, Conv_fmt_flags_t fmt_flags,
662c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
663c6c9aed4Sab {
664c6c9aed4Sab 	static const Msg	types[] = {
665c6c9aed4Sab 		MSG_SOBJ_NONE,		MSG_SOBJ_MUTEX,
666c6c9aed4Sab 		MSG_SOBJ_RWLOCK,	MSG_SOBJ_CV,
667c6c9aed4Sab 		MSG_SOBJ_SEMA,		MSG_SOBJ_USER,
668c6c9aed4Sab 		MSG_SOBJ_USER_PI,	MSG_SOBJ_SHUTTLE
669c6c9aed4Sab 	};
6704f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_types = { CONV_DS_MSG_INIT(0, types) };
6714f680cc6SAli Bahrami 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_types), NULL };
672c6c9aed4Sab 
673c6c9aed4Sab 
6744f680cc6SAli Bahrami 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, stype, ds, fmt_flags,
6754f680cc6SAli Bahrami 	    inv_buf));
676c6c9aed4Sab }
677c6c9aed4Sab 
678c6c9aed4Sab 
679c6c9aed4Sab const char *
conv_cnote_priv(int priv,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)680c6c9aed4Sab conv_cnote_priv(int priv, Conv_fmt_flags_t fmt_flags,
681c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
682c6c9aed4Sab {
683c6c9aed4Sab 	const char *fmt;
684c6c9aed4Sab 
685c6c9aed4Sab 	/*
686c6c9aed4Sab 	 * The PRIV_ constants defined in <sys/priv.h> are unusual
687c6c9aed4Sab 	 * in that they are negative values. The libconv code is all
688c6c9aed4Sab 	 * built around the Word type, which is unsigned. Rather than
689c6c9aed4Sab 	 * modify libconv for this one case, we simply handle
690c6c9aed4Sab 	 * these constants differently that the usual approach,
6914f680cc6SAli Bahrami 	 * and stay away from conv_invalid_val() and conv_map_ds().
692c6c9aed4Sab 	 */
693c6c9aed4Sab 	switch (priv) {
694c6c9aed4Sab 	case PRIV_ALL:
695c6c9aed4Sab 		return (MSG_ORIG(MSG_PRIV_ALL));
696c6c9aed4Sab 	case PRIV_MULTIPLE:
697c6c9aed4Sab 		return (MSG_ORIG(MSG_PRIV_MULTIPLE));
698c6c9aed4Sab 	case PRIV_NONE:
699c6c9aed4Sab 		return (MSG_ORIG(MSG_PRIV_NONE));
700c6c9aed4Sab 	case PRIV_ALLZONE:
701c6c9aed4Sab 		return (MSG_ORIG(MSG_PRIV_ALLZONE));
702c6c9aed4Sab 	case PRIV_GLOBAL:
703c6c9aed4Sab 		return (MSG_ORIG(MSG_PRIV_GLOBAL));
704c6c9aed4Sab 	}
705c6c9aed4Sab 
706c6c9aed4Sab 	fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
707c6c9aed4Sab 	    MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
708c6c9aed4Sab 	(void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, priv);
709c6c9aed4Sab 	return (inv_buf->buf);
710c6c9aed4Sab }
711c6c9aed4Sab 
712c6c9aed4Sab 
713c6c9aed4Sab const char *
conv_cnote_psetid(int id,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)714c6c9aed4Sab conv_cnote_psetid(int id, Conv_fmt_flags_t fmt_flags,
715c6c9aed4Sab     Conv_inv_buf_t *inv_buf)
716c6c9aed4Sab {
717c6c9aed4Sab 	const char *fmt;
718c6c9aed4Sab 
719c6c9aed4Sab 	/*
720c6c9aed4Sab 	 * The PS_ constants defined in <sys/pset.h> are unusual
721c6c9aed4Sab 	 * in that they are negative values. The libconv code is all
722c6c9aed4Sab 	 * built around the Word type, which is unsigned. Rather than
723c6c9aed4Sab 	 * modify libconv for this one case, we simply handle
724c6c9aed4Sab 	 * these constants differently that the usual approach,
7254f680cc6SAli Bahrami 	 * and stay away from conv_invalid_val() and conv_map_ds().
726c6c9aed4Sab 	 */
727c6c9aed4Sab 	switch (id) {
728c6c9aed4Sab 	case PS_NONE:
729c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_NONE));
730c6c9aed4Sab 	case PS_QUERY:
731c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_QUERY));
732c6c9aed4Sab 	case PS_MYID:
733c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_MYID));
734c6c9aed4Sab 	case PS_SOFT:
735c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_SOFT));
736c6c9aed4Sab 	case PS_HARD:
737c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_HARD));
738c6c9aed4Sab 	case PS_QUERY_TYPE:
739c6c9aed4Sab 		return (MSG_ORIG(MSG_PS_QUERY_TYPE));
740c6c9aed4Sab 	}
741c6c9aed4Sab 
742c6c9aed4Sab 	fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
743c6c9aed4Sab 	    MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
744c6c9aed4Sab 	(void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, id);
745c6c9aed4Sab 	return (inv_buf->buf);
746c6c9aed4Sab }
747c6c9aed4Sab 
748c6c9aed4Sab 
749c6c9aed4Sab /*
750c6c9aed4Sab  * Return a string describing the si_code field of
751c6c9aed4Sab  * the siginfo_t struct.
752c6c9aed4Sab  *
753c6c9aed4Sab  * The meaning of si_code is dependent on both the target
754c6c9aed4Sab  * machine (mach) as well as the signal (sig).
755c6c9aed4Sab  */
756c6c9aed4Sab const char *
conv_cnote_si_code(Half mach,int sig,int si_code,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)757c6c9aed4Sab conv_cnote_si_code(Half mach, int sig, int si_code,
758c6c9aed4Sab     Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
759c6c9aed4Sab {
760c6c9aed4Sab 
761c6c9aed4Sab 	/* Values of si_code for user generated signals */
762c6c9aed4Sab 	static const Msg	user_arr[6] = {
763c6c9aed4Sab 		MSG_SI_USER,		MSG_SI_LWP,
764c6c9aed4Sab 		MSG_SI_QUEUE,		MSG_SI_TIMER,
765c6c9aed4Sab 		MSG_SI_ASYNCIO,		MSG_SI_MESGQ
766c6c9aed4Sab 	};
7674f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_user_arr = {
7684f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(0, user_arr) };
7694f680cc6SAli Bahrami 	static const conv_ds_t	*ds_user_arr[] = {
7704f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_user_arr), NULL };
7714f680cc6SAli Bahrami 
772c6c9aed4Sab 
773c6c9aed4Sab 	/*
774c6c9aed4Sab 	 * Architecture dependent system generated signals. All
775c6c9aed4Sab 	 * versions of Solaris use the same set of these values.
776c6c9aed4Sab 	 */
777c6c9aed4Sab 	static const Msg	trap_arr[6] = {
778c6c9aed4Sab 		MSG_SI_TRAP_BRKPT,	MSG_SI_TRAP_TRACE,
779c6c9aed4Sab 		MSG_SI_TRAP_RWATCH,	MSG_SI_TRAP_WWATCH,
780c6c9aed4Sab 		MSG_SI_TRAP_XWATCH,	MSG_SI_TRAP_DTRACE
781c6c9aed4Sab 	};
7824f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_trap_arr = {
7834f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, trap_arr) };
7844f680cc6SAli Bahrami 	static const conv_ds_t	*ds_trap_arr[] = {
7854f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_trap_arr), NULL };
7864f680cc6SAli Bahrami 
787c6c9aed4Sab 	static const Msg	cld_arr[6] = {
788c6c9aed4Sab 		MSG_SI_CLD_EXITED,	MSG_SI_CLD_KILLED,
789c6c9aed4Sab 		MSG_SI_CLD_DUMPED,	MSG_SI_CLD_TRAPPED,
790c6c9aed4Sab 		MSG_SI_CLD_STOPPED,	MSG_SI_CLD_CONTINUED
791c6c9aed4Sab 	};
7924f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_cld_arr = {
7934f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, cld_arr) };
7944f680cc6SAli Bahrami 	static const conv_ds_t	*ds_cld_arr[] = {
7954f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_cld_arr), NULL };
7964f680cc6SAli Bahrami 
797c6c9aed4Sab 	static const Msg	poll_arr[6] = {
798c6c9aed4Sab 		MSG_SI_POLL_IN,		MSG_SI_POLL_OUT,
799c6c9aed4Sab 		MSG_SI_POLL_MSG,	MSG_SI_POLL_ERR,
800c6c9aed4Sab 		MSG_SI_POLL_PRI,	MSG_SI_POLL_HUP
801c6c9aed4Sab 	};
8024f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_poll_arr = {
8034f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, poll_arr) };
8044f680cc6SAli Bahrami 	static const conv_ds_t	*ds_poll_arr[] = {
8054f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_poll_arr), NULL };
806c6c9aed4Sab 
807c6c9aed4Sab 	/*
808c6c9aed4Sab 	 * Architecture dependent system generated signals.
809c6c9aed4Sab 	 * These items (ILL, EMT, FPE, SEGV, BUS) are platform
810c6c9aed4Sab 	 * dependent. Some architectures have extra codes.
811c6c9aed4Sab 	 * The same name may have a different integer value.
812c6c9aed4Sab 	 * Multiple arrays are used when they differ, and one
813c6c9aed4Sab 	 * array when all the architectures agree.
814c6c9aed4Sab 	 */
815c6c9aed4Sab 
816c6c9aed4Sab 	/* ILL */
817c6c9aed4Sab 	static const Msg	ill_arr[8] = {
818c6c9aed4Sab 		MSG_SI_ILL_ILLOPC,	MSG_SI_ILL_ILLOPN,
819c6c9aed4Sab 		MSG_SI_ILL_ILLADR,	MSG_SI_ILL_ILLTRP,
820c6c9aed4Sab 		MSG_SI_ILL_PRVOPC,	MSG_SI_ILL_PRVREG,
821c6c9aed4Sab 		MSG_SI_ILL_COPROC,	MSG_SI_ILL_BADSTK
822c6c9aed4Sab 	};
8234f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_ill_arr = {
8244f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, ill_arr) };
8254f680cc6SAli Bahrami 	static const conv_ds_t	*ds_ill_arr[] = {
8264f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_ill_arr), NULL };
827c6c9aed4Sab 
828c6c9aed4Sab 	/* EMT */
829c6c9aed4Sab 	static const Msg	emt_arr_sparc[2] = {
830c6c9aed4Sab 		MSG_SI_EMT_TAGOVF,	MSG_SI_EMT_CPCOVF
831c6c9aed4Sab 	};
8324f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_emt_arr_sparc = {
8334f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, emt_arr_sparc) };
8344f680cc6SAli Bahrami 	static const conv_ds_t	*ds_emt_arr_sparc[] = {
8354f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_emt_arr_sparc), NULL };
8364f680cc6SAli Bahrami 
837c6c9aed4Sab 	static const Msg	emt_arr_x86[1] = {
838c6c9aed4Sab 		MSG_SI_EMT_CPCOVF
839c6c9aed4Sab 	};
8404f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_emt_arr_x86 = {
8414f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, emt_arr_x86) };
8424f680cc6SAli Bahrami 	static const conv_ds_t	*ds_emt_arr_x86[] = {
8434f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_emt_arr_x86), NULL };
8444f680cc6SAli Bahrami 
845c6c9aed4Sab 
846c6c9aed4Sab 	/* FPE */
847c6c9aed4Sab 	static const Msg	fpe_arr_sparc[8] = {
848c6c9aed4Sab 		MSG_SI_FPE_INTDIV,	MSG_SI_FPE_INTOVF,
849c6c9aed4Sab 		MSG_SI_FPE_FLTDIV,	MSG_SI_FPE_FLTOVF,
850c6c9aed4Sab 		MSG_SI_FPE_FLTUND,	MSG_SI_FPE_FLTRES,
851c6c9aed4Sab 		MSG_SI_FPE_FLTINV,	MSG_SI_FPE_FLTSUB
852c6c9aed4Sab 	};
8534f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_fpe_arr_sparc = {
8544f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, fpe_arr_sparc) };
8554f680cc6SAli Bahrami 	static const conv_ds_t	*ds_fpe_arr_sparc[] = {
8564f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_fpe_arr_sparc), NULL };
8574f680cc6SAli Bahrami 
858c6c9aed4Sab 	static const Msg	fpe_arr_x86[9] = {
859c6c9aed4Sab 		MSG_SI_FPE_INTDIV,	MSG_SI_FPE_INTOVF,
860c6c9aed4Sab 		MSG_SI_FPE_FLTDIV,	MSG_SI_FPE_FLTOVF,
861c6c9aed4Sab 		MSG_SI_FPE_FLTUND,	MSG_SI_FPE_FLTRES,
862c6c9aed4Sab 		MSG_SI_FPE_FLTINV,	MSG_SI_FPE_FLTSUB,
863c6c9aed4Sab 		MSG_SI_FPE_FLTDEN
864c6c9aed4Sab 	};
8654f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_fpe_arr_x86 = {
8664f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, fpe_arr_x86) };
8674f680cc6SAli Bahrami 	static const conv_ds_t	*ds_fpe_arr_x86[] = {
8684f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_fpe_arr_x86), NULL };
869c6c9aed4Sab 
870c6c9aed4Sab 	/* SEGV */
871c6c9aed4Sab 	static const Msg	segv_arr[2] = {
872c6c9aed4Sab 		MSG_SI_SEGV_MAPERR,	MSG_SI_SEGV_ACCERR
873c6c9aed4Sab 	};
8744f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_segv_arr = {
8754f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, segv_arr) };
8764f680cc6SAli Bahrami 	static const conv_ds_t	*ds_segv_arr[] = {
8774f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_segv_arr), NULL };
878c6c9aed4Sab 
879c6c9aed4Sab 	/* BUS */
880c6c9aed4Sab 	static const Msg	bus_arr[3] = {
881c6c9aed4Sab 		MSG_SI_BUS_ADRALN,	MSG_SI_BUS_ADRERR,
882c6c9aed4Sab 		MSG_SI_BUS_OBJERR
883c6c9aed4Sab 	};
8844f680cc6SAli Bahrami 	static const conv_ds_msg_t ds_msg_bus_arr = {
8854f680cc6SAli Bahrami 	    CONV_DS_MSG_INIT(1, bus_arr) };
8864f680cc6SAli Bahrami 	static const conv_ds_t	*ds_bus_arr[] = {
8874f680cc6SAli Bahrami 		CONV_DS_ADDR(ds_msg_bus_arr), NULL };
888c6c9aed4Sab 
889c6c9aed4Sab 	enum { ARCH_NONE, ARCH_X86, ARCH_SPARC } arch;
890c6c9aed4Sab 
891c6c9aed4Sab 
892c6c9aed4Sab 	/* Handle the si_code values that do not depend on the signal */
893c6c9aed4Sab 	switch (si_code) {
894c6c9aed4Sab 	case SI_NOINFO:
895c6c9aed4Sab 		return (MSG_ORIG(MSG_SI_NOINFO));
896c6c9aed4Sab 	case SI_DTRACE:
897c6c9aed4Sab 		return (MSG_ORIG(MSG_SI_DTRACE));
898c6c9aed4Sab 	case SI_RCTL:
899c6c9aed4Sab 		return (MSG_ORIG(MSG_SI_RCTL));
900c6c9aed4Sab 	default:
901c6c9aed4Sab 		/* User generated signal codes are <= 0 */
902c6c9aed4Sab 		if (si_code <= 0) {
903c6c9aed4Sab 			int ndx = -si_code;
904c6c9aed4Sab 
905c6c9aed4Sab 			/*
906c6c9aed4Sab 			 * If no signal was delivered, and si_code is
907c6c9aed4Sab 			 * 0, return "0" rather than "SI_USER".
908c6c9aed4Sab 			 */
909c6c9aed4Sab 			if ((si_code == 0) && (sig == 0))
910c6c9aed4Sab 				return (MSG_ORIG(MSG_GBL_ZERO));
911c6c9aed4Sab 
9124f680cc6SAli Bahrami 			if (ndx >= ARRAY_NELTS(user_arr)) {
913c6c9aed4Sab 				const char *fmt;
914c6c9aed4Sab 
915c6c9aed4Sab 				fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
916c6c9aed4Sab 				    MSG_ORIG(MSG_FMT_INT) :
917c6c9aed4Sab 				    MSG_ORIG(MSG_FMT_HEXINT);
918c6c9aed4Sab 
919c6c9aed4Sab 				(void) snprintf(inv_buf->buf,
920c6c9aed4Sab 				    sizeof (inv_buf->buf), fmt, si_code);
921c6c9aed4Sab 				return (inv_buf->buf);
922c6c9aed4Sab 			}
9234f680cc6SAli Bahrami 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, ndx,
9244f680cc6SAli Bahrami 			    ds_user_arr, fmt_flags, inv_buf));
925c6c9aed4Sab 		}
926c6c9aed4Sab 	}
927c6c9aed4Sab 
928c6c9aed4Sab 	/*
929c6c9aed4Sab 	 * If we didn't return above, then this is a
930c6c9aed4Sab 	 * system generated signal, and the meaning of si_code
931c6c9aed4Sab 	 * depends on the signal that was delivered, and possibly
932c6c9aed4Sab 	 * on the target architecture.
933c6c9aed4Sab 	 */
934c6c9aed4Sab 	switch (mach) {
935c6c9aed4Sab 	case EM_386:
936c6c9aed4Sab 	case EM_AMD64:
937c6c9aed4Sab 		arch = ARCH_X86;
938c6c9aed4Sab 		break;
939c6c9aed4Sab 
940c6c9aed4Sab 	case EM_SPARC:
941c6c9aed4Sab 	case EM_SPARC32PLUS:
942c6c9aed4Sab 	case EM_SPARCV9:
943c6c9aed4Sab 		arch = ARCH_X86;
944c6c9aed4Sab 		break;
945c6c9aed4Sab 
946c6c9aed4Sab 	default:
947c6c9aed4Sab 		arch = ARCH_NONE;
948c6c9aed4Sab 		break;
949c6c9aed4Sab 	}
950c6c9aed4Sab 
951c6c9aed4Sab 	switch (sig) {
952c6c9aed4Sab 	case SIGTRAP:
9534f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9544f680cc6SAli Bahrami 		    ds_trap_arr, fmt_flags, inv_buf));
955c6c9aed4Sab 
956c6c9aed4Sab 	case SIGCLD:
9574f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9584f680cc6SAli Bahrami 		    ds_cld_arr, fmt_flags, inv_buf));
959c6c9aed4Sab 
960c6c9aed4Sab 	case SIGPOLL:
9614f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9624f680cc6SAli Bahrami 		    ds_poll_arr, fmt_flags, inv_buf));
963c6c9aed4Sab 
964c6c9aed4Sab 	case SIGILL:
9654f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9664f680cc6SAli Bahrami 		    ds_ill_arr, fmt_flags, inv_buf));
967c6c9aed4Sab 
968c6c9aed4Sab 	case SIGEMT:
969c6c9aed4Sab 		switch (arch) {
970c6c9aed4Sab 		case ARCH_SPARC:
9714f680cc6SAli Bahrami 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9724f680cc6SAli Bahrami 			    ds_emt_arr_sparc, fmt_flags, inv_buf));
973c6c9aed4Sab 		case ARCH_X86:
9744f680cc6SAli Bahrami 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9754f680cc6SAli Bahrami 			    ds_emt_arr_x86, fmt_flags, inv_buf));
976*ab5344c6SToomas Soome 		case ARCH_NONE:
977*ab5344c6SToomas Soome 			break;
978c6c9aed4Sab 		}
979c6c9aed4Sab 		break;
980c6c9aed4Sab 
981c6c9aed4Sab 	case SIGFPE:
982c6c9aed4Sab 		switch (arch) {
983c6c9aed4Sab 		case ARCH_SPARC:
9844f680cc6SAli Bahrami 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9854f680cc6SAli Bahrami 			    ds_fpe_arr_sparc, fmt_flags, inv_buf));
986c6c9aed4Sab 		case ARCH_X86:
9874f680cc6SAli Bahrami 			return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9884f680cc6SAli Bahrami 			    ds_fpe_arr_x86, fmt_flags, inv_buf));
989*ab5344c6SToomas Soome 		case ARCH_NONE:
990*ab5344c6SToomas Soome 			break;
991c6c9aed4Sab 		}
992c6c9aed4Sab 		break;
993c6c9aed4Sab 
994c6c9aed4Sab 	case SIGSEGV:
9954f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
9964f680cc6SAli Bahrami 		    ds_segv_arr, fmt_flags, inv_buf));
997c6c9aed4Sab 
998c6c9aed4Sab 	case SIGBUS:
9994f680cc6SAli Bahrami 		return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
10004f680cc6SAli Bahrami 		    ds_bus_arr, fmt_flags, inv_buf));
1001c6c9aed4Sab 	}
1002c6c9aed4Sab 
1003c6c9aed4Sab 	/* If not recognized, format as a number */
1004c6c9aed4Sab 	return (conv_invalid_val(inv_buf, si_code, fmt_flags));
1005c6c9aed4Sab 
1006c6c9aed4Sab }
1007c6c9aed4Sab 
1008c6c9aed4Sab 
1009c6c9aed4Sab #define	AUXAFFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1010c6c9aed4Sab 	MSG_AUXV_AF_SUN_SETUGID_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1011c6c9aed4Sab 	MSG_AUXV_AF_SUN_HWCAPVERIFY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1012c6c9aed4Sab 	MSG_AUXV_AF_SUN_NOPLM_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1013c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1014c6c9aed4Sab 
1015c6c9aed4Sab /*
1016c6c9aed4Sab  * Ensure that Conv_cnote_auxv_af_buf_t is large enough:
1017c6c9aed4Sab  *
1018c6c9aed4Sab  * AUXAFFLGSZ is the real minimum size of the buffer required by
1019c6c9aed4Sab  * conv_cnote_auxv_af(). However, Conv_cnote_auxv_af_buf_t
1020c6c9aed4Sab  * uses CONV_CNOTE_AUXV_AF_BUFSIZE to set the buffer size. We do
1021c6c9aed4Sab  * things this way because the definition of AUXAFFLGSZ uses information
1022c6c9aed4Sab  * that is not available in the environment of other programs
1023c6c9aed4Sab  * that include the conv.h header file.
1024c6c9aed4Sab  */
1025c6c9aed4Sab #if (CONV_CNOTE_AUXV_AF_BUFSIZE != AUXAFFLGSZ) && !defined(__lint)
1026c6c9aed4Sab #define	REPORT_BUFSIZE AUXAFFLGSZ
1027c6c9aed4Sab #include "report_bufsize.h"
1028c6c9aed4Sab #error "CONV_CNOTE_AUXV_AF_BUFSIZE does not match AUXAFFLGSZ"
1029c6c9aed4Sab #endif
1030c6c9aed4Sab 
1031c6c9aed4Sab const char *
conv_cnote_auxv_af(Word flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_auxv_af_buf_t * cnote_auxv_af_buf)1032c6c9aed4Sab conv_cnote_auxv_af(Word flags, Conv_fmt_flags_t fmt_flags,
1033c6c9aed4Sab     Conv_cnote_auxv_af_buf_t *cnote_auxv_af_buf)
1034c6c9aed4Sab {
10354f680cc6SAli Bahrami 	static const Val_desc vda[] = {
10364f680cc6SAli Bahrami 		{ AF_SUN_SETUGID,	MSG_AUXV_AF_SUN_SETUGID },
10374f680cc6SAli Bahrami 		{ AF_SUN_HWCAPVERIFY,	MSG_AUXV_AF_SUN_HWCAPVERIFY },
10384f680cc6SAli Bahrami 		{ AF_SUN_NOPLM,		MSG_AUXV_AF_SUN_NOPLM },
1039c6c9aed4Sab 		{ 0,			0 }
1040c6c9aed4Sab 	};
1041c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
10424f680cc6SAli Bahrami 	    NULL, sizeof (cnote_auxv_af_buf->buf) };
1043c6c9aed4Sab 
1044c6c9aed4Sab 	if (flags == 0)
1045c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1046c6c9aed4Sab 
1047c6c9aed4Sab 	conv_arg.buf = cnote_auxv_af_buf->buf;
1048c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
10494f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1050c6c9aed4Sab 
1051c6c9aed4Sab 	return ((const char *)cnote_auxv_af_buf->buf);
1052c6c9aed4Sab }
1053c6c9aed4Sab 
1054c6c9aed4Sab 
1055c6c9aed4Sab #define	CCFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1056c6c9aed4Sab 	MSG_CC_CONTENT_STACK_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1057c6c9aed4Sab 	MSG_CC_CONTENT_HEAP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1058c6c9aed4Sab 	MSG_CC_CONTENT_SHFILE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1059c6c9aed4Sab 	MSG_CC_CONTENT_SHANON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1060c6c9aed4Sab 	MSG_CC_CONTENT_TEXT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1061c6c9aed4Sab 	MSG_CC_CONTENT_DATA_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1062c6c9aed4Sab 	MSG_CC_CONTENT_RODATA_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1063c6c9aed4Sab 	MSG_CC_CONTENT_ANON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1064c6c9aed4Sab 	MSG_CC_CONTENT_SHM_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1065c6c9aed4Sab 	MSG_CC_CONTENT_ISM_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1066c6c9aed4Sab 	MSG_CC_CONTENT_DISM_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1067c6c9aed4Sab 	MSG_CC_CONTENT_CTF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1068c6c9aed4Sab 	MSG_CC_CONTENT_SYMTAB_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
10698e458de0SRobert Mustacchi 	MSG_CC_CONTENT_DEBUG_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1070c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1071c6c9aed4Sab 
1072c6c9aed4Sab /*
1073c6c9aed4Sab  * Ensure that Conv_cnote_cc_content_buf_t is large enough:
1074c6c9aed4Sab  *
1075c6c9aed4Sab  * CCFLGSZ is the real minimum size of the buffer required by
1076c6c9aed4Sab  * conv_cnote_cc_content(). However, Conv_cnote_cc_content_buf_t
1077c6c9aed4Sab  * uses CONV_CNOTE_CC_CONTENT_BUFSIZE to set the buffer size. We do
1078c6c9aed4Sab  * things this way because the definition of CCFLGSZ uses information
1079c6c9aed4Sab  * that is not available in the environment of other programs
1080c6c9aed4Sab  * that include the conv.h header file.
1081c6c9aed4Sab  */
1082c6c9aed4Sab #if (CONV_CNOTE_CC_CONTENT_BUFSIZE != CCFLGSZ) && !defined(__lint)
1083c6c9aed4Sab #define	REPORT_BUFSIZE CCFLGSZ
1084c6c9aed4Sab #include "report_bufsize.h"
1085c6c9aed4Sab #error "CONV_CNOTE_CC_CONTENT_BUFSIZE does not match CCFLGSZ"
1086c6c9aed4Sab #endif
1087c6c9aed4Sab 
10888e458de0SRobert Mustacchi /*
10898e458de0SRobert Mustacchi  * This is required to work around tools ld bootstrapping issues where
10908e458de0SRobert Mustacchi  * CC_CONTENT_DEBUG is not present. When an illumos sysroot has this present it
10918e458de0SRobert Mustacchi  * will probably be safe to remove this.
10928e458de0SRobert Mustacchi  */
10938e458de0SRobert Mustacchi #ifndef	CC_CONTENT_DEBUG
10948e458de0SRobert Mustacchi #define	CC_CONTENT_DEBUG	0x2000ULL
10958e458de0SRobert Mustacchi #endif
10968e458de0SRobert Mustacchi 
1097c6c9aed4Sab const char *
conv_cnote_cc_content(Lword flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_cc_content_buf_t * cnote_cc_content_buf)1098c6c9aed4Sab conv_cnote_cc_content(Lword flags, Conv_fmt_flags_t fmt_flags,
1099c6c9aed4Sab     Conv_cnote_cc_content_buf_t *cnote_cc_content_buf)
1100c6c9aed4Sab {
1101c6c9aed4Sab 	/*
1102c6c9aed4Sab 	 * Note: core_content_t is a 64-bit integer value, but our
1103c6c9aed4Sab 	 * conv_expn_field() logic is all built around 32-bit
1104c6c9aed4Sab 	 * Word values. This will probably need changing someday,
1105c6c9aed4Sab 	 * but for now, we make do with the 32-bit engine. This works
1106c6c9aed4Sab 	 * because the number of bits actually assigned in
1107c6c9aed4Sab 	 * the core_content_t data type (<sys/corectl.h>) bits within
1108c6c9aed4Sab 	 * 32-bits.
1109c6c9aed4Sab 	 *
1110c6c9aed4Sab 	 * The downside is that any bits set in the upper half of
1111c6c9aed4Sab 	 * the flags will be ignored. At the time of this writing,
1112c6c9aed4Sab 	 * that can only occur via core file corruption, which presumably
1113c6c9aed4Sab 	 * would be evident in other ways.
1114c6c9aed4Sab 	 */
11154f680cc6SAli Bahrami 	static const Val_desc vda[] = {
11164f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_STACK,	MSG_CC_CONTENT_STACK },
11174f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_HEAP,	MSG_CC_CONTENT_HEAP },
11184f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_SHFILE,	MSG_CC_CONTENT_SHFILE },
11194f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_SHANON,	MSG_CC_CONTENT_SHANON },
11204f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_TEXT,	MSG_CC_CONTENT_TEXT },
11214f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_DATA,	MSG_CC_CONTENT_DATA },
11224f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_RODATA,	MSG_CC_CONTENT_RODATA },
11234f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_ANON,	MSG_CC_CONTENT_ANON },
11244f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_SHM,	MSG_CC_CONTENT_SHM },
11254f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_ISM,	MSG_CC_CONTENT_ISM },
11264f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_DISM,	MSG_CC_CONTENT_DISM },
11274f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_CTF,	MSG_CC_CONTENT_CTF },
11284f680cc6SAli Bahrami 		{ (Word) CC_CONTENT_SYMTAB,	MSG_CC_CONTENT_SYMTAB },
11298e458de0SRobert Mustacchi 		{ (Word) CC_CONTENT_DEBUG,	MSG_CC_CONTENT_DEBUG },
1130c6c9aed4Sab 		{ 0,			0 }
1131c6c9aed4Sab 	};
1132c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
11334f680cc6SAli Bahrami 	    NULL, sizeof (cnote_cc_content_buf->buf) };
1134c6c9aed4Sab 
1135c6c9aed4Sab 	if (flags == 0)
1136c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1137c6c9aed4Sab 
1138c6c9aed4Sab 	conv_arg.buf = cnote_cc_content_buf->buf;
1139c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
11404f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1141c6c9aed4Sab 
1142c6c9aed4Sab 	return ((const char *)cnote_cc_content_buf->buf);
1143c6c9aed4Sab }
1144c6c9aed4Sab 
1145c6c9aed4Sab 
1146c6c9aed4Sab #define	PRFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1147c6c9aed4Sab 	MSG_PR_FLAGS_STOPPED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1148c6c9aed4Sab 	MSG_PR_FLAGS_ISTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1149c6c9aed4Sab 	MSG_PR_FLAGS_DSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1150c6c9aed4Sab 	MSG_PR_FLAGS_STEP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1151c6c9aed4Sab 	MSG_PR_FLAGS_ASLEEP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1152c6c9aed4Sab 	MSG_PR_FLAGS_PCINVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1153c6c9aed4Sab 	MSG_PR_FLAGS_ASLWP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1154c6c9aed4Sab 	MSG_PR_FLAGS_AGENT_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1155c6c9aed4Sab 	MSG_PR_FLAGS_DETACH_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1156c6c9aed4Sab 	MSG_PR_FLAGS_DAEMON_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1157c6c9aed4Sab 	MSG_PR_FLAGS_IDLE_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1158c6c9aed4Sab 	MSG_PR_FLAGS_ISSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1159c6c9aed4Sab 	MSG_PR_FLAGS_VFORKP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1160c6c9aed4Sab 	MSG_PR_FLAGS_ORPHAN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1161c6c9aed4Sab 	MSG_PR_FLAGS_NOSIGCHLD_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1162c6c9aed4Sab 	MSG_PR_FLAGS_WAITPID_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1163c6c9aed4Sab 	MSG_PR_FLAGS_FORK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1164c6c9aed4Sab 	MSG_PR_FLAGS_RLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1165c6c9aed4Sab 	MSG_PR_FLAGS_KLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1166c6c9aed4Sab 	MSG_PR_FLAGS_ASYNC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1167c6c9aed4Sab 	MSG_PR_FLAGS_MSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1168c6c9aed4Sab 	MSG_PR_FLAGS_BPTADJ_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1169c6c9aed4Sab 	MSG_PR_FLAGS_PTRACE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1170c6c9aed4Sab 	MSG_PR_FLAGS_MSFORK_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1171c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1172c6c9aed4Sab 
1173c6c9aed4Sab /*
1174c6c9aed4Sab  * Ensure that Conv_cnote_pr_flags_buf_t is large enough:
1175c6c9aed4Sab  *
1176c6c9aed4Sab  * PRFLGSZ is the real minimum size of the buffer required by
1177c6c9aed4Sab  * conv_cnote_pr_flags(). However, Conv_cnote_pr_flags_buf_t
1178c6c9aed4Sab  * uses CONV_CNOTE_PR_FLAGS_BUFSIZE to set the buffer size. We do
1179c6c9aed4Sab  * things this way because the definition of PRFLGSZ uses information
1180c6c9aed4Sab  * that is not available in the environment of other programs
1181c6c9aed4Sab  * that include the conv.h header file.
1182c6c9aed4Sab  */
1183c6c9aed4Sab #if (CONV_CNOTE_PR_FLAGS_BUFSIZE != PRFLGSZ) && !defined(__lint)
1184c6c9aed4Sab #define	REPORT_BUFSIZE PRFLGSZ
1185c6c9aed4Sab #include "report_bufsize.h"
1186c6c9aed4Sab #error "CONV_CNOTE_PR_FLAGS_BUFSIZE does not match PRFLGSZ"
1187c6c9aed4Sab #endif
1188c6c9aed4Sab 
1189c6c9aed4Sab const char *
conv_cnote_pr_flags(int flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_pr_flags_buf_t * cnote_pr_flags_buf)1190c6c9aed4Sab conv_cnote_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
1191c6c9aed4Sab     Conv_cnote_pr_flags_buf_t *cnote_pr_flags_buf)
1192c6c9aed4Sab {
11934f680cc6SAli Bahrami 	static const Val_desc vda[] = {
1194d0158222SRobert Mustacchi 		{ PR_STOPPED,		MSG_PR_FLAGS_STOPPED },
11954f680cc6SAli Bahrami 		{ PR_ISTOP,		MSG_PR_FLAGS_ISTOP },
11964f680cc6SAli Bahrami 		{ PR_DSTOP,		MSG_PR_FLAGS_DSTOP },
11974f680cc6SAli Bahrami 		{ PR_STEP,		MSG_PR_FLAGS_STEP },
11984f680cc6SAli Bahrami 		{ PR_ASLEEP,		MSG_PR_FLAGS_ASLEEP },
11994f680cc6SAli Bahrami 		{ PR_PCINVAL,		MSG_PR_FLAGS_PCINVAL },
12004f680cc6SAli Bahrami 		{ PR_ASLWP,		MSG_PR_FLAGS_ASLWP },
12014f680cc6SAli Bahrami 		{ PR_AGENT,		MSG_PR_FLAGS_AGENT },
12024f680cc6SAli Bahrami 		{ PR_DETACH,		MSG_PR_FLAGS_DETACH },
12034f680cc6SAli Bahrami 		{ PR_DAEMON,		MSG_PR_FLAGS_DAEMON },
12044f680cc6SAli Bahrami 		{ PR_IDLE,		MSG_PR_FLAGS_IDLE },
12054f680cc6SAli Bahrami 		{ PR_ISSYS,		MSG_PR_FLAGS_ISSYS },
12064f680cc6SAli Bahrami 		{ PR_VFORKP,		MSG_PR_FLAGS_VFORKP },
12074f680cc6SAli Bahrami 		{ PR_ORPHAN,		MSG_PR_FLAGS_ORPHAN },
12084f680cc6SAli Bahrami 		{ PR_NOSIGCHLD,		MSG_PR_FLAGS_NOSIGCHLD },
12094f680cc6SAli Bahrami 		{ PR_WAITPID,		MSG_PR_FLAGS_WAITPID },
12104f680cc6SAli Bahrami 		{ PR_FORK,		MSG_PR_FLAGS_FORK },
12114f680cc6SAli Bahrami 		{ PR_RLC,		MSG_PR_FLAGS_RLC },
12124f680cc6SAli Bahrami 		{ PR_KLC,		MSG_PR_FLAGS_KLC },
12134f680cc6SAli Bahrami 		{ PR_ASYNC,		MSG_PR_FLAGS_ASYNC },
12144f680cc6SAli Bahrami 		{ PR_MSACCT,		MSG_PR_FLAGS_MSACCT },
12154f680cc6SAli Bahrami 		{ PR_BPTADJ,		MSG_PR_FLAGS_BPTADJ },
12164f680cc6SAli Bahrami 		{ PR_PTRACE,		MSG_PR_FLAGS_PTRACE },
12174f680cc6SAli Bahrami 		{ PR_MSFORK,		MSG_PR_FLAGS_MSFORK },
1218c6c9aed4Sab 		{ 0,			0 }
1219c6c9aed4Sab 	};
1220c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
12214f680cc6SAli Bahrami 	    NULL, sizeof (cnote_pr_flags_buf->buf) };
1222c6c9aed4Sab 
1223c6c9aed4Sab 	if (flags == 0)
1224c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1225c6c9aed4Sab 
1226c6c9aed4Sab 	conv_arg.buf = cnote_pr_flags_buf->buf;
1227c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
12284f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1229c6c9aed4Sab 
1230c6c9aed4Sab 	return ((const char *)cnote_pr_flags_buf->buf);
1231c6c9aed4Sab }
1232c6c9aed4Sab 
1233c6c9aed4Sab 
1234c6c9aed4Sab #define	OLDPRFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1235c6c9aed4Sab 	MSG_PR_FLAGS_STOPPED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1236c6c9aed4Sab 	MSG_PR_FLAGS_ISTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1237c6c9aed4Sab 	MSG_PR_FLAGS_DSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1238c6c9aed4Sab 	MSG_PR_FLAGS_ASLEEP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1239c6c9aed4Sab 	MSG_PR_FLAGS_FORK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1240c6c9aed4Sab 	MSG_PR_FLAGS_RLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1241c6c9aed4Sab 	MSG_PR_FLAGS_PTRACE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1242c6c9aed4Sab 	MSG_PR_FLAGS_PCINVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1243c6c9aed4Sab 	MSG_PR_FLAGS_ISSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1244c6c9aed4Sab 	MSG_PR_FLAGS_STEP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1245c6c9aed4Sab 	MSG_PR_FLAGS_KLC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1246c6c9aed4Sab 	MSG_PR_FLAGS_ASYNC_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1247c6c9aed4Sab 	MSG_PR_FLAGS_PCOMPAT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1248c6c9aed4Sab 	MSG_PR_FLAGS_MSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1249c6c9aed4Sab 	MSG_PR_FLAGS_BPTADJ_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1250c6c9aed4Sab 	MSG_PR_FLAGS_ASLWP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1251c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1252c6c9aed4Sab 
1253c6c9aed4Sab /*
1254c6c9aed4Sab  * Ensure that Conv_cnote_old_pr_flags_buf_t is large enough:
1255c6c9aed4Sab  *
1256c6c9aed4Sab  * OLDPRFLGSZ is the real minimum size of the buffer required by
1257c6c9aed4Sab  * conv_cnote_old_pr_flags(). However, Conv_cnote_old_pr_flags_buf_t
1258c6c9aed4Sab  * uses CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE to set the buffer size. We do
1259c6c9aed4Sab  * things this way because the definition of OLDPRFLGSZ uses information
1260c6c9aed4Sab  * that is not available in the environment of other programs
1261c6c9aed4Sab  * that include the conv.h header file.
1262c6c9aed4Sab  */
1263c6c9aed4Sab #if (CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE != OLDPRFLGSZ) && !defined(__lint)
1264c6c9aed4Sab #define	REPORT_BUFSIZE OLDPRFLGSZ
1265c6c9aed4Sab #include "report_bufsize.h"
1266c6c9aed4Sab #error "CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE does not match OLDPRFLGSZ"
1267c6c9aed4Sab #endif
1268c6c9aed4Sab 
1269c6c9aed4Sab const char *
conv_cnote_old_pr_flags(int flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_old_pr_flags_buf_t * cnote_old_pr_flags_buf)1270c6c9aed4Sab conv_cnote_old_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
1271c6c9aed4Sab     Conv_cnote_old_pr_flags_buf_t *cnote_old_pr_flags_buf)
1272c6c9aed4Sab {
1273c6c9aed4Sab 	/*
1274c6c9aed4Sab 	 * <sys/old_procfs.h> defines names for many of these flags
1275c6c9aed4Sab 	 * that are also defined in <sys/procfs.h>, but with different
1276c6c9aed4Sab 	 * values. To avoid confusion, we don't include <sys/old_procfs.h>,
1277c6c9aed4Sab 	 * and specify the values directly.
1278c6c9aed4Sab 	 */
12794f680cc6SAli Bahrami 	static const Val_desc vda[] = {
12804f680cc6SAli Bahrami 		{ 0x0001,		MSG_PR_FLAGS_STOPPED },
12814f680cc6SAli Bahrami 		{ 0x0002,		MSG_PR_FLAGS_ISTOP },
12824f680cc6SAli Bahrami 		{ 0x0004,		MSG_PR_FLAGS_DSTOP },
12834f680cc6SAli Bahrami 		{ 0x0008,		MSG_PR_FLAGS_ASLEEP },
12844f680cc6SAli Bahrami 		{ 0x0010,		MSG_PR_FLAGS_FORK },
12854f680cc6SAli Bahrami 		{ 0x0020,		MSG_PR_FLAGS_RLC },
12864f680cc6SAli Bahrami 		{ 0x0040,		MSG_PR_FLAGS_PTRACE },
12874f680cc6SAli Bahrami 		{ 0x0080,		MSG_PR_FLAGS_PCINVAL },
12884f680cc6SAli Bahrami 		{ 0x0100,		MSG_PR_FLAGS_ISSYS },
12894f680cc6SAli Bahrami 		{ 0x0200,		MSG_PR_FLAGS_STEP },
12904f680cc6SAli Bahrami 		{ 0x0400,		MSG_PR_FLAGS_KLC },
12914f680cc6SAli Bahrami 		{ 0x0800,		MSG_PR_FLAGS_ASYNC },
12924f680cc6SAli Bahrami 		{ 0x1000,		MSG_PR_FLAGS_PCOMPAT },
12934f680cc6SAli Bahrami 		{ 0x2000,		MSG_PR_FLAGS_MSACCT },
12944f680cc6SAli Bahrami 		{ 0x4000,		MSG_PR_FLAGS_BPTADJ },
12954f680cc6SAli Bahrami 		{ 0x8000,		MSG_PR_FLAGS_ASLWP },
1296c6c9aed4Sab 		{ 0,			0 }
1297c6c9aed4Sab 	};
1298c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
12994f680cc6SAli Bahrami 	    NULL, sizeof (cnote_old_pr_flags_buf->buf) };
1300c6c9aed4Sab 
1301c6c9aed4Sab 	if (flags == 0)
1302c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1303c6c9aed4Sab 
1304c6c9aed4Sab 	conv_arg.buf = cnote_old_pr_flags_buf->buf;
1305c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
13064f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1307c6c9aed4Sab 
1308c6c9aed4Sab 	return ((const char *)cnote_old_pr_flags_buf->buf);
1309c6c9aed4Sab }
1310c6c9aed4Sab 
1311c6c9aed4Sab 
1312c6c9aed4Sab #define	PROCFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1313c6c9aed4Sab 	MSG_PROC_FLAG_SSYS_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1314c6c9aed4Sab 	MSG_PROC_FLAG_SMSACCT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1315c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1316c6c9aed4Sab 
1317c6c9aed4Sab /*
1318c6c9aed4Sab  * Ensure that Conv_cnote_proc_flag_buf_t is large enough:
1319c6c9aed4Sab  *
1320c6c9aed4Sab  * PROCFLGSZ is the real minimum size of the buffer required by
1321c6c9aed4Sab  * conv_cnote_proc_flag(). However, Conv_cnote_proc_flag_buf_t
1322c6c9aed4Sab  * uses CONV_CNOTE_PROC_FLAG_BUFSIZE to set the buffer size. We do
1323c6c9aed4Sab  * things this way because the definition of PROCFLGSZ uses information
1324c6c9aed4Sab  * that is not available in the environment of other programs
1325c6c9aed4Sab  * that include the conv.h header file.
1326c6c9aed4Sab  */
1327c6c9aed4Sab #if (CONV_CNOTE_PROC_FLAG_BUFSIZE != PROCFLGSZ) && !defined(__lint)
1328c6c9aed4Sab #define	REPORT_BUFSIZE PROCFLGSZ
1329c6c9aed4Sab #include "report_bufsize.h"
1330c6c9aed4Sab #error "CONV_CNOTE_PROC_FLAG_BUFSIZE does not match PROCFLGSZ"
1331c6c9aed4Sab #endif
1332c6c9aed4Sab 
1333c6c9aed4Sab const char *
conv_cnote_proc_flag(int flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_proc_flag_buf_t * cnote_proc_flag_buf)1334c6c9aed4Sab conv_cnote_proc_flag(int flags, Conv_fmt_flags_t fmt_flags,
1335c6c9aed4Sab     Conv_cnote_proc_flag_buf_t *cnote_proc_flag_buf)
1336c6c9aed4Sab {
1337c6c9aed4Sab 	/*
1338c6c9aed4Sab 	 * Most of the proc flags are implementation dependant, and can
1339c6c9aed4Sab 	 * change between releases. As such, we do not attempt to translate
1340c6c9aed4Sab 	 * them to symbolic form, but simply report them in hex form.
1341c6c9aed4Sab 	 * However, SMSACCT and SSYS are special, and their bit values
1342c6c9aed4Sab 	 * are maintained between releases so they can be used in the
1343c6c9aed4Sab 	 * psinfo_t.p_flag field. We therefore translate these items.
1344c6c9aed4Sab 	 *
1345c6c9aed4Sab 	 * See <system/proc.h>
1346c6c9aed4Sab 	 *
1347c6c9aed4Sab 	 * Note: We don't want to include <sys/proc.h> in this file, because
1348c6c9aed4Sab 	 * it redefines 'struct list', which we have defined in sgs.h. As
1349c6c9aed4Sab 	 * SMSACCT and SSYS are stable public values, we simply use
1350c6c9aed4Sab 	 * their numeric value.
1351c6c9aed4Sab 	 */
13524f680cc6SAli Bahrami 	static const Val_desc vda[] = {
1353d0158222SRobert Mustacchi 		{ 0x00000001,		MSG_PROC_FLAG_SSYS },
13544f680cc6SAli Bahrami 		{ 0x02000000,		MSG_PROC_FLAG_SMSACCT },
1355c6c9aed4Sab 		{ 0,			0 }
1356c6c9aed4Sab 	};
1357c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
13584f680cc6SAli Bahrami 	    NULL, sizeof (cnote_proc_flag_buf->buf) };
1359c6c9aed4Sab 
1360c6c9aed4Sab 	if (flags == 0)
1361c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1362c6c9aed4Sab 
1363c6c9aed4Sab 	conv_arg.buf = cnote_proc_flag_buf->buf;
1364c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
13654f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1366c6c9aed4Sab 
1367c6c9aed4Sab 	return ((const char *)cnote_proc_flag_buf->buf);
1368c6c9aed4Sab }
1369c6c9aed4Sab 
1370c6c9aed4Sab 
1371c6c9aed4Sab #define	SAFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1372c6c9aed4Sab 	MSG_SA_ONSTACK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1373c6c9aed4Sab 	MSG_SA_RESETHAND_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1374c6c9aed4Sab 	MSG_SA_RESTART_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1375c6c9aed4Sab 	MSG_SA_SIGINFO_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1376c6c9aed4Sab 	MSG_SA_NODEFER_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1377c6c9aed4Sab 	MSG_SA_NOCLDWAIT_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1378c6c9aed4Sab 	MSG_SA_NOCLDSTOP_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1379c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1380c6c9aed4Sab 
1381c6c9aed4Sab /*
1382c6c9aed4Sab  * Ensure that Conv_cnote_sa_flags_buf_t is large enough:
1383c6c9aed4Sab  *
1384c6c9aed4Sab  * SAFLGSZ is the real minimum size of the buffer required by
1385c6c9aed4Sab  * conv_cnote_sa_flags(). However, Conv_cnote_sa_flags_buf_t
1386c6c9aed4Sab  * uses CONV_CNOTE_SA_FLAGS_BUFSIZE to set the buffer size. We do
1387c6c9aed4Sab  * things this way because the definition of SAFLGSZ uses information
1388c6c9aed4Sab  * that is not available in the environment of other programs
1389c6c9aed4Sab  * that include the conv.h header file.
1390c6c9aed4Sab  */
1391c6c9aed4Sab #if (CONV_CNOTE_SA_FLAGS_BUFSIZE != SAFLGSZ) && !defined(__lint)
1392c6c9aed4Sab #define	REPORT_BUFSIZE SAFLGSZ
1393c6c9aed4Sab #include "report_bufsize.h"
1394c6c9aed4Sab #error "CONV_CNOTE_SA_FLAGS_BUFSIZE does not match SAFLGSZ"
1395c6c9aed4Sab #endif
1396c6c9aed4Sab 
1397c6c9aed4Sab const char *
conv_cnote_sa_flags(int flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_sa_flags_buf_t * cnote_sa_flags_buf)1398c6c9aed4Sab conv_cnote_sa_flags(int flags, Conv_fmt_flags_t fmt_flags,
1399c6c9aed4Sab     Conv_cnote_sa_flags_buf_t *cnote_sa_flags_buf)
1400c6c9aed4Sab {
14014f680cc6SAli Bahrami 	static const Val_desc vda[] = {
14024f680cc6SAli Bahrami 		{ SA_ONSTACK,		MSG_SA_ONSTACK },
14034f680cc6SAli Bahrami 		{ SA_RESETHAND,		MSG_SA_RESETHAND },
14044f680cc6SAli Bahrami 		{ SA_RESTART,		MSG_SA_RESTART },
14054f680cc6SAli Bahrami 		{ SA_SIGINFO,		MSG_SA_SIGINFO },
14064f680cc6SAli Bahrami 		{ SA_NODEFER,		MSG_SA_NODEFER },
14074f680cc6SAli Bahrami 		{ SA_NOCLDWAIT,		MSG_SA_NOCLDWAIT },
14084f680cc6SAli Bahrami 		{ SA_NOCLDSTOP,		MSG_SA_NOCLDSTOP },
1409c6c9aed4Sab 		{ 0,			0 }
1410c6c9aed4Sab 	};
1411c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
14124f680cc6SAli Bahrami 	    NULL, sizeof (cnote_sa_flags_buf->buf) };
1413c6c9aed4Sab 
1414c6c9aed4Sab 	if (flags == 0)
1415c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1416c6c9aed4Sab 
1417c6c9aed4Sab 	conv_arg.buf = cnote_sa_flags_buf->buf;
1418c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
14194f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1420c6c9aed4Sab 
1421c6c9aed4Sab 	return ((const char *)cnote_sa_flags_buf->buf);
1422c6c9aed4Sab }
1423c6c9aed4Sab 
1424c6c9aed4Sab 
1425c6c9aed4Sab #define	SSFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1426c6c9aed4Sab 	MSG_SS_ONSTACK_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1427c6c9aed4Sab 	MSG_SS_DISABLE_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1428c6c9aed4Sab 	CONV_INV_BUFSIZE		+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1429c6c9aed4Sab 
1430c6c9aed4Sab /*
1431c6c9aed4Sab  * Ensure that Conv_cnote_ss_flags_buf_t is large enough:
1432c6c9aed4Sab  *
1433c6c9aed4Sab  * SSFLGSZ is the real minimum size of the buffer required by
1434c6c9aed4Sab  * conv_cnote_ss_flags(). However, Conv_cnote_ss_flags_buf_t
1435c6c9aed4Sab  * uses CONV_CNOTE_SS_FLAGS_BUFSIZE to set the buffer size. We do
1436c6c9aed4Sab  * things this way because the definition of SSFLGSZ uses information
1437c6c9aed4Sab  * that is not available in the environment of other programs
1438c6c9aed4Sab  * that include the conv.h header file.
1439c6c9aed4Sab  */
1440c6c9aed4Sab #if (CONV_CNOTE_SS_FLAGS_BUFSIZE != SSFLGSZ) && !defined(__lint)
1441c6c9aed4Sab #define	REPORT_BUFSIZE SSFLGSZ
1442c6c9aed4Sab #include "report_bufsize.h"
1443c6c9aed4Sab #error "CONV_CNOTE_SS_FLAGS_BUFSIZE does not match SSFLGSZ"
1444c6c9aed4Sab #endif
1445c6c9aed4Sab 
1446c6c9aed4Sab const char *
conv_cnote_ss_flags(int flags,Conv_fmt_flags_t fmt_flags,Conv_cnote_ss_flags_buf_t * cnote_ss_flags_buf)1447c6c9aed4Sab conv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
1448c6c9aed4Sab     Conv_cnote_ss_flags_buf_t *cnote_ss_flags_buf)
1449c6c9aed4Sab {
14504f680cc6SAli Bahrami 	static const Val_desc vda[] = {
14514f680cc6SAli Bahrami 		{ SS_ONSTACK,		MSG_SS_ONSTACK },
14524f680cc6SAli Bahrami 		{ SS_DISABLE,		MSG_SS_DISABLE },
1453c6c9aed4Sab 		{ 0,			0 }
1454c6c9aed4Sab 	};
1455c6c9aed4Sab 	static CONV_EXPN_FIELD_ARG conv_arg = {
14564f680cc6SAli Bahrami 	    NULL, sizeof (cnote_ss_flags_buf->buf) };
1457c6c9aed4Sab 
1458c6c9aed4Sab 	if (flags == 0)
1459c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1460c6c9aed4Sab 
1461c6c9aed4Sab 	conv_arg.buf = cnote_ss_flags_buf->buf;
1462c6c9aed4Sab 	conv_arg.oflags = conv_arg.rflags = flags;
14634f680cc6SAli Bahrami 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
1464c6c9aed4Sab 
1465c6c9aed4Sab 	return ((const char *)cnote_ss_flags_buf->buf);
1466c6c9aed4Sab }
1467c6c9aed4Sab 
1468c6c9aed4Sab 
1469c6c9aed4Sab /*
1470c6c9aed4Sab  * Solaris has a variety of types that use bitmasks to represent
1471c6c9aed4Sab  * sets of things like signals (sigset_t), faults (fltset_t), and
1472c6c9aed4Sab  * system calls (sysset_t). These types use arrays of unsigned 32-bit
1473c6c9aed4Sab  * integers to represent the set. These are public types that
1474c6c9aed4Sab  * cannot be changed, so they are generously oversized to allow
1475c6c9aed4Sab  * for future growth. Hence, there are usually unused bits.
1476c6c9aed4Sab  *
1477c6c9aed4Sab  * conv_bitmaskset() generalizes the process of displaying these items.
1478c6c9aed4Sab  */
1479c6c9aed4Sab 
1480c6c9aed4Sab typedef struct {
14814f680cc6SAli Bahrami 	const Val_desc	*vdp;		/* NULL, or bitmask description */
1482c6c9aed4Sab 	uint32_t	unused_bits;	/* Mask of undefined bits */
1483c6c9aed4Sab } conv_bitmaskset_desc_t;
1484c6c9aed4Sab 
1485c6c9aed4Sab /*
1486c6c9aed4Sab  * entry:
1487c6c9aed4Sab  *	n_mask - # of 32-bit masks that make up this bitmask type.
1488c6c9aed4Sab  *	maskarr - Array of n_mask 32-bit mask values
1489c6c9aed4Sab  *	bitmask_descarr - Array of n_mask bitmask_desc_t descriptors,
1490c6c9aed4Sab  *		one for each mask, specifying the bitmask names, and
1491c6c9aed4Sab  *		a mask of the bits that are not defined by the system.
1492c6c9aed4Sab  *	fmt_flags - CONV_FMT_* values, used to specify formatting details.
1493c6c9aed4Sab  *	conv_buf - Buffer to receive formatted results
1494c6c9aed4Sab  *	conv_buf_size - Size of conv_buf, including room for NULL termination
1495c6c9aed4Sab  */
1496c6c9aed4Sab static const char *
conv_bitmaskset(uint32_t * maskarr,int n_mask,const conv_bitmaskset_desc_t * bitmask_descarr,Conv_fmt_flags_t fmt_flags,char * conv_buf,size_t conv_buf_size)1497c6c9aed4Sab conv_bitmaskset(uint32_t *maskarr, int n_mask,
14984f680cc6SAli Bahrami     const conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
1499c6c9aed4Sab     char *conv_buf, size_t conv_buf_size)
1500c6c9aed4Sab {
1501c6c9aed4Sab 	CONV_EXPN_FIELD_ARG	conv_arg;
1502c6c9aed4Sab 	int	i, need_sep = 0;
1503c6c9aed4Sab 
1504c6c9aed4Sab 	/* If every bit of every mask is 0, return 0 as the result */
1505c6c9aed4Sab 	for (i = 0; i < n_mask; i++)
1506c6c9aed4Sab 		if (maskarr[i] != 0)
1507c6c9aed4Sab 			break;
1508c6c9aed4Sab 	if (i == n_mask)
1509c6c9aed4Sab 		return (MSG_ORIG(MSG_GBL_ZERO));
1510c6c9aed4Sab 
1511c6c9aed4Sab 	/*
1512c6c9aed4Sab 	 * At least one bit is non-zero. Move through the masks
1513c6c9aed4Sab 	 * and process each one.
1514c6c9aed4Sab 	 */
1515c6c9aed4Sab 	(void) memset(&conv_arg, 0, sizeof (conv_arg));
1516c6c9aed4Sab 	conv_arg.bufsize = conv_buf_size;
1517c6c9aed4Sab 	conv_arg.buf = conv_buf;
1518c6c9aed4Sab 	if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
1519c6c9aed4Sab 		*conv_arg.buf++ = '[';
1520c6c9aed4Sab 		*conv_arg.buf++ = ' ';
1521c6c9aed4Sab 		conv_arg.bufsize -= 2;
1522c6c9aed4Sab 	}
1523c6c9aed4Sab 
1524c6c9aed4Sab 	/*
1525c6c9aed4Sab 	 * conv_expn_field() orders its output with the most significant
1526c6c9aed4Sab 	 * bits on the left. To preserve this ordering across the
1527c6c9aed4Sab 	 * subwords or our "virtual bitmask", we need to process
1528c6c9aed4Sab 	 * the sub-words in the same order, from most significant down
1529c6c9aed4Sab 	 * to least significant. Since unassigned bits tend to be at
1530c6c9aed4Sab 	 * the MSB end of the word, we process the unused bits first.
1531c6c9aed4Sab 	 *
1532c6c9aed4Sab 	 * One implication of this is that the caller should not use
1533c6c9aed4Sab 	 * the unassigned bits for "abandoned" bits in the middle of
1534c6c9aed4Sab 	 * a used range, but should instead define the string for
1535c6c9aed4Sab 	 * that bit as being the string representation of that decimal
1536c6c9aed4Sab 	 * value (i.e. "65"). That will cause the bit to be properly
1537c6c9aed4Sab 	 * sorted among the named bits to either side of it.
1538c6c9aed4Sab 	 */
1539c6c9aed4Sab 	for (i = 0; i < n_mask; i++) {
1540c6c9aed4Sab 		size_t		n;
1541c6c9aed4Sab 		uint32_t	mask, unused_bits;
1542c6c9aed4Sab 		const int	bits_per_mask = sizeof (mask) * 8;
1543c6c9aed4Sab 
1544c6c9aed4Sab 		mask = maskarr[i];
1545c6c9aed4Sab 		unused_bits = mask & bitmask_descarr[i].unused_bits;
1546c6c9aed4Sab 		mask &= ~unused_bits;
1547c6c9aed4Sab 
1548c6c9aed4Sab 		if (mask != 0) {
1549c6c9aed4Sab 
1550c6c9aed4Sab 			conv_arg.oflags = conv_arg.rflags = mask;
1551c6c9aed4Sab 			if (need_sep) {
1552c6c9aed4Sab 				*conv_arg.buf++ = ' ';
1553c6c9aed4Sab 				conv_arg.bufsize--;
1554c6c9aed4Sab 			}
1555c6c9aed4Sab 			need_sep = 1;
1556c6c9aed4Sab 			(void) conv_expn_field(&conv_arg,
15574f680cc6SAli Bahrami 			    bitmask_descarr[i].vdp, fmt_flags | CONV_FMT_NOBKT);
1558c6c9aed4Sab 			n = strlen(conv_arg.buf);
1559c6c9aed4Sab 			conv_arg.bufsize -= n;
1560c6c9aed4Sab 			conv_arg.buf += n;
1561c6c9aed4Sab 		}
1562c6c9aed4Sab 
1563c6c9aed4Sab 		if (unused_bits != 0) {
1564c6c9aed4Sab 			uint32_t	bit = 0x00000001;
1565c6c9aed4Sab 			int		j;
1566c6c9aed4Sab 
1567c6c9aed4Sab 			for (j = 1; j <= bits_per_mask; j++, bit *= 2) {
1568c6c9aed4Sab 				if ((unused_bits & bit) == 0)
1569c6c9aed4Sab 					continue;
1570c6c9aed4Sab 
1571c6c9aed4Sab 				if (need_sep) {
1572c6c9aed4Sab 					*conv_arg.buf++ = ' ';
1573c6c9aed4Sab 					conv_arg.bufsize--;
1574c6c9aed4Sab 				}
1575c6c9aed4Sab 				need_sep = 1;
1576c6c9aed4Sab 				n = snprintf(conv_arg.buf, conv_arg.bufsize,
1577c6c9aed4Sab 				    MSG_ORIG(MSG_FMT_WORD),
1578c6c9aed4Sab 				    EC_WORD(j + (bits_per_mask * i)));
1579c6c9aed4Sab 				conv_arg.buf += n;
1580c6c9aed4Sab 				conv_arg.bufsize -= n;
1581c6c9aed4Sab 			}
1582c6c9aed4Sab 		}
1583c6c9aed4Sab 	}
1584c6c9aed4Sab 	if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
1585c6c9aed4Sab 		*conv_arg.buf++ = ' ';
1586c6c9aed4Sab 		*conv_arg.buf++ = ']';
1587c6c9aed4Sab 	}
1588c6c9aed4Sab 	*conv_arg.buf = '\0';
1589c6c9aed4Sab 
1590c6c9aed4Sab 	return ((const char *) conv_buf);
1591c6c9aed4Sab }
1592c6c9aed4Sab 
1593c6c9aed4Sab 
1594c6c9aed4Sab #define	SIGSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1595c6c9aed4Sab 	/* sigset_t [0] - Signals [1 - 32] */ \
1596c6c9aed4Sab 	MSG_SIGHUP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1597c6c9aed4Sab 	MSG_SIGINT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1598c6c9aed4Sab 	MSG_SIGQUIT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1599c6c9aed4Sab 	MSG_SIGILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1600c6c9aed4Sab 	MSG_SIGTRAP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1601c6c9aed4Sab 	MSG_SIGABRT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1602c6c9aed4Sab 	MSG_SIGEMT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1603c6c9aed4Sab 	MSG_SIGFPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1604c6c9aed4Sab 	MSG_SIGKILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1605c6c9aed4Sab 	MSG_SIGBUS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1606c6c9aed4Sab 	MSG_SIGSEGV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1607c6c9aed4Sab 	MSG_SIGSYS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1608c6c9aed4Sab 	MSG_SIGPIPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1609c6c9aed4Sab 	MSG_SIGALRM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1610c6c9aed4Sab 	MSG_SIGTERM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1611c6c9aed4Sab 	MSG_SIGUSR1_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1612c6c9aed4Sab 	MSG_SIGUSR2_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1613c6c9aed4Sab 	MSG_SIGCHLD_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1614c6c9aed4Sab 	MSG_SIGPWR_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1615c6c9aed4Sab 	MSG_SIGWINCH_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1616c6c9aed4Sab 	MSG_SIGURG_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1617c6c9aed4Sab 	MSG_SIGPOLL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1618c6c9aed4Sab 	MSG_SIGSTOP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1619c6c9aed4Sab 	MSG_SIGTSTP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1620c6c9aed4Sab 	MSG_SIGCONT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1621c6c9aed4Sab 	MSG_SIGTTIN_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1622c6c9aed4Sab 	MSG_SIGTTOU_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1623c6c9aed4Sab 	MSG_SIGVTALRM_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1624c6c9aed4Sab 	MSG_SIGPROF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1625c6c9aed4Sab 	MSG_SIGXCPU_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1626c6c9aed4Sab 	MSG_SIGXFSZ_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1627c6c9aed4Sab 	MSG_SIGWAITING_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1628c6c9aed4Sab 	\
1629c6c9aed4Sab 	/* \
1630c6c9aed4Sab 	 * sigset_t [1] - Signals [33 - 64] \
1631c6c9aed4Sab 	 * There are 24 unused bits, each of which needs two \
1632c6c9aed4Sab 	 * characters plus a separator. \
1633c6c9aed4Sab 	 */ \
1634c6c9aed4Sab 	MSG_SIGLWP_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1635c6c9aed4Sab 	MSG_SIGFREEZE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1636c6c9aed4Sab 	MSG_SIGTHAW_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1637c6c9aed4Sab 	MSG_SIGCANCEL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1638c6c9aed4Sab 	MSG_SIGLOST_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1639c6c9aed4Sab 	MSG_SIGXRES_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1640c6c9aed4Sab 	MSG_SIGJVM1_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1641c6c9aed4Sab 	MSG_SIGJVM2_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1642c6c9aed4Sab 	(24 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1643c6c9aed4Sab 	\
1644c6c9aed4Sab 	/* \
1645c6c9aed4Sab 	 * sigset_t [2] - Signals [65 - 96] \
1646c6c9aed4Sab 	 * There are 32 unused bits, each of which needs two \
1647c6c9aed4Sab 	 * characters plus a separator. \
1648c6c9aed4Sab 	 */ \
1649c6c9aed4Sab 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1650c6c9aed4Sab 	\
1651c6c9aed4Sab 	/* \
1652c6c9aed4Sab 	 * sigset_t [2] - Signals [97 - 128] \
1653c6c9aed4Sab 	 * There are 32 unused bits. Three of these need two \
1654c6c9aed4Sab 	 * characters, and 29 need 3. Each one needs a separator. \
1655c6c9aed4Sab 	 */ \
1656c6c9aed4Sab 	(3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1657c6c9aed4Sab 	(29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1658c6c9aed4Sab 	\
1659c6c9aed4Sab 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1660c6c9aed4Sab 
1661c6c9aed4Sab /*
1662c6c9aed4Sab  * Ensure that Conv_cnote_sigset_buf_t is large enough:
1663c6c9aed4Sab  *
1664c6c9aed4Sab  * SIGSET_FLAGSZ is the real minimum size of the buffer required by
1665c6c9aed4Sab  * conv_cnote_sigset(). However, Conv_cnote_sigset_buf_t
1666c6c9aed4Sab  * uses CONV_CNOTE_SIGSET_BUFSIZE to set the buffer size. We do
1667c6c9aed4Sab  * things this way because the definition of SIGSET_FLAGSZ uses information
1668c6c9aed4Sab  * that is not available in the environment of other programs
1669c6c9aed4Sab  * that include the conv.h header file.
1670c6c9aed4Sab  */
1671c6c9aed4Sab #if (CONV_CNOTE_SIGSET_BUFSIZE != SIGSET_FLAGSZ) && !defined(__lint)
1672c6c9aed4Sab #define	REPORT_BUFSIZE SIGSET_FLAGSZ
1673c6c9aed4Sab #include "report_bufsize.h"
1674c6c9aed4Sab #error "CONV_CNOTE_SIGSET_BUFSIZE does not match SIGSET_FLAGSZ"
1675c6c9aed4Sab #endif
1676c6c9aed4Sab 
1677c6c9aed4Sab const char *
conv_cnote_sigset(uint32_t * maskarr,int n_mask,Conv_fmt_flags_t fmt_flags,Conv_cnote_sigset_buf_t * cnote_sigset_buf)1678c6c9aed4Sab conv_cnote_sigset(uint32_t *maskarr, int n_mask,
1679c6c9aed4Sab     Conv_fmt_flags_t fmt_flags, Conv_cnote_sigset_buf_t *cnote_sigset_buf)
1680c6c9aed4Sab {
1681c6c9aed4Sab #define	N_MASK 4
1682c6c9aed4Sab 
16834f680cc6SAli Bahrami 	static const Val_desc vda0[] = {
16844f680cc6SAli Bahrami 		{ 0x00000001,		MSG_SIGHUP_ALT },
16854f680cc6SAli Bahrami 		{ 0x00000002,		MSG_SIGINT_ALT },
16864f680cc6SAli Bahrami 		{ 0x00000004,		MSG_SIGQUIT_ALT },
16874f680cc6SAli Bahrami 		{ 0x00000008,		MSG_SIGILL_ALT },
16884f680cc6SAli Bahrami 		{ 0x00000010,		MSG_SIGTRAP_ALT },
16894f680cc6SAli Bahrami 		{ 0x00000020,		MSG_SIGABRT_ALT },
16904f680cc6SAli Bahrami 		{ 0x00000040,		MSG_SIGEMT_ALT },
16914f680cc6SAli Bahrami 		{ 0x00000080,		MSG_SIGFPE_ALT },
16924f680cc6SAli Bahrami 		{ 0x00000100,		MSG_SIGKILL_ALT },
16934f680cc6SAli Bahrami 		{ 0x00000200,		MSG_SIGBUS_ALT },
16944f680cc6SAli Bahrami 		{ 0x00000400,		MSG_SIGSEGV_ALT },
16954f680cc6SAli Bahrami 		{ 0x00000800,		MSG_SIGSYS_ALT },
16964f680cc6SAli Bahrami 		{ 0x00001000,		MSG_SIGPIPE_ALT },
16974f680cc6SAli Bahrami 		{ 0x00002000,		MSG_SIGALRM_ALT },
16984f680cc6SAli Bahrami 		{ 0x00004000,		MSG_SIGTERM_ALT },
16994f680cc6SAli Bahrami 		{ 0x00008000,		MSG_SIGUSR1_ALT },
17004f680cc6SAli Bahrami 		{ 0x00010000,		MSG_SIGUSR2_ALT },
17014f680cc6SAli Bahrami 		{ 0x00020000,		MSG_SIGCHLD_ALT },
17024f680cc6SAli Bahrami 		{ 0x00040000,		MSG_SIGPWR_ALT },
17034f680cc6SAli Bahrami 		{ 0x00080000,		MSG_SIGWINCH_ALT },
17044f680cc6SAli Bahrami 		{ 0x00100000,		MSG_SIGURG_ALT },
17054f680cc6SAli Bahrami 		{ 0x00200000,		MSG_SIGPOLL_ALT },
17064f680cc6SAli Bahrami 		{ 0x00400000,		MSG_SIGSTOP_ALT },
17074f680cc6SAli Bahrami 		{ 0x00800000,		MSG_SIGTSTP_ALT },
17084f680cc6SAli Bahrami 		{ 0x01000000,		MSG_SIGCONT_ALT },
17094f680cc6SAli Bahrami 		{ 0x02000000,		MSG_SIGTTIN_ALT },
17104f680cc6SAli Bahrami 		{ 0x04000000,		MSG_SIGTTOU_ALT },
17114f680cc6SAli Bahrami 		{ 0x08000000,		MSG_SIGVTALRM_ALT },
17124f680cc6SAli Bahrami 		{ 0x10000000,		MSG_SIGPROF_ALT },
17134f680cc6SAli Bahrami 		{ 0x20000000,		MSG_SIGXCPU_ALT },
17144f680cc6SAli Bahrami 		{ 0x40000000,		MSG_SIGXFSZ_ALT },
17154f680cc6SAli Bahrami 		{ 0x80000000,		MSG_SIGWAITING_ALT },
1716c6c9aed4Sab 		{ 0,			0 }
1717c6c9aed4Sab 	};
17184f680cc6SAli Bahrami 	static const Val_desc vda1[] = {
17194f680cc6SAli Bahrami 		{ 0x00000001,		MSG_SIGLWP_ALT },
17204f680cc6SAli Bahrami 		{ 0x00000002,		MSG_SIGFREEZE_ALT },
17214f680cc6SAli Bahrami 		{ 0x00000004,		MSG_SIGTHAW_ALT },
17224f680cc6SAli Bahrami 		{ 0x00000008,		MSG_SIGCANCEL_ALT },
17234f680cc6SAli Bahrami 		{ 0x00000010,		MSG_SIGLOST_ALT },
17244f680cc6SAli Bahrami 		{ 0x00000020,		MSG_SIGXRES_ALT },
17254f680cc6SAli Bahrami 		{ 0x00000040,		MSG_SIGJVM1_ALT },
17264f680cc6SAli Bahrami 		{ 0x00000080,		MSG_SIGJVM2_ALT },
1727c6c9aed4Sab 		{ 0,			0 }
1728c6c9aed4Sab 	};
17294f680cc6SAli Bahrami 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
1730c6c9aed4Sab 		{ vda0, 0 },
1731c6c9aed4Sab 		{ vda1, 0xffffff00 },
1732c6c9aed4Sab 		{ NULL, 0xffffffff },
1733c6c9aed4Sab 		{ NULL, 0xffffffff }
1734c6c9aed4Sab 	};
1735c6c9aed4Sab 
1736c6c9aed4Sab 	if (n_mask > N_MASK)
1737c6c9aed4Sab 		n_mask = N_MASK;
1738c6c9aed4Sab 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
1739c6c9aed4Sab 	    cnote_sigset_buf->buf, CONV_CNOTE_SIGSET_BUFSIZE));
1740c6c9aed4Sab 
1741c6c9aed4Sab #undef N_MASK
1742c6c9aed4Sab }
1743c6c9aed4Sab 
1744c6c9aed4Sab 
1745c6c9aed4Sab #define	FLTSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1746c6c9aed4Sab 	/* \
1747c6c9aed4Sab 	 * fltset_t[0] - Faults [1 - 32] \
1748c6c9aed4Sab 	 * There are 19 unused bits, each of which needs two \
1749c6c9aed4Sab 	 * characters plus a separator. \
1750c6c9aed4Sab 	 */ \
1751c6c9aed4Sab 	MSG_FLTILL_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1752c6c9aed4Sab 	MSG_FLTPRIV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1753c6c9aed4Sab 	MSG_FLTBPT_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1754c6c9aed4Sab 	MSG_FLTTRACE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1755c6c9aed4Sab 	MSG_FLTACCESS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1756c6c9aed4Sab 	MSG_FLTBOUNDS_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1757c6c9aed4Sab 	MSG_FLTIOVF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1758c6c9aed4Sab 	MSG_FLTIZDIV_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1759c6c9aed4Sab 	MSG_FLTFPE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1760c6c9aed4Sab 	MSG_FLTSTACK_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1761c6c9aed4Sab 	MSG_FLTPAGE_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1762c6c9aed4Sab 	MSG_FLTWATCH_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1763c6c9aed4Sab 	MSG_FLTCPCOVF_ALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1764c6c9aed4Sab 	(19 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1765c6c9aed4Sab 	/* \
1766c6c9aed4Sab 	 * fltset_t [1] - Faults [33 - 64] \
1767c6c9aed4Sab 	 * There are 32 unused bits, each of which needs two \
1768c6c9aed4Sab 	 * characters plus a separator. \
1769c6c9aed4Sab 	 */ \
1770c6c9aed4Sab 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1771c6c9aed4Sab 	/* \
1772c6c9aed4Sab 	 * fltset_t [2] - Faults [65 - 96] \
1773c6c9aed4Sab 	 * There are 32 unused bits, each of which needs two \
1774c6c9aed4Sab 	 * characters plus a separator. \
1775c6c9aed4Sab 	 */ \
1776c6c9aed4Sab 	(32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1777c6c9aed4Sab 	/* \
1778c6c9aed4Sab 	 * fltset_t [3] - Faults [97 - 128] \
1779c6c9aed4Sab 	 * There are 32 unused bits. Three of these need two \
1780c6c9aed4Sab 	 * characters, and 29 need 3. Each one needs a separator. \
1781c6c9aed4Sab 	 */ \
1782c6c9aed4Sab 	(3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1783c6c9aed4Sab 	(29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1784c6c9aed4Sab 	\
1785c6c9aed4Sab 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1786c6c9aed4Sab 
1787c6c9aed4Sab /*
1788c6c9aed4Sab  * Ensure that Conv_cnote_fltset_buf_t is large enough:
1789c6c9aed4Sab  *
1790c6c9aed4Sab  * FLTSET_FLAGSZ is the real minimum size of the buffer required by
1791c6c9aed4Sab  * conv_cnote_fltset(). However, Conv_cnote_fltset_buf_t
1792c6c9aed4Sab  * uses CONV_CNOTE_FLTSET_BUFSIZE to set the buffer size. We do
1793c6c9aed4Sab  * things this way because the definition of FLTSET_FLAGSZ uses information
1794c6c9aed4Sab  * that is not available in the environment of other programs
1795c6c9aed4Sab  * that include the conv.h header file.
1796c6c9aed4Sab  */
1797c6c9aed4Sab #if (CONV_CNOTE_FLTSET_BUFSIZE != FLTSET_FLAGSZ) && !defined(__lint)
1798c6c9aed4Sab #define	REPORT_BUFSIZE FLTSET_FLAGSZ
1799c6c9aed4Sab #include "report_bufsize.h"
1800c6c9aed4Sab #error "CONV_CNOTE_FLTSET_BUFSIZE does not match FLTSET_FLAGSZ"
1801c6c9aed4Sab #endif
1802c6c9aed4Sab 
1803c6c9aed4Sab const char *
conv_cnote_fltset(uint32_t * maskarr,int n_mask,Conv_fmt_flags_t fmt_flags,Conv_cnote_fltset_buf_t * cnote_fltset_buf)1804c6c9aed4Sab conv_cnote_fltset(uint32_t *maskarr, int n_mask,
1805c6c9aed4Sab     Conv_fmt_flags_t fmt_flags, Conv_cnote_fltset_buf_t *cnote_fltset_buf)
1806c6c9aed4Sab {
1807c6c9aed4Sab #define	N_MASK 4
1808c6c9aed4Sab 
18094f680cc6SAli Bahrami 	static const Val_desc vda0[] = {
18104f680cc6SAli Bahrami 		{ 0x00000001,		MSG_FLTILL_ALT },
18114f680cc6SAli Bahrami 		{ 0x00000002,		MSG_FLTPRIV_ALT },
18124f680cc6SAli Bahrami 		{ 0x00000004,		MSG_FLTBPT_ALT },
18134f680cc6SAli Bahrami 		{ 0x00000008,		MSG_FLTTRACE_ALT },
18144f680cc6SAli Bahrami 		{ 0x00000010,		MSG_FLTACCESS_ALT },
18154f680cc6SAli Bahrami 		{ 0x00000020,		MSG_FLTBOUNDS_ALT },
18164f680cc6SAli Bahrami 		{ 0x00000040,		MSG_FLTIOVF_ALT },
18174f680cc6SAli Bahrami 		{ 0x00000080,		MSG_FLTIZDIV_ALT },
18184f680cc6SAli Bahrami 		{ 0x00000100,		MSG_FLTFPE_ALT },
18194f680cc6SAli Bahrami 		{ 0x00000200,		MSG_FLTSTACK_ALT },
18204f680cc6SAli Bahrami 		{ 0x00000400,		MSG_FLTPAGE_ALT },
18214f680cc6SAli Bahrami 		{ 0x00000800,		MSG_FLTWATCH_ALT },
18224f680cc6SAli Bahrami 		{ 0x00001000,		MSG_FLTCPCOVF_ALT },
1823c6c9aed4Sab 		{ 0,			0 }
1824c6c9aed4Sab 	};
18254f680cc6SAli Bahrami 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
1826c6c9aed4Sab 		{ vda0, 0xffffe000 },
1827c6c9aed4Sab 		{ NULL, 0xffffffff },
1828c6c9aed4Sab 		{ NULL, 0xffffffff },
1829c6c9aed4Sab 		{ NULL, 0xffffffff }
1830c6c9aed4Sab 	};
1831c6c9aed4Sab 
1832c6c9aed4Sab 	if (n_mask > N_MASK)
1833c6c9aed4Sab 		n_mask = N_MASK;
1834c6c9aed4Sab 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
1835c6c9aed4Sab 	    cnote_fltset_buf->buf, CONV_CNOTE_FLTSET_BUFSIZE));
1836c6c9aed4Sab 
1837c6c9aed4Sab #undef N_MASK
1838c6c9aed4Sab }
1839c6c9aed4Sab 
1840c6c9aed4Sab 
1841c6c9aed4Sab 
1842c6c9aed4Sab #define	SYSSET_FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1843c6c9aed4Sab 	(512 * CONV_EXPN_FIELD_DEF_SEP_SIZE) + \
1844c6c9aed4Sab 	\
1845c6c9aed4Sab 	/* sysset_t[0] - System Calls [1 - 32] */ \
1846c6c9aed4Sab 	MSG_SYS_EXIT_ALT_SIZE			/* 1 */ + \
18478fd04b83SRoger A. Faulkner 	MSG_SYS_2_SIZE				/* 2 (unused) */ + \
1848c6c9aed4Sab 	MSG_SYS_READ_ALT_SIZE			/* 3 */ + \
1849c6c9aed4Sab 	MSG_SYS_WRITE_ALT_SIZE			/* 4 */ + \
1850c6c9aed4Sab 	MSG_SYS_OPEN_ALT_SIZE			/* 5 */ + \
1851c6c9aed4Sab 	MSG_SYS_CLOSE_ALT_SIZE			/* 6 */ + \
18528fd04b83SRoger A. Faulkner 	MSG_SYS_7_SIZE				/* 7 (unused) */ + \
18538fd04b83SRoger A. Faulkner 	MSG_SYS_8_SIZE				/* 8 (unused) */ + \
1854c6c9aed4Sab 	MSG_SYS_LINK_ALT_SIZE			/* 9 */ + \
1855c6c9aed4Sab 	MSG_SYS_UNLINK_ALT_SIZE			/* 10 */ + \
18568fd04b83SRoger A. Faulkner 	MSG_SYS_11_SIZE				/* 11 (unused) */ + \
1857c6c9aed4Sab 	MSG_SYS_CHDIR_ALT_SIZE			/* 12 */ + \
1858c6c9aed4Sab 	MSG_SYS_TIME_ALT_SIZE			/* 13 */ + \
1859c6c9aed4Sab 	MSG_SYS_MKNOD_ALT_SIZE			/* 14 */ + \
1860c6c9aed4Sab 	MSG_SYS_CHMOD_ALT_SIZE			/* 15 */ + \
1861c6c9aed4Sab 	MSG_SYS_CHOWN_ALT_SIZE			/* 16 */ + \
1862c6c9aed4Sab 	MSG_SYS_BRK_ALT_SIZE			/* 17 */ + \
1863c6c9aed4Sab 	MSG_SYS_STAT_ALT_SIZE			/* 18 */ + \
1864c6c9aed4Sab 	MSG_SYS_LSEEK_ALT_SIZE			/* 19 */ + \
1865c6c9aed4Sab 	MSG_SYS_GETPID_ALT_SIZE			/* 20 */ + \
1866c6c9aed4Sab 	MSG_SYS_MOUNT_ALT_SIZE			/* 21 */ + \
18678fd04b83SRoger A. Faulkner 	MSG_SYS_22_SIZE				/* 22 (unused) */ + \
1868c6c9aed4Sab 	MSG_SYS_SETUID_ALT_SIZE			/* 23 */ + \
1869c6c9aed4Sab 	MSG_SYS_GETUID_ALT_SIZE			/* 24 */ + \
1870c6c9aed4Sab 	MSG_SYS_STIME_ALT_SIZE			/* 25 */ + \
1871c6c9aed4Sab 	MSG_SYS_PCSAMPLE_ALT_SIZE		/* 26 */ + \
1872c6c9aed4Sab 	MSG_SYS_ALARM_ALT_SIZE			/* 27 */ + \
1873c6c9aed4Sab 	MSG_SYS_FSTAT_ALT_SIZE			/* 28 */ + \
1874c6c9aed4Sab 	MSG_SYS_PAUSE_ALT_SIZE			/* 29 */ + \
18758fd04b83SRoger A. Faulkner 	MSG_SYS_30_SIZE				/* 30 (unused) */ + \
1876c6c9aed4Sab 	MSG_SYS_STTY_ALT_SIZE			/* 31 */ + \
1877c6c9aed4Sab 	MSG_SYS_GTTY_ALT_SIZE			/* 32 */ + \
1878c6c9aed4Sab 	\
1879c6c9aed4Sab 	/* sysset_t[1] - System Calls [33 - 64] */ \
1880c6c9aed4Sab 	MSG_SYS_ACCESS_ALT_SIZE			/* 33 */ + \
1881c6c9aed4Sab 	MSG_SYS_NICE_ALT_SIZE			/* 34 */ + \
1882c6c9aed4Sab 	MSG_SYS_STATFS_ALT_SIZE			/* 35 */ + \
1883c6c9aed4Sab 	MSG_SYS_SYNC_ALT_SIZE			/* 36 */ + \
1884c6c9aed4Sab 	MSG_SYS_KILL_ALT_SIZE			/* 37 */ + \
1885c6c9aed4Sab 	MSG_SYS_FSTATFS_ALT_SIZE		/* 38 */ + \
1886c6c9aed4Sab 	MSG_SYS_PGRPSYS_ALT_SIZE		/* 39 */ + \
1887c6c9aed4Sab 	MSG_SYS_UUCOPYSTR_ALT_SIZE		/* 40 */ + \
18888fd04b83SRoger A. Faulkner 	MSG_SYS_41_SIZE				/* 41 (unused) */ + \
1889c6c9aed4Sab 	MSG_SYS_PIPE_ALT_SIZE			/* 42 */ + \
1890c6c9aed4Sab 	MSG_SYS_TIMES_ALT_SIZE			/* 43 */ + \
1891c6c9aed4Sab 	MSG_SYS_PROFIL_ALT_SIZE			/* 44 */ + \
18928fd04b83SRoger A. Faulkner 	MSG_SYS_FACCESSAT_ALT_SIZE		/* 45 */ + \
1893c6c9aed4Sab 	MSG_SYS_SETGID_ALT_SIZE			/* 46 */ + \
1894c6c9aed4Sab 	MSG_SYS_GETGID_ALT_SIZE			/* 47 */ + \
18958fd04b83SRoger A. Faulkner 	MSG_SYS_48_SIZE				/* 48 (unused) */ + \
1896c6c9aed4Sab 	MSG_SYS_MSGSYS_ALT_SIZE			/* 49 */ + \
1897c6c9aed4Sab 	MSG_SYS_SYSI86_ALT_SIZE			/* 50 */ + \
1898c6c9aed4Sab 	MSG_SYS_ACCT_ALT_SIZE			/* 51 */ + \
1899c6c9aed4Sab 	MSG_SYS_SHMSYS_ALT_SIZE			/* 52 */ + \
1900c6c9aed4Sab 	MSG_SYS_SEMSYS_ALT_SIZE			/* 53 */ + \
1901c6c9aed4Sab 	MSG_SYS_IOCTL_ALT_SIZE			/* 54 */ + \
1902c6c9aed4Sab 	MSG_SYS_UADMIN_ALT_SIZE			/* 55 */ + \
19038fd04b83SRoger A. Faulkner 	MSG_SYS_FCHOWNAT_ALT_SIZE		/* 56 */ + \
1904c6c9aed4Sab 	MSG_SYS_UTSSYS_ALT_SIZE			/* 57 */ + \
1905c6c9aed4Sab 	MSG_SYS_FDSYNC_ALT_SIZE			/* 58 */ + \
1906c6c9aed4Sab 	MSG_SYS_EXECVE_ALT_SIZE			/* 59 */ + \
1907c6c9aed4Sab 	MSG_SYS_UMASK_ALT_SIZE			/* 60 */ + \
1908c6c9aed4Sab 	MSG_SYS_CHROOT_ALT_SIZE			/* 61 */ + \
1909c6c9aed4Sab 	MSG_SYS_FCNTL_ALT_SIZE			/* 62 */ + \
1910c6c9aed4Sab 	MSG_SYS_ULIMIT_ALT_SIZE			/* 63 */ + \
19118fd04b83SRoger A. Faulkner 	MSG_SYS_RENAMEAT_ALT_SIZE		/* 64 */ + \
1912c6c9aed4Sab 	\
1913c6c9aed4Sab 	/* sysset_t[2] - System Calls [65 - 96] */ \
19148fd04b83SRoger A. Faulkner 	MSG_SYS_UNLINKAT_ALT_SIZE		/* 65 */ + \
19158fd04b83SRoger A. Faulkner 	MSG_SYS_FSTATAT_ALT_SIZE		/* 66 */ + \
19168fd04b83SRoger A. Faulkner 	MSG_SYS_FSTATAT64_ALT_SIZE		/* 67 */ + \
19178fd04b83SRoger A. Faulkner 	MSG_SYS_OPENAT_ALT_SIZE			/* 68 */ + \
19188fd04b83SRoger A. Faulkner 	MSG_SYS_OPENAT64_ALT_SIZE		/* 69 */ + \
1919c6c9aed4Sab 	MSG_SYS_TASKSYS_ALT_SIZE		/* 70 */ + \
1920c6c9aed4Sab 	MSG_SYS_ACCTCTL_ALT_SIZE		/* 71 */ + \
1921c6c9aed4Sab 	MSG_SYS_EXACCTSYS_ALT_SIZE		/* 72 */ + \
1922c6c9aed4Sab 	MSG_SYS_GETPAGESIZES_ALT_SIZE		/* 73 */ + \
1923c6c9aed4Sab 	MSG_SYS_RCTLSYS_ALT_SIZE		/* 74 */ + \
1924c6c9aed4Sab 	MSG_SYS_SIDSYS_ALT_SIZE			/* 75 */ + \
19258fd04b83SRoger A. Faulkner 	MSG_SYS_76_SIZE				/* 76 (unused) */ + \
1926c6c9aed4Sab 	MSG_SYS_LWP_PARK_ALT_SIZE		/* 77 */ + \
1927c6c9aed4Sab 	MSG_SYS_SENDFILEV_ALT_SIZE		/* 78 */ + \
1928c6c9aed4Sab 	MSG_SYS_RMDIR_ALT_SIZE			/* 79 */ + \
1929c6c9aed4Sab 	MSG_SYS_MKDIR_ALT_SIZE			/* 80 */ + \
1930c6c9aed4Sab 	MSG_SYS_GETDENTS_ALT_SIZE		/* 81 */ + \
1931c6c9aed4Sab 	MSG_SYS_PRIVSYS_ALT_SIZE		/* 82 */ + \
1932c6c9aed4Sab 	MSG_SYS_UCREDSYS_ALT_SIZE		/* 83 */ + \
1933c6c9aed4Sab 	MSG_SYS_SYSFS_ALT_SIZE			/* 84 */ + \
1934c6c9aed4Sab 	MSG_SYS_GETMSG_ALT_SIZE			/* 85 */ + \
1935c6c9aed4Sab 	MSG_SYS_PUTMSG_ALT_SIZE			/* 86 */ + \
19368fd04b83SRoger A. Faulkner 	MSG_SYS_87_SIZE				/* 87 (unused) */ + \
1937c6c9aed4Sab 	MSG_SYS_LSTAT_ALT_SIZE			/* 88 */ + \
1938c6c9aed4Sab 	MSG_SYS_SYMLINK_ALT_SIZE		/* 89 */ + \
1939c6c9aed4Sab 	MSG_SYS_READLINK_ALT_SIZE		/* 90 */ + \
1940c6c9aed4Sab 	MSG_SYS_SETGROUPS_ALT_SIZE		/* 91 */ + \
1941c6c9aed4Sab 	MSG_SYS_GETGROUPS_ALT_SIZE		/* 92 */ + \
1942c6c9aed4Sab 	MSG_SYS_FCHMOD_ALT_SIZE			/* 93 */ + \
1943c6c9aed4Sab 	MSG_SYS_FCHOWN_ALT_SIZE			/* 94 */ + \
1944c6c9aed4Sab 	MSG_SYS_SIGPROCMASK_ALT_SIZE		/* 95 */ + \
1945c6c9aed4Sab 	MSG_SYS_SIGSUSPEND_ALT_SIZE		/* 96 */ + \
1946c6c9aed4Sab 	\
1947c6c9aed4Sab 	/* sysset_t[3] - System Calls [97 - 128] */ \
1948c6c9aed4Sab 	MSG_SYS_SIGALTSTACK_ALT_SIZE		/* 97 */ + \
1949c6c9aed4Sab 	MSG_SYS_SIGACTION_ALT_SIZE		/* 98 */ + \
1950c6c9aed4Sab 	MSG_SYS_SIGPENDING_ALT_SIZE		/* 99 */ + \
1951c6c9aed4Sab 	MSG_SYS_CONTEXT_ALT_SIZE		/* 100 */ + \
19528fd04b83SRoger A. Faulkner 	MSG_SYS_101_SIZE			/* 101 (unused) */ + \
19538fd04b83SRoger A. Faulkner 	MSG_SYS_102_SIZE			/* 102 (unused) */ + \
1954c6c9aed4Sab 	MSG_SYS_STATVFS_ALT_SIZE		/* 103 */ + \
1955c6c9aed4Sab 	MSG_SYS_FSTATVFS_ALT_SIZE		/* 104 */ + \
1956c6c9aed4Sab 	MSG_SYS_GETLOADAVG_ALT_SIZE		/* 105 */ + \
1957c6c9aed4Sab 	MSG_SYS_NFSSYS_ALT_SIZE			/* 106 */ + \
1958c6c9aed4Sab 	MSG_SYS_WAITID_ALT_SIZE			/* 107 */ + \
1959c6c9aed4Sab 	MSG_SYS_SIGSENDSYS_ALT_SIZE		/* 108 */ + \
1960c6c9aed4Sab 	MSG_SYS_HRTSYS_ALT_SIZE			/* 109 */ + \
19618fd04b83SRoger A. Faulkner 	MSG_SYS_UTIMESYS_ALT_SIZE		/* 110 */ + \
1962c6c9aed4Sab 	MSG_SYS_SIGRESEND_ALT_SIZE		/* 111 */ + \
1963c6c9aed4Sab 	MSG_SYS_PRIOCNTLSYS_ALT_SIZE		/* 112 */ + \
1964c6c9aed4Sab 	MSG_SYS_PATHCONF_ALT_SIZE		/* 113 */ + \
1965c6c9aed4Sab 	MSG_SYS_MINCORE_ALT_SIZE		/* 114 */ + \
1966c6c9aed4Sab 	MSG_SYS_MMAP_ALT_SIZE			/* 115 */ + \
1967c6c9aed4Sab 	MSG_SYS_MPROTECT_ALT_SIZE		/* 116 */ + \
1968c6c9aed4Sab 	MSG_SYS_MUNMAP_ALT_SIZE			/* 117 */ + \
1969c6c9aed4Sab 	MSG_SYS_FPATHCONF_ALT_SIZE		/* 118 */ + \
1970c6c9aed4Sab 	MSG_SYS_VFORK_ALT_SIZE			/* 119 */ + \
1971c6c9aed4Sab 	MSG_SYS_FCHDIR_ALT_SIZE			/* 120 */ + \
1972c6c9aed4Sab 	MSG_SYS_READV_ALT_SIZE			/* 121 */ + \
1973c6c9aed4Sab 	MSG_SYS_WRITEV_ALT_SIZE			/* 122 */ + \
1974350ffdd5SRobert Mustacchi 	MSG_SYS_PREADV_SIZE			/* 123 */ + \
1975350ffdd5SRobert Mustacchi 	MSG_SYS_PWRITEV_SIZE			/* 124 */ + \
1976350ffdd5SRobert Mustacchi 	MSG_SYS_UPANIC_SIZE			/* 125 */ + \
1977350ffdd5SRobert Mustacchi 	MSG_SYS_GETRANDOM_SIZE			/* 126 */ + \
19788fd04b83SRoger A. Faulkner 	MSG_SYS_MMAPOBJ_ALT_SIZE		/* 127 */ + \
1979c6c9aed4Sab 	MSG_SYS_SETRLIMIT_ALT_SIZE		/* 128 */ + \
1980c6c9aed4Sab 	\
1981c6c9aed4Sab 	/* sysset_t[4] - System Calls [129 - 160] */ \
1982c6c9aed4Sab 	MSG_SYS_GETRLIMIT_ALT_SIZE		/* 129 */ + \
1983c6c9aed4Sab 	MSG_SYS_LCHOWN_ALT_SIZE			/* 130 */ + \
1984c6c9aed4Sab 	MSG_SYS_MEMCNTL_ALT_SIZE		/* 131 */ + \
1985c6c9aed4Sab 	MSG_SYS_GETPMSG_ALT_SIZE		/* 132 */ + \
1986c6c9aed4Sab 	MSG_SYS_PUTPMSG_ALT_SIZE		/* 133 */ + \
1987c6c9aed4Sab 	MSG_SYS_RENAME_ALT_SIZE			/* 134 */ + \
1988c6c9aed4Sab 	MSG_SYS_UNAME_ALT_SIZE			/* 135 */ + \
1989c6c9aed4Sab 	MSG_SYS_SETEGID_ALT_SIZE		/* 136 */ + \
1990c6c9aed4Sab 	MSG_SYS_SYSCONFIG_ALT_SIZE		/* 137 */ + \
1991c6c9aed4Sab 	MSG_SYS_ADJTIME_ALT_SIZE		/* 138 */ + \
1992c6c9aed4Sab 	MSG_SYS_SYSTEMINFO_ALT_SIZE		/* 139 */ + \
1993c6c9aed4Sab 	MSG_SYS_SHAREFS_ALT_SIZE		/* 140 */ + \
1994c6c9aed4Sab 	MSG_SYS_SETEUID_ALT_SIZE		/* 141 */ + \
1995c6c9aed4Sab 	MSG_SYS_FORKSYS_ALT_SIZE		/* 142 */ + \
19968fd04b83SRoger A. Faulkner 	MSG_SYS_143_SIZE			/* 143 (unused) */ + \
1997c6c9aed4Sab 	MSG_SYS_SIGTIMEDWAIT_ALT_SIZE		/* 144 */ + \
1998c6c9aed4Sab 	MSG_SYS_LWP_INFO_ALT_SIZE		/* 145 */ + \
1999c6c9aed4Sab 	MSG_SYS_YIELD_ALT_SIZE			/* 146 */ + \
20008fd04b83SRoger A. Faulkner 	MSG_SYS_147_SIZE			/* 147 (unused) */ + \
2001c6c9aed4Sab 	MSG_SYS_LWP_SEMA_POST_ALT_SIZE		/* 148 */ + \
2002c6c9aed4Sab 	MSG_SYS_LWP_SEMA_TRYWAIT_ALT_SIZE	/* 149 */ + \
2003c6c9aed4Sab 	MSG_SYS_LWP_DETACH_ALT_SIZE		/* 150 */ + \
2004c6c9aed4Sab 	MSG_SYS_CORECTL_ALT_SIZE		/* 151 */ + \
2005c6c9aed4Sab 	MSG_SYS_MODCTL_ALT_SIZE			/* 152 */ + \
2006c6c9aed4Sab 	MSG_SYS_FCHROOT_ALT_SIZE		/* 153 */ + \
20078fd04b83SRoger A. Faulkner 	MSG_SYS_154_SIZE			/* 154 (unused) */ + \
2008c6c9aed4Sab 	MSG_SYS_VHANGUP_ALT_SIZE		/* 155 */ + \
2009c6c9aed4Sab 	MSG_SYS_GETTIMEOFDAY_ALT_SIZE		/* 156 */ + \
2010c6c9aed4Sab 	MSG_SYS_GETITIMER_ALT_SIZE		/* 157 */ + \
2011c6c9aed4Sab 	MSG_SYS_SETITIMER_ALT_SIZE		/* 158 */ + \
2012c6c9aed4Sab 	MSG_SYS_LWP_CREATE_ALT_SIZE		/* 159 */ + \
2013c6c9aed4Sab 	MSG_SYS_LWP_EXIT_ALT_SIZE		/* 160 */ + \
2014c6c9aed4Sab 	\
2015c6c9aed4Sab 	/* sysset_t[5] - System Calls [161 - 192] */ \
2016c6c9aed4Sab 	MSG_SYS_LWP_SUSPEND_ALT_SIZE		/* 161 */ + \
2017c6c9aed4Sab 	MSG_SYS_LWP_CONTINUE_ALT_SIZE		/* 162 */ + \
2018c6c9aed4Sab 	MSG_SYS_LWP_KILL_ALT_SIZE		/* 163 */ + \
2019c6c9aed4Sab 	MSG_SYS_LWP_SELF_ALT_SIZE		/* 164 */ + \
2020c6c9aed4Sab 	MSG_SYS_LWP_SIGMASK_ALT_SIZE		/* 165 */ + \
2021c6c9aed4Sab 	MSG_SYS_LWP_PRIVATE_ALT_SIZE		/* 166 */ + \
2022c6c9aed4Sab 	MSG_SYS_LWP_WAIT_ALT_SIZE		/* 167 */ + \
2023c6c9aed4Sab 	MSG_SYS_LWP_MUTEX_WAKEUP_ALT_SIZE	/* 168 */ + \
20248fd04b83SRoger A. Faulkner 	MSG_SYS_169_SIZE			/* 169 (unused) */ + \
2025c6c9aed4Sab 	MSG_SYS_LWP_COND_WAIT_ALT_SIZE		/* 170 */ + \
2026c6c9aed4Sab 	MSG_SYS_LWP_COND_SIGNAL_ALT_SIZE	/* 171 */ + \
2027c6c9aed4Sab 	MSG_SYS_LWP_COND_BROADCAST_ALT_SIZE	/* 172 */ + \
2028c6c9aed4Sab 	MSG_SYS_PREAD_ALT_SIZE			/* 173 */ + \
2029c6c9aed4Sab 	MSG_SYS_PWRITE_ALT_SIZE			/* 174 */ + \
2030c6c9aed4Sab 	MSG_SYS_LLSEEK_ALT_SIZE			/* 175 */ + \
2031c6c9aed4Sab 	MSG_SYS_INST_SYNC_ALT_SIZE		/* 176 */ + \
2032c6c9aed4Sab 	MSG_SYS_BRAND_ALT_SIZE			/* 177 */ + \
2033c6c9aed4Sab 	MSG_SYS_KAIO_ALT_SIZE			/* 178 */ + \
2034c6c9aed4Sab 	MSG_SYS_CPC_ALT_SIZE			/* 179 */ + \
2035c6c9aed4Sab 	MSG_SYS_LGRPSYS_ALT_SIZE		/* 180 */ + \
2036c6c9aed4Sab 	MSG_SYS_RUSAGESYS_ALT_SIZE		/* 181 */ + \
2037c6c9aed4Sab 	MSG_SYS_PORT_ALT_SIZE			/* 182 */ + \
2038c6c9aed4Sab 	MSG_SYS_POLLSYS_ALT_SIZE		/* 183 */ + \
2039c6c9aed4Sab 	MSG_SYS_LABELSYS_ALT_SIZE		/* 184 */ + \
2040c6c9aed4Sab 	MSG_SYS_ACL_ALT_SIZE			/* 185 */ + \
2041c6c9aed4Sab 	MSG_SYS_AUDITSYS_ALT_SIZE		/* 186 */ + \
2042c6c9aed4Sab 	MSG_SYS_PROCESSOR_BIND_ALT_SIZE		/* 187 */ + \
2043c6c9aed4Sab 	MSG_SYS_PROCESSOR_INFO_ALT_SIZE		/* 188 */ + \
2044c6c9aed4Sab 	MSG_SYS_P_ONLINE_ALT_SIZE		/* 189 */ + \
2045c6c9aed4Sab 	MSG_SYS_SIGQUEUE_ALT_SIZE		/* 190 */ + \
2046c6c9aed4Sab 	MSG_SYS_CLOCK_GETTIME_ALT_SIZE		/* 191 */ + \
2047c6c9aed4Sab 	MSG_SYS_CLOCK_SETTIME_ALT_SIZE		/* 192 */ + \
2048c6c9aed4Sab 	\
2049c6c9aed4Sab 	/* sysset_t[6] - System Calls [193 - 224] */ \
2050c6c9aed4Sab 	MSG_SYS_CLOCK_GETRES_ALT_SIZE		/* 193 */ + \
2051c6c9aed4Sab 	MSG_SYS_TIMER_CREATE_ALT_SIZE		/* 194 */ + \
2052c6c9aed4Sab 	MSG_SYS_TIMER_DELETE_ALT_SIZE		/* 195 */ + \
2053c6c9aed4Sab 	MSG_SYS_TIMER_SETTIME_ALT_SIZE		/* 196 */ + \
2054c6c9aed4Sab 	MSG_SYS_TIMER_GETTIME_ALT_SIZE		/* 197 */ + \
2055c6c9aed4Sab 	MSG_SYS_TIMER_GETOVERRUN_ALT_SIZE	/* 198 */ + \
2056c6c9aed4Sab 	MSG_SYS_NANOSLEEP_ALT_SIZE		/* 199 */ + \
2057c6c9aed4Sab 	MSG_SYS_FACL_ALT_SIZE			/* 200 */ + \
2058c6c9aed4Sab 	MSG_SYS_DOOR_ALT_SIZE			/* 201 */ + \
2059c6c9aed4Sab 	MSG_SYS_SETREUID_ALT_SIZE		/* 202 */ + \
2060c6c9aed4Sab 	MSG_SYS_SETREGID_ALT_SIZE		/* 203 */ + \
2061c6c9aed4Sab 	MSG_SYS_INSTALL_UTRAP_ALT_SIZE		/* 204 */ + \
2062c6c9aed4Sab 	MSG_SYS_SIGNOTIFY_ALT_SIZE		/* 205 */ + \
2063c6c9aed4Sab 	MSG_SYS_SCHEDCTL_ALT_SIZE		/* 206 */ + \
2064c6c9aed4Sab 	MSG_SYS_PSET_ALT_SIZE			/* 207 */ + \
2065c6c9aed4Sab 	MSG_SYS_SPARC_UTRAP_INSTALL_ALT_SIZE	/* 208 */ + \
2066c6c9aed4Sab 	MSG_SYS_RESOLVEPATH_ALT_SIZE		/* 209 */ + \
2067c6c9aed4Sab 	MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT_SIZE	/* 210 */ + \
2068c6c9aed4Sab 	MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT_SIZE	/* 211 */ + \
2069c6c9aed4Sab 	MSG_SYS_LWP_RWLOCK_SYS_ALT_SIZE		/* 212 */ + \
2070c6c9aed4Sab 	MSG_SYS_GETDENTS64_ALT_SIZE		/* 213 */ + \
2071c6c9aed4Sab 	MSG_SYS_MMAP64_ALT_SIZE			/* 214 */ + \
2072c6c9aed4Sab 	MSG_SYS_STAT64_ALT_SIZE			/* 215 */ + \
2073c6c9aed4Sab 	MSG_SYS_LSTAT64_ALT_SIZE		/* 216 */ + \
2074c6c9aed4Sab 	MSG_SYS_FSTAT64_ALT_SIZE		/* 217 */ + \
2075c6c9aed4Sab 	MSG_SYS_STATVFS64_ALT_SIZE		/* 218 */ + \
2076c6c9aed4Sab 	MSG_SYS_FSTATVFS64_ALT_SIZE		/* 219 */ + \
2077c6c9aed4Sab 	MSG_SYS_SETRLIMIT64_ALT_SIZE		/* 220 */ + \
2078c6c9aed4Sab 	MSG_SYS_GETRLIMIT64_ALT_SIZE		/* 221 */ + \
2079c6c9aed4Sab 	MSG_SYS_PREAD64_ALT_SIZE		/* 222 */ + \
2080c6c9aed4Sab 	MSG_SYS_PWRITE64_ALT_SIZE		/* 223 */ + \
20818fd04b83SRoger A. Faulkner 	MSG_SYS_224_SIZE			/* 224 (unused) */ + \
2082c6c9aed4Sab 	\
2083c6c9aed4Sab 	/* sysset_t[7] - System Calls [225 - 256] */ \
2084c6c9aed4Sab 	MSG_SYS_OPEN64_ALT_SIZE			/* 225 */ + \
2085c6c9aed4Sab 	MSG_SYS_RPCSYS_ALT_SIZE			/* 226 */ + \
2086c6c9aed4Sab 	MSG_SYS_ZONE_ALT_SIZE			/* 227 */ + \
2087c6c9aed4Sab 	MSG_SYS_AUTOFSSYS_ALT_SIZE		/* 228 */ + \
2088c6c9aed4Sab 	MSG_SYS_GETCWD_ALT_SIZE			/* 229 */ + \
2089c6c9aed4Sab 	MSG_SYS_SO_SOCKET_ALT_SIZE		/* 230 */ + \
2090c6c9aed4Sab 	MSG_SYS_SO_SOCKETPAIR_ALT_SIZE		/* 231 */ + \
2091c6c9aed4Sab 	MSG_SYS_BIND_ALT_SIZE			/* 232 */ + \
2092c6c9aed4Sab 	MSG_SYS_LISTEN_ALT_SIZE			/* 233 */ + \
2093c6c9aed4Sab 	MSG_SYS_ACCEPT_ALT_SIZE			/* 234 */ + \
2094c6c9aed4Sab 	MSG_SYS_CONNECT_ALT_SIZE		/* 235 */ + \
2095c6c9aed4Sab 	MSG_SYS_SHUTDOWN_ALT_SIZE		/* 236 */ + \
2096c6c9aed4Sab 	MSG_SYS_RECV_ALT_SIZE			/* 237 */ + \
2097c6c9aed4Sab 	MSG_SYS_RECVFROM_ALT_SIZE		/* 238 */ + \
2098c6c9aed4Sab 	MSG_SYS_RECVMSG_ALT_SIZE		/* 239 */ + \
2099c6c9aed4Sab 	MSG_SYS_SEND_ALT_SIZE			/* 240 */ + \
2100c6c9aed4Sab 	MSG_SYS_SENDMSG_ALT_SIZE		/* 241 */ + \
2101c6c9aed4Sab 	MSG_SYS_SENDTO_ALT_SIZE			/* 242 */ + \
2102c6c9aed4Sab 	MSG_SYS_GETPEERNAME_ALT_SIZE		/* 243 */ + \
2103c6c9aed4Sab 	MSG_SYS_GETSOCKNAME_ALT_SIZE		/* 244 */ + \
2104c6c9aed4Sab 	MSG_SYS_GETSOCKOPT_ALT_SIZE		/* 245 */ + \
2105c6c9aed4Sab 	MSG_SYS_SETSOCKOPT_ALT_SIZE		/* 246 */ + \
2106c6c9aed4Sab 	MSG_SYS_SOCKCONFIG_ALT_SIZE		/* 247 */ + \
2107c6c9aed4Sab 	MSG_SYS_NTP_GETTIME_ALT_SIZE		/* 248 */ + \
2108c6c9aed4Sab 	MSG_SYS_NTP_ADJTIME_ALT_SIZE		/* 249 */ + \
2109c6c9aed4Sab 	MSG_SYS_LWP_MUTEX_UNLOCK_ALT_SIZE	/* 250 */ + \
2110c6c9aed4Sab 	MSG_SYS_LWP_MUTEX_TRYLOCK_ALT_SIZE	/* 251 */ + \
2111c6c9aed4Sab 	MSG_SYS_LWP_MUTEX_REGISTER_ALT_SIZE	/* 252 */ + \
2112c6c9aed4Sab 	MSG_SYS_CLADM_ALT_SIZE			/* 253 */ + \
2113c6c9aed4Sab 	MSG_SYS_UUCOPY_ALT_SIZE			/* 254 */ + \
2114c6c9aed4Sab 	MSG_SYS_UMOUNT2_ALT_SIZE		/* 255 */ + \
2115c6c9aed4Sab 	3					/* 256 (unused) */ + \
2116c6c9aed4Sab 	\
2117c6c9aed4Sab 	/* sysset_t[8] - System Calls [257 - 288] */ \
2118c6c9aed4Sab 	(32 * 3)				/* 257 - 288 (unused) */ + \
2119c6c9aed4Sab 	\
2120c6c9aed4Sab 	/* sysset_t[9] - System Calls [289 - 320] */ \
2121c6c9aed4Sab 	(32 * 3)				/* 289 - 320 (unused) */ + \
2122c6c9aed4Sab 	\
2123c6c9aed4Sab 	/* sysset_t[10] - System Calls [321 - 352] */ \
2124c6c9aed4Sab 	(32 * 3)				/* 321 - 352 (unused) */ + \
2125c6c9aed4Sab 	\
2126c6c9aed4Sab 	/* sysset_t[11] - System Calls [353 - 384] */ \
2127c6c9aed4Sab 	(32 * 3)				/* 353 - 384 (unused) */ + \
2128c6c9aed4Sab 	\
2129c6c9aed4Sab 	/* sysset_t[12] - System Calls [385 - 416] */ \
2130c6c9aed4Sab 	(32 * 3)				/* 385 - 416 (unused) */ + \
2131c6c9aed4Sab 	\
2132c6c9aed4Sab 	/* sysset_t[13] - System Calls [417 - 448] */ \
2133c6c9aed4Sab 	(32 * 3)				/* 417 - 448 (unused) */ + \
2134c6c9aed4Sab 	\
2135c6c9aed4Sab 	/* sysset_t[14] - System Calls [449 - 480] */ \
2136c6c9aed4Sab 	(32 * 3)				/* 449 - 480 (unused) */ + \
2137c6c9aed4Sab 	\
2138c6c9aed4Sab 	/* sysset_t[15] - System Calls [481 - 512] */ \
2139c6c9aed4Sab 	(32 * 3)				/* 481 - 512 (unused) */ + \
2140c6c9aed4Sab 	\
2141c6c9aed4Sab 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
2142c6c9aed4Sab 
2143c6c9aed4Sab /*
2144c6c9aed4Sab  * Ensure that Conv_cnote_sysset_buf_t is large enough:
2145c6c9aed4Sab  *
2146c6c9aed4Sab  * SYSSET_FLAGSZ is the real minimum size of the buffer required by
2147c6c9aed4Sab  * conv_cnote_sysset(). However, Conv_cnote_sysset_buf_t
2148c6c9aed4Sab  * uses CONV_CNOTE_SYSSET_BUFSIZE to set the buffer size. We do
2149c6c9aed4Sab  * things this way because the definition of SYSSET_FLAGSZ uses information
2150c6c9aed4Sab  * that is not available in the environment of other programs
2151c6c9aed4Sab  * that include the conv.h header file.
2152c6c9aed4Sab  */
2153c6c9aed4Sab #if (CONV_CNOTE_SYSSET_BUFSIZE != SYSSET_FLAGSZ) && !defined(__lint)
2154c6c9aed4Sab #define	REPORT_BUFSIZE SYSSET_FLAGSZ
2155c6c9aed4Sab #include "report_bufsize.h"
2156c6c9aed4Sab #error "CONV_CNOTE_SYSSET_BUFSIZE does not match SYSSET_FLAGSZ"
2157c6c9aed4Sab #endif
2158c6c9aed4Sab 
2159c6c9aed4Sab const char *
conv_cnote_sysset(uint32_t * maskarr,int n_mask,Conv_fmt_flags_t fmt_flags,Conv_cnote_sysset_buf_t * cnote_sysset_buf)2160c6c9aed4Sab conv_cnote_sysset(uint32_t *maskarr, int n_mask,
2161c6c9aed4Sab     Conv_fmt_flags_t fmt_flags, Conv_cnote_sysset_buf_t *cnote_sysset_buf)
2162c6c9aed4Sab {
2163c6c9aed4Sab #define	N_MASK 16
2164c6c9aed4Sab 
21654f680cc6SAli Bahrami 	static const Val_desc vda0[] = {	/* System Calls [1 - 32] */
21664f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_EXIT_ALT },
21678fd04b83SRoger A. Faulkner 		{ 0x00000002,	MSG_SYS_2 },
21684f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_READ_ALT },
21694f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_WRITE_ALT },
21704f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_OPEN_ALT },
21714f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_CLOSE_ALT },
21728fd04b83SRoger A. Faulkner 		{ 0x00000040,	MSG_SYS_7 },
21738fd04b83SRoger A. Faulkner 		{ 0x00000080,	MSG_SYS_8 },
21744f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_LINK_ALT },
21754f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_UNLINK_ALT },
21768fd04b83SRoger A. Faulkner 		{ 0x00000400,	MSG_SYS_11 },
21774f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_CHDIR_ALT },
21784f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_TIME_ALT },
21794f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_MKNOD_ALT },
21804f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_CHMOD_ALT },
21814f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_CHOWN_ALT },
21824f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_BRK_ALT },
21834f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_STAT_ALT },
21844f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_LSEEK_ALT },
21854f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_GETPID_ALT },
21864f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_MOUNT_ALT },
21878fd04b83SRoger A. Faulkner 		{ 0x00200000,	MSG_SYS_22 },
21884f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_SETUID_ALT },
21894f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_GETUID_ALT },
21904f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_STIME_ALT },
21914f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_PCSAMPLE_ALT },
21924f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_ALARM_ALT },
21934f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_FSTAT_ALT },
21944f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_PAUSE_ALT },
21958fd04b83SRoger A. Faulkner 		{ 0x20000000,	MSG_SYS_30 },
21964f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_STTY_ALT },
21974f680cc6SAli Bahrami 		{ 0x80000000,	MSG_SYS_GTTY_ALT },
2198c6c9aed4Sab 		{ 0,		0 }
2199c6c9aed4Sab 	};
22004f680cc6SAli Bahrami 	static const Val_desc vda1[] = {	/* System Calls [33 - 64] */
22014f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_ACCESS_ALT },
22024f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_NICE_ALT },
22034f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_STATFS_ALT },
22044f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_SYNC_ALT },
22054f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_KILL_ALT },
22064f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_FSTATFS_ALT },
22074f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_PGRPSYS_ALT },
22084f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_UUCOPYSTR_ALT },
22098fd04b83SRoger A. Faulkner 		{ 0x00000100,	MSG_SYS_41 },
22104f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_PIPE_ALT },
22114f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_TIMES_ALT },
22124f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_PROFIL_ALT },
22138fd04b83SRoger A. Faulkner 		{ 0x00001000,	MSG_SYS_FACCESSAT_ALT },
22144f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_SETGID_ALT },
22154f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_GETGID_ALT },
22168fd04b83SRoger A. Faulkner 		{ 0x00008000,	MSG_SYS_48 },
22174f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_MSGSYS_ALT },
22184f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_SYSI86_ALT },
22194f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_ACCT_ALT },
22204f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_SHMSYS_ALT },
22214f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_SEMSYS_ALT },
22224f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_IOCTL_ALT },
22234f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_UADMIN_ALT },
22248fd04b83SRoger A. Faulkner 		{ 0x00800000,	MSG_SYS_FCHOWNAT_ALT },
22254f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_UTSSYS_ALT },
22264f680cc6SAli Bahrami 		{ 0x0200000,	MSG_SYS_FDSYNC_ALT },
22274f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_EXECVE_ALT },
22284f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_UMASK_ALT },
22294f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_CHROOT_ALT },
22304f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_FCNTL_ALT },
22314f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_ULIMIT_ALT },
22328fd04b83SRoger A. Faulkner 		{ 0x80000000,	MSG_SYS_RENAMEAT_ALT },
2233c6c9aed4Sab 		{ 0,		0 }
2234c6c9aed4Sab 	};
22354f680cc6SAli Bahrami 	static const Val_desc vda2[] = {	/* System Calls [65 - 96] */
22368fd04b83SRoger A. Faulkner 		{ 0x00000001,	MSG_SYS_UNLINKAT_ALT },
22378fd04b83SRoger A. Faulkner 		{ 0x00000002,	MSG_SYS_FSTATAT_ALT },
22388fd04b83SRoger A. Faulkner 		{ 0x00000004,	MSG_SYS_FSTATAT64_ALT },
22398fd04b83SRoger A. Faulkner 		{ 0x00000008,	MSG_SYS_OPENAT_ALT },
22408fd04b83SRoger A. Faulkner 		{ 0x00000010,	MSG_SYS_OPENAT64_ALT },
22414f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_TASKSYS_ALT },
22424f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_ACCTCTL_ALT },
22434f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_EXACCTSYS_ALT },
22444f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_GETPAGESIZES_ALT },
22454f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_RCTLSYS_ALT },
22464f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_SIDSYS_ALT },
22478fd04b83SRoger A. Faulkner 		{ 0x00000800,	MSG_SYS_76 },
22484f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_LWP_PARK_ALT },
22494f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_SENDFILEV_ALT },
22504f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_RMDIR_ALT },
22514f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_MKDIR_ALT },
22524f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_GETDENTS_ALT },
22534f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_PRIVSYS_ALT },
22544f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_UCREDSYS_ALT },
22554f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_SYSFS_ALT },
22564f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_GETMSG_ALT },
22574f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_PUTMSG_ALT },
22588fd04b83SRoger A. Faulkner 		{ 0x00400000,	MSG_SYS_87 },
22594f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_LSTAT_ALT },
22604f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_SYMLINK_ALT },
22614f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_READLINK_ALT },
22624f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_SETGROUPS_ALT },
22634f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_GETGROUPS_ALT },
22644f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_FCHMOD_ALT },
22654f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_FCHOWN_ALT },
22664f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_SIGPROCMASK_ALT },
22674f680cc6SAli Bahrami 		{ 0x80000000,	MSG_SYS_SIGSUSPEND_ALT },
2268c6c9aed4Sab 		{ 0,		0 }
2269c6c9aed4Sab 	};
22704f680cc6SAli Bahrami 	static const Val_desc vda3[] = {	/* System Calls [97 - 128] */
22714f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_SIGALTSTACK_ALT },
22724f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_SIGACTION_ALT },
22734f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_SIGPENDING_ALT },
22744f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_CONTEXT_ALT },
22758fd04b83SRoger A. Faulkner 		{ 0x00000010,	MSG_SYS_101 },
22768fd04b83SRoger A. Faulkner 		{ 0x00000020,	MSG_SYS_102 },
22774f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_STATVFS_ALT },
22784f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_FSTATVFS_ALT },
22794f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_GETLOADAVG_ALT },
22804f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_NFSSYS_ALT },
22814f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_WAITID_ALT },
22824f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_SIGSENDSYS_ALT },
22834f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_HRTSYS_ALT },
22848fd04b83SRoger A. Faulkner 		{ 0x00002000,	MSG_SYS_UTIMESYS_ALT },
22854f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_SIGRESEND_ALT },
22864f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_PRIOCNTLSYS_ALT },
22874f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_PATHCONF_ALT },
22884f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_MINCORE_ALT },
22894f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_MMAP_ALT },
22904f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_MPROTECT_ALT },
22914f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_MUNMAP_ALT },
22924f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_FPATHCONF_ALT },
22934f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_VFORK_ALT },
22944f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_FCHDIR_ALT },
22954f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_READV_ALT },
22964f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_WRITEV_ALT },
2297350ffdd5SRobert Mustacchi 		{ 0x04000000,	MSG_SYS_PREADV_ALT },
2298350ffdd5SRobert Mustacchi 		{ 0x08000000,	MSG_SYS_PWRITEV_ALT },
2299350ffdd5SRobert Mustacchi 		{ 0x10000000,	MSG_SYS_UPANIC_ALT },
2300350ffdd5SRobert Mustacchi 		{ 0x20000000,	MSG_SYS_GETRANDOM_ALT },
23018fd04b83SRoger A. Faulkner 		{ 0x40000000,	MSG_SYS_MMAPOBJ_ALT },
23024f680cc6SAli Bahrami 		{ 0x80000000,	MSG_SYS_SETRLIMIT_ALT },
2303c6c9aed4Sab 		{ 0,			0 }
2304c6c9aed4Sab 	};
23054f680cc6SAli Bahrami 	static const Val_desc vda4[] = {	/* System Calls [129 - 160] */
23064f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_GETRLIMIT_ALT },
23074f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_LCHOWN_ALT },
23084f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_MEMCNTL_ALT },
23094f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_GETPMSG_ALT },
23104f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_PUTPMSG_ALT },
23114f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_RENAME_ALT },
23124f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_UNAME_ALT },
23134f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_SETEGID_ALT },
23144f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_SYSCONFIG_ALT },
23154f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_ADJTIME_ALT },
23164f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_SYSTEMINFO_ALT },
23174f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_SHAREFS_ALT },
23184f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_SETEUID_ALT },
23194f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_FORKSYS_ALT },
23208fd04b83SRoger A. Faulkner 		{ 0x00004000,	MSG_SYS_143 },
23214f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_SIGTIMEDWAIT_ALT },
23224f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_LWP_INFO_ALT },
23234f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_YIELD_ALT },
23248fd04b83SRoger A. Faulkner 		{ 0x00040000,	MSG_SYS_147 },
23254f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_LWP_SEMA_POST_ALT },
23264f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_LWP_SEMA_TRYWAIT_ALT },
23274f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_LWP_DETACH_ALT },
23284f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_CORECTL_ALT },
23294f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_MODCTL_ALT },
23304f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_FCHROOT_ALT },
23318fd04b83SRoger A. Faulkner 		{ 0x02000000,	MSG_SYS_154 },
23324f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_VHANGUP_ALT },
23334f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_GETTIMEOFDAY_ALT },
23344f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_GETITIMER_ALT },
23354f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_SETITIMER_ALT },
23364f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_LWP_CREATE_ALT },
23374f680cc6SAli Bahrami 		{ 0x80000000,	MSG_SYS_LWP_EXIT_ALT },
2338c6c9aed4Sab 		{ 0,		0 }
2339c6c9aed4Sab 	};
23404f680cc6SAli Bahrami 	static const Val_desc vda5[] = {	/* System Calls [161 - 192] */
23414f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_LWP_SUSPEND_ALT },
23424f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_LWP_CONTINUE_ALT },
23434f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_LWP_KILL_ALT },
23444f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_LWP_SELF_ALT },
23454f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_LWP_SIGMASK_ALT },
23464f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_LWP_PRIVATE_ALT },
23474f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_LWP_WAIT_ALT },
23484f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_LWP_MUTEX_WAKEUP_ALT },
23498fd04b83SRoger A. Faulkner 		{ 0x00000100,	MSG_SYS_169 },
23504f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_LWP_COND_WAIT_ALT },
23514f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_LWP_COND_SIGNAL_ALT },
23524f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_LWP_COND_BROADCAST_ALT },
23534f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_PREAD_ALT },
23544f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_PWRITE_ALT },
23554f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_LLSEEK_ALT },
23564f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_INST_SYNC_ALT },
23574f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_BRAND_ALT },
23584f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_KAIO_ALT },
23594f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_CPC_ALT },
23604f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_LGRPSYS_ALT },
23614f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_RUSAGESYS_ALT },
23624f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_PORT_ALT },
23634f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_POLLSYS_ALT },
23644f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_LABELSYS_ALT },
23654f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_ACL_ALT },
23664f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_AUDITSYS_ALT },
23674f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_PROCESSOR_BIND_ALT },
23684f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_PROCESSOR_INFO_ALT },
23694f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_P_ONLINE_ALT },
23704f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_SIGQUEUE_ALT },
23714f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_CLOCK_GETTIME_ALT },
23724f680cc6SAli Bahrami 		{ 0x80000000,	MSG_SYS_CLOCK_SETTIME_ALT },
2373c6c9aed4Sab 		{ 0,		0 }
2374c6c9aed4Sab 	};
23754f680cc6SAli Bahrami 	static const Val_desc vda6[] = {	/* System Calls [193 - 224] */
23764f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_CLOCK_GETRES_ALT },
23774f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_TIMER_CREATE_ALT },
23784f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_TIMER_DELETE_ALT },
23794f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_TIMER_SETTIME_ALT },
23804f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_TIMER_GETTIME_ALT },
23814f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_TIMER_GETOVERRUN_ALT },
23824f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_NANOSLEEP_ALT },
23834f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_FACL_ALT },
23844f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_DOOR_ALT },
23854f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_SETREUID_ALT },
23864f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_SETREGID_ALT },
23874f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_INSTALL_UTRAP_ALT },
23884f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_SIGNOTIFY_ALT },
23894f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_SCHEDCTL_ALT },
23904f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_PSET_ALT },
23914f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_SPARC_UTRAP_INSTALL_ALT },
23924f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_RESOLVEPATH_ALT },
23934f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT },
23944f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT },
23954f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_LWP_RWLOCK_SYS_ALT },
23964f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_GETDENTS64_ALT },
23974f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_MMAP64_ALT },
23984f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_STAT64_ALT },
23994f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_LSTAT64_ALT },
24004f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_FSTAT64_ALT },
24014f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_STATVFS64_ALT },
24024f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_FSTATVFS64_ALT },
24034f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_SETRLIMIT64_ALT },
24044f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_GETRLIMIT64_ALT },
24054f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_PREAD64_ALT },
24064f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_PWRITE64_ALT },
24078fd04b83SRoger A. Faulkner 		{ 0x80000000,	MSG_SYS_224 },
2408c6c9aed4Sab 		{ 0,			0 }
2409c6c9aed4Sab 	};
24104f680cc6SAli Bahrami 	static const Val_desc vda7[] = {	/* System Calls [225 - 256] */
24114f680cc6SAli Bahrami 		{ 0x00000001,	MSG_SYS_OPEN64_ALT },
24124f680cc6SAli Bahrami 		{ 0x00000002,	MSG_SYS_RPCSYS_ALT },
24134f680cc6SAli Bahrami 		{ 0x00000004,	MSG_SYS_ZONE_ALT },
24144f680cc6SAli Bahrami 		{ 0x00000008,	MSG_SYS_AUTOFSSYS_ALT },
24154f680cc6SAli Bahrami 		{ 0x00000010,	MSG_SYS_GETCWD_ALT },
24164f680cc6SAli Bahrami 		{ 0x00000020,	MSG_SYS_SO_SOCKET_ALT },
24174f680cc6SAli Bahrami 		{ 0x00000040,	MSG_SYS_SO_SOCKETPAIR_ALT },
24184f680cc6SAli Bahrami 		{ 0x00000080,	MSG_SYS_BIND_ALT },
24194f680cc6SAli Bahrami 		{ 0x00000100,	MSG_SYS_LISTEN_ALT },
24204f680cc6SAli Bahrami 		{ 0x00000200,	MSG_SYS_ACCEPT_ALT },
24214f680cc6SAli Bahrami 		{ 0x00000400,	MSG_SYS_CONNECT_ALT },
24224f680cc6SAli Bahrami 		{ 0x00000800,	MSG_SYS_SHUTDOWN_ALT },
24234f680cc6SAli Bahrami 		{ 0x00001000,	MSG_SYS_RECV_ALT },
24244f680cc6SAli Bahrami 		{ 0x00002000,	MSG_SYS_RECVFROM_ALT },
24254f680cc6SAli Bahrami 		{ 0x00004000,	MSG_SYS_RECVMSG_ALT },
24264f680cc6SAli Bahrami 		{ 0x00008000,	MSG_SYS_SEND_ALT },
24274f680cc6SAli Bahrami 		{ 0x00010000,	MSG_SYS_SENDMSG_ALT },
24284f680cc6SAli Bahrami 		{ 0x00020000,	MSG_SYS_SENDTO_ALT },
24294f680cc6SAli Bahrami 		{ 0x00040000,	MSG_SYS_GETPEERNAME_ALT },
24304f680cc6SAli Bahrami 		{ 0x00080000,	MSG_SYS_GETSOCKNAME_ALT },
24314f680cc6SAli Bahrami 		{ 0x00100000,	MSG_SYS_GETSOCKOPT_ALT },
24324f680cc6SAli Bahrami 		{ 0x00200000,	MSG_SYS_SETSOCKOPT_ALT },
24334f680cc6SAli Bahrami 		{ 0x00400000,	MSG_SYS_SOCKCONFIG_ALT },
24344f680cc6SAli Bahrami 		{ 0x00800000,	MSG_SYS_NTP_GETTIME_ALT },
24354f680cc6SAli Bahrami 		{ 0x01000000,	MSG_SYS_NTP_ADJTIME_ALT },
24364f680cc6SAli Bahrami 		{ 0x02000000,	MSG_SYS_LWP_MUTEX_UNLOCK_ALT },
24374f680cc6SAli Bahrami 		{ 0x04000000,	MSG_SYS_LWP_MUTEX_TRYLOCK_ALT },
24384f680cc6SAli Bahrami 		{ 0x08000000,	MSG_SYS_LWP_MUTEX_REGISTER_ALT },
24394f680cc6SAli Bahrami 		{ 0x10000000,	MSG_SYS_CLADM_ALT },
24404f680cc6SAli Bahrami 		{ 0x20000000,	MSG_SYS_UUCOPY_ALT },
24414f680cc6SAli Bahrami 		{ 0x40000000,	MSG_SYS_UMOUNT2_ALT },
2442c6c9aed4Sab 		/* 256 (unused) */
2443c6c9aed4Sab 		{ 0,		0 }
2444c6c9aed4Sab 	};
24454f680cc6SAli Bahrami 	static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
2446c6c9aed4Sab 		{ vda0, 0x00000000 },
2447c6c9aed4Sab 		{ vda1, 0x00000000 },
2448c6c9aed4Sab 		{ vda2, 0x00000000 },
2449c6c9aed4Sab 		{ vda3, 0x00000000 },
2450c6c9aed4Sab 		{ vda4, 0x00000000 },
2451c6c9aed4Sab 		{ vda5, 0x00000000 },
2452c6c9aed4Sab 		{ vda6, 0x00000000 },
2453c6c9aed4Sab 		{ vda7, 0x80000000 },
2454c6c9aed4Sab 		{ NULL, 0xffffffff },
2455c6c9aed4Sab 		{ NULL, 0xffffffff },
2456c6c9aed4Sab 		{ NULL, 0xffffffff },
2457c6c9aed4Sab 		{ NULL, 0xffffffff },
2458c6c9aed4Sab 		{ NULL, 0xffffffff },
2459c6c9aed4Sab 		{ NULL, 0xffffffff },
2460c6c9aed4Sab 		{ NULL, 0xffffffff },
2461c6c9aed4Sab 		{ NULL, 0xffffffff }
2462c6c9aed4Sab 	};
2463c6c9aed4Sab 
2464c6c9aed4Sab 	if (n_mask > N_MASK)
2465c6c9aed4Sab 		n_mask = N_MASK;
2466c6c9aed4Sab 	return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
2467c6c9aed4Sab 	    cnote_sysset_buf->buf, CONV_CNOTE_SYSSET_BUFSIZE));
2468c6c9aed4Sab 
2469c6c9aed4Sab #undef N_MASK
2470c6c9aed4Sab }
247134bdffbfSGarrett D'Amore 
247234bdffbfSGarrett D'Amore const char *
conv_cnote_fileflags(uint32_t fileflags,Conv_fmt_flags_t fmt_flags,char * buf,size_t bufsize)247334bdffbfSGarrett D'Amore conv_cnote_fileflags(uint32_t fileflags, Conv_fmt_flags_t fmt_flags,
247434bdffbfSGarrett D'Amore     char *buf, size_t bufsize)
247534bdffbfSGarrett D'Amore {
247634bdffbfSGarrett D'Amore 	CONV_EXPN_FIELD_ARG arg = { 0 };
247734bdffbfSGarrett D'Amore 
247834bdffbfSGarrett D'Amore 	Val_desc vda[] = {
247934bdffbfSGarrett D'Amore 		{ 0x0001,	MSG_PR_O_WRONLY },
248034bdffbfSGarrett D'Amore 		{ 0x0002,	MSG_PR_O_RDONLY },
248134bdffbfSGarrett D'Amore 		{ 0x200000,	MSG_PR_O_SEARCH },
248234bdffbfSGarrett D'Amore 		{ 0x400000,	MSG_PR_O_EXEC },
248334bdffbfSGarrett D'Amore 		{ 0x0004,	MSG_PR_O_NDELAY },
248434bdffbfSGarrett D'Amore 		{ 0x0008,	MSG_PR_O_APPEND },
248534bdffbfSGarrett D'Amore 		{ 0x0010,	MSG_PR_O_SYNC },
248634bdffbfSGarrett D'Amore 		{ 0x0040,	MSG_PR_O_DSYNC },
248734bdffbfSGarrett D'Amore 		{ 0x0080,	MSG_PR_O_NONBLOCK },
248834bdffbfSGarrett D'Amore 		{ 0x0100,	MSG_PR_O_CREAT },
248934bdffbfSGarrett D'Amore 		{ 0x0200,	MSG_PR_O_TRUNC },
249034bdffbfSGarrett D'Amore 		{ 0x0400,	MSG_PR_O_EXCL },
249134bdffbfSGarrett D'Amore 		{ 0x0800,	MSG_PR_O_NOCTTY },
249234bdffbfSGarrett D'Amore 		{ 0x4000,	MSG_PR_O_XATTR },
249334bdffbfSGarrett D'Amore 		{ 0x8000,	MSG_PR_O_RSYNC },
249434bdffbfSGarrett D'Amore 		{ 0x2000,	MSG_PR_O_LARGEFILE },
249534bdffbfSGarrett D'Amore 		{ 0x20000,	MSG_PR_O_NOFOLLOW },
249634bdffbfSGarrett D'Amore 		{ 0x40000,	MSG_PR_O_NOLINKS },
2497ffca9b6bSToomas Soome 		{ 0, 0 },
249834bdffbfSGarrett D'Amore 	};
249934bdffbfSGarrett D'Amore 
250034bdffbfSGarrett D'Amore 	arg.oflags = arg.rflags = fileflags;
250134bdffbfSGarrett D'Amore 	arg.buf = buf;
250234bdffbfSGarrett D'Amore 	arg.bufsize = bufsize;
250334bdffbfSGarrett D'Amore 
250434bdffbfSGarrett D'Amore 	switch (fileflags & (0x600003)) {
250534bdffbfSGarrett D'Amore 	case 0:	/* RDONLY */
250634bdffbfSGarrett D'Amore 		vda[0].v_msg = MSG_PR_O_RDONLY;
250734bdffbfSGarrett D'Amore 		arg.oflags |= 1;
250834bdffbfSGarrett D'Amore 		arg.rflags |= 1;
250934bdffbfSGarrett D'Amore 		break;
251034bdffbfSGarrett D'Amore 	case 1:	/* WRONLY */
251134bdffbfSGarrett D'Amore 	case 2:	/* RDWR */
251234bdffbfSGarrett D'Amore 	case 0x200000:	/* SEARCH */
251334bdffbfSGarrett D'Amore 	case 0x400000:
251434bdffbfSGarrett D'Amore 		/* In isolate, treat these as normal bits */
251534bdffbfSGarrett D'Amore 		break;
251634bdffbfSGarrett D'Amore 	default:
251734bdffbfSGarrett D'Amore 		/* More than one bit set in this group, emit numerically */
251834bdffbfSGarrett D'Amore 		arg.oflags &= ~(fileflags & 0x600003);
251934bdffbfSGarrett D'Amore 	}
252034bdffbfSGarrett D'Amore 
252134bdffbfSGarrett D'Amore 	if (fileflags == 0)
252234bdffbfSGarrett D'Amore 		return (MSG_ORIG(MSG_GBL_ZERO));
252334bdffbfSGarrett D'Amore 
252434bdffbfSGarrett D'Amore 	(void) conv_expn_field(&arg, vda, fmt_flags);
252534bdffbfSGarrett D'Amore 	return (buf);
252634bdffbfSGarrett D'Amore }
252734bdffbfSGarrett D'Amore 
252834bdffbfSGarrett D'Amore const char *
conv_cnote_filemode(uint32_t mode,Conv_fmt_flags_t fmt_flags,char * buf,size_t bufsize)252934bdffbfSGarrett D'Amore conv_cnote_filemode(uint32_t mode, Conv_fmt_flags_t fmt_flags,
253034bdffbfSGarrett D'Amore     char *buf, size_t bufsize)
253134bdffbfSGarrett D'Amore {
253234bdffbfSGarrett D'Amore 	CONV_EXPN_FIELD_ARG arg = { 0 };
253334bdffbfSGarrett D'Amore 	Msg s;
253434bdffbfSGarrett D'Amore 
253534bdffbfSGarrett D'Amore 	Val_desc vda[] = {
253634bdffbfSGarrett D'Amore 		{ 0x1000,	MSG_S_IFIFO },
253734bdffbfSGarrett D'Amore 		{ 0x800,	MSG_S_ISUID },
253834bdffbfSGarrett D'Amore 		{ 0x400,	MSG_S_ISGID },
253934bdffbfSGarrett D'Amore 		{ 0x200,	MSG_S_ISVTX },
254034bdffbfSGarrett D'Amore 		{ 0400,		MSG_S_IRUSR },
254134bdffbfSGarrett D'Amore 		{ 0200,		MSG_S_IWUSR },
254234bdffbfSGarrett D'Amore 		{ 0100,		MSG_S_IXUSR },
254334bdffbfSGarrett D'Amore 		{ 0040,		MSG_S_IRGRP },
254434bdffbfSGarrett D'Amore 		{ 0020,		MSG_S_IWGRP },
254534bdffbfSGarrett D'Amore 		{ 0010,		MSG_S_IXGRP },
254634bdffbfSGarrett D'Amore 		{ 0004,		MSG_S_IROTH },
254734bdffbfSGarrett D'Amore 		{ 0002,		MSG_S_IWOTH },
254834bdffbfSGarrett D'Amore 		{ 0001,		MSG_S_IXOTH },
2549ffca9b6bSToomas Soome 		{ 0, 0 },
255034bdffbfSGarrett D'Amore 	};
255134bdffbfSGarrett D'Amore 
255234bdffbfSGarrett D'Amore 	arg.oflags = arg.rflags = mode & ~(0xf000);
255334bdffbfSGarrett D'Amore 	arg.buf = buf;
255434bdffbfSGarrett D'Amore 	arg.bufsize = bufsize;
255534bdffbfSGarrett D'Amore 
255634bdffbfSGarrett D'Amore 	switch (mode & (0xf000)) {
255734bdffbfSGarrett D'Amore 	case 0x1000:
255834bdffbfSGarrett D'Amore 		s = MSG_S_IFIFO;
255934bdffbfSGarrett D'Amore 		break;
256034bdffbfSGarrett D'Amore 	case 0x2000:
256134bdffbfSGarrett D'Amore 		s = MSG_S_IFCHR;
256234bdffbfSGarrett D'Amore 		break;
256334bdffbfSGarrett D'Amore 	case 0x4000:
256434bdffbfSGarrett D'Amore 		s = MSG_S_IFDIR;
256534bdffbfSGarrett D'Amore 		break;
256634bdffbfSGarrett D'Amore 	case 0x5000:
256734bdffbfSGarrett D'Amore 		s = MSG_S_IFNAM;
256834bdffbfSGarrett D'Amore 		break;
256934bdffbfSGarrett D'Amore 	case 0x6000:
257034bdffbfSGarrett D'Amore 		s = MSG_S_IFBLK;
257134bdffbfSGarrett D'Amore 		break;
257234bdffbfSGarrett D'Amore 	case 0x8000:
257334bdffbfSGarrett D'Amore 		s = MSG_S_IFREG;
257434bdffbfSGarrett D'Amore 		break;
257534bdffbfSGarrett D'Amore 	case 0xA000:
257634bdffbfSGarrett D'Amore 		s = MSG_S_IFLNK;
257734bdffbfSGarrett D'Amore 		break;
257834bdffbfSGarrett D'Amore 	case 0xc000:
257934bdffbfSGarrett D'Amore 		s = MSG_S_IFSOCK;
258034bdffbfSGarrett D'Amore 		break;
258134bdffbfSGarrett D'Amore 	case 0xd000:
258234bdffbfSGarrett D'Amore 		s = MSG_S_IFDOOR;
258334bdffbfSGarrett D'Amore 		break;
258434bdffbfSGarrett D'Amore 	case 0xe000:
258534bdffbfSGarrett D'Amore 		s = MSG_S_IFPORT;
258634bdffbfSGarrett D'Amore 		break;
258734bdffbfSGarrett D'Amore 	default:
2588ffca9b6bSToomas Soome 		s = 0;
258934bdffbfSGarrett D'Amore 		break;
259034bdffbfSGarrett D'Amore 	}
259134bdffbfSGarrett D'Amore 
259234bdffbfSGarrett D'Amore 	if (s) {
259334bdffbfSGarrett D'Amore 		arg.oflags |= 0x1000;
259434bdffbfSGarrett D'Amore 		arg.rflags |= 0x1000;
259534bdffbfSGarrett D'Amore 		vda[0].v_msg = s;
259634bdffbfSGarrett D'Amore 	} else {
259734bdffbfSGarrett D'Amore 		arg.rflags = mode;
259834bdffbfSGarrett D'Amore 	}
259934bdffbfSGarrett D'Amore 
260034bdffbfSGarrett D'Amore 	if (mode == 0)
260134bdffbfSGarrett D'Amore 		return (MSG_ORIG(MSG_GBL_ZERO));
260234bdffbfSGarrett D'Amore 
260334bdffbfSGarrett D'Amore 	(void) conv_expn_field(&arg, vda, fmt_flags);
260434bdffbfSGarrett D'Amore 	return (buf);
260534bdffbfSGarrett D'Amore }
2606d2a70789SRichard Lowe 
2607d2a70789SRichard Lowe 
2608d2a70789SRichard Lowe #define	PROCSECFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE +		\
2609d2a70789SRichard Lowe 	MSG_ASLR_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2610d2a70789SRichard Lowe 	MSG_FORBIDNULLMAP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2611d2a70789SRichard Lowe 	MSG_NOEXECSTACK_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2612d2a70789SRichard Lowe 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
2613d2a70789SRichard Lowe 
2614d2a70789SRichard Lowe /*
2615d2a70789SRichard Lowe  * Ensure that Conv_cnote_pr_secflags_buf_t is large enough:
2616d2a70789SRichard Lowe  *
2617d2a70789SRichard Lowe  * PROCSECFLGSZ is the real minimum size of the buffer required by
2618d2a70789SRichard Lowe  * conv_prsecflags(). However, Conv_cnote_pr_secflags_buf_t uses
2619d2a70789SRichard Lowe  * CONV_CNOTE_PSECFLAGS_FLAG_BUFSIZE to set the buffer size. We do things this
2620d2a70789SRichard Lowe  * way because the definition of PROCSECFLGSZ uses information that is not
2621d2a70789SRichard Lowe  * available in the environment of other programs that include the conv.h
2622d2a70789SRichard Lowe  * header file.
2623d2a70789SRichard Lowe  */
2624d2a70789SRichard Lowe #if (CONV_PRSECFLAGS_BUFSIZE != PROCSECFLGSZ) && !defined(__lint)
2625d2a70789SRichard Lowe #define	REPORT_BUFSIZE PROCSECFLGSZ
2626d2a70789SRichard Lowe #include "report_bufsize.h"
2627d2a70789SRichard Lowe #error "CONV_PRSECFLAGS_BUFSIZE does not match PROCSECFLGSZ"
2628d2a70789SRichard Lowe #endif
2629d2a70789SRichard Lowe 
2630d2a70789SRichard Lowe const char *
conv_prsecflags(secflagset_t flags,Conv_fmt_flags_t fmt_flags,Conv_secflags_buf_t * secflags_buf)2631d2a70789SRichard Lowe conv_prsecflags(secflagset_t flags, Conv_fmt_flags_t fmt_flags,
2632d2a70789SRichard Lowe     Conv_secflags_buf_t *secflags_buf)
2633d2a70789SRichard Lowe {
2634d2a70789SRichard Lowe 	/*
2635d2a70789SRichard Lowe 	 * The values are initialized later, based on position in this array
2636d2a70789SRichard Lowe 	 */
2637d2a70789SRichard Lowe 	static Val_desc vda[] = {
2638d2a70789SRichard Lowe 		{ 0, MSG_ASLR },
2639d2a70789SRichard Lowe 		{ 0, MSG_FORBIDNULLMAP },
2640d2a70789SRichard Lowe 		{ 0, MSG_NOEXECSTACK },
2641d2a70789SRichard Lowe 		{ 0, 0 }
2642d2a70789SRichard Lowe 	};
2643d2a70789SRichard Lowe 	static CONV_EXPN_FIELD_ARG conv_arg = {
2644d2a70789SRichard Lowe 	    NULL, sizeof (secflags_buf->buf)
2645d2a70789SRichard Lowe 	};
2646d2a70789SRichard Lowe 	int i;
2647d2a70789SRichard Lowe 
2648d2a70789SRichard Lowe 	for (i = 0; vda[i].v_msg != 0; i++)
2649d2a70789SRichard Lowe 		vda[i].v_val = secflag_to_bit(i);
2650d2a70789SRichard Lowe 
2651d2a70789SRichard Lowe 	if (flags == 0)
2652d2a70789SRichard Lowe 		return (MSG_ORIG(MSG_GBL_ZERO));
2653d2a70789SRichard Lowe 
2654d2a70789SRichard Lowe 	conv_arg.buf = secflags_buf->buf;
2655d2a70789SRichard Lowe 	conv_arg.oflags = conv_arg.rflags = flags;
2656d2a70789SRichard Lowe 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
2657d2a70789SRichard Lowe 
2658d2a70789SRichard Lowe 	return ((const char *)secflags_buf->buf);
2659d2a70789SRichard Lowe }
2660350ffdd5SRobert Mustacchi 
2661350ffdd5SRobert Mustacchi 
2662350ffdd5SRobert Mustacchi #define	UPANICFLGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE +		\
2663350ffdd5SRobert Mustacchi 	MSG_MSG_VALID_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2664350ffdd5SRobert Mustacchi 	MSG_MSG_ERROR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2665350ffdd5SRobert Mustacchi 	MSG_MSG_TRUNC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE +	\
2666350ffdd5SRobert Mustacchi 	CONV_INV_BUFSIZE	+ CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
2667350ffdd5SRobert Mustacchi 
2668350ffdd5SRobert Mustacchi /*
2669350ffdd5SRobert Mustacchi  * Ensure that Conv_upanic_buf_t is large enough:
2670350ffdd5SRobert Mustacchi  *
2671350ffdd5SRobert Mustacchi  * UPANICFLGSZ is the real minimum size of the buffer required by
2672350ffdd5SRobert Mustacchi  * conv_prsecflags(). However, Conv_upanic_buf_t uses CONV_PRUPANIC_BUFSIZE to
2673350ffdd5SRobert Mustacchi  * set the buffer size. We do things this way because the definition of
2674350ffdd5SRobert Mustacchi  * UPANICFLGSZ uses information that is not available in the environment of
2675350ffdd5SRobert Mustacchi  * other programs that include the conv.h header file.
2676350ffdd5SRobert Mustacchi  */
2677350ffdd5SRobert Mustacchi #if (CONV_PRUPANIC_BUFSIZE != UPANICFLGSZ)
2678350ffdd5SRobert Mustacchi #define	REPORT_BUFSIZE UPANICFLGSZ
2679350ffdd5SRobert Mustacchi #include "report_bufsize.h"
2680350ffdd5SRobert Mustacchi #error "CONV_PRUPANIC_BUFSIZE does not match UPANICFLGSZ"
2681350ffdd5SRobert Mustacchi #endif
2682350ffdd5SRobert Mustacchi 
2683350ffdd5SRobert Mustacchi const char *
conv_prupanic(uint32_t flags,Conv_fmt_flags_t fmt_flags,Conv_upanic_buf_t * upanic_buf)2684350ffdd5SRobert Mustacchi conv_prupanic(uint32_t flags, Conv_fmt_flags_t fmt_flags,
2685350ffdd5SRobert Mustacchi     Conv_upanic_buf_t *upanic_buf)
2686350ffdd5SRobert Mustacchi {
2687350ffdd5SRobert Mustacchi 	/*
2688350ffdd5SRobert Mustacchi 	 * Unfortunately, we cannot directly use the PRUPANIC_FLAG_* macros here
2689350ffdd5SRobert Mustacchi 	 * because of the fact that this is also built natively and that would
2690350ffdd5SRobert Mustacchi 	 * create an unresolvable flag day.
2691350ffdd5SRobert Mustacchi 	 */
2692350ffdd5SRobert Mustacchi 	static Val_desc vda[] = {
2693350ffdd5SRobert Mustacchi 		{ 0x01, MSG_MSG_VALID },
2694350ffdd5SRobert Mustacchi 		{ 0x02, MSG_MSG_ERROR },
2695350ffdd5SRobert Mustacchi 		{ 0x04, MSG_MSG_TRUNC },
2696350ffdd5SRobert Mustacchi 		{ 0, 0 }
2697350ffdd5SRobert Mustacchi 	};
2698350ffdd5SRobert Mustacchi 	static CONV_EXPN_FIELD_ARG conv_arg = {
2699350ffdd5SRobert Mustacchi 	    NULL, sizeof (upanic_buf->buf)
2700350ffdd5SRobert Mustacchi 	};
2701350ffdd5SRobert Mustacchi 
2702350ffdd5SRobert Mustacchi 	if (flags == 0)
2703350ffdd5SRobert Mustacchi 		return (MSG_ORIG(MSG_GBL_ZERO));
2704350ffdd5SRobert Mustacchi 
2705350ffdd5SRobert Mustacchi 	conv_arg.buf = upanic_buf->buf;
2706350ffdd5SRobert Mustacchi 	conv_arg.oflags = conv_arg.rflags = flags;
2707350ffdd5SRobert Mustacchi 	(void) conv_expn_field(&conv_arg, vda, fmt_flags);
2708350ffdd5SRobert Mustacchi 
2709350ffdd5SRobert Mustacchi 	return ((const char *)upanic_buf->buf);
2710350ffdd5SRobert Mustacchi }
2711