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