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