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