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