Print this page
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/truss/print.c
+++ new/usr/src/cmd/truss/print.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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright (c) 2015, Joyent, Inc. All rights reserved.
25 25 */
26 26
27 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 28 /* All Rights Reserved */
29 29
30 30 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
31 31
32 32 #define _SYSCALL32 /* make 32-bit compat headers visible */
33 33
34 34 #include <stdio.h>
35 35 #include <stdlib.h>
36 36 #include <unistd.h>
37 37 #include <string.h>
38 38 #include <signal.h>
39 39 #include <termio.h>
40 40 #include <stddef.h>
41 41 #include <limits.h>
42 42 #include <fcntl.h>
43 43 #include <ctype.h>
44 44 #include <sys/types.h>
45 45 #include <sys/mman.h>
46 46 #include <sys/resource.h>
47 47 #include <sys/ulimit.h>
48 48 #include <sys/utsname.h>
49 49 #include <sys/kstat.h>
50 50 #include <sys/modctl.h>
51 51 #include <sys/acl.h>
52 52 #include <stropts.h>
53 53 #include <sys/isa_defs.h>
54 54 #include <sys/systeminfo.h>
55 55 #include <sys/cladm.h>
56 56 #include <sys/lwp.h>
57 57 #include <bsm/audit.h>
58 58 #include <libproc.h>
59 59 #include <priv.h>
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
60 60 #include <sys/aio.h>
61 61 #include <sys/aiocb.h>
62 62 #include <sys/corectl.h>
63 63 #include <sys/cpc_impl.h>
64 64 #include <sys/priocntl.h>
65 65 #include <sys/tspriocntl.h>
66 66 #include <sys/iapriocntl.h>
67 67 #include <sys/rtpriocntl.h>
68 68 #include <sys/fsspriocntl.h>
69 69 #include <sys/fxpriocntl.h>
70 +#include <sys/proc.h>
70 71 #include <netdb.h>
71 72 #include <nss_dbdefs.h>
72 73 #include <sys/socketvar.h>
73 74 #include <netinet/in.h>
74 75 #include <netinet/tcp.h>
75 76 #include <netinet/udp.h>
76 77 #include <netinet/sctp.h>
77 78 #include <net/route.h>
78 79 #include <sys/utrap.h>
79 80 #include <sys/lgrp_user.h>
80 81 #include <sys/door.h>
81 82 #include <sys/tsol/tndb.h>
82 83 #include <sys/rctl.h>
83 84 #include <sys/rctl_impl.h>
84 85 #include <sys/fork.h>
85 86 #include <sys/task.h>
86 87 #include <sys/random.h>
87 88 #include "ramdata.h"
88 89 #include "print.h"
89 90 #include "proto.h"
90 91 #include "systable.h"
91 92
92 93 void grow(private_t *, int nbyte);
93 94
94 95 #define GROW(nb) if (pri->sys_leng + (nb) >= pri->sys_ssize) grow(pri, (nb))
95 96
96 97
97 98 /*ARGSUSED*/
98 99 void
99 100 prt_nov(private_t *pri, int raw, long val) /* print nothing */
100 101 {
101 102 }
102 103
103 104 /*ARGSUSED*/
104 105 void
105 106 prt_dec(private_t *pri, int raw, long val) /* print as decimal */
106 107 {
107 108 GROW(24);
108 109 if (data_model == PR_MODEL_ILP32)
109 110 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
110 111 "%d", (int)val);
111 112 else
112 113 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
113 114 "%ld", val);
114 115 }
115 116
116 117 /*ARGSUSED*/
117 118 void
118 119 prt_uns(private_t *pri, int raw, long val) /* print as unsigned decimal */
119 120 {
120 121 GROW(24);
121 122 if (data_model == PR_MODEL_ILP32)
122 123 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
123 124 "%u", (int)val);
124 125 else
125 126 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
126 127 "%lu", val);
127 128 }
128 129
129 130 /* print as unsigned decimal, except for -1 */
130 131 void
131 132 prt_un1(private_t *pri, int raw, long val)
132 133 {
133 134 if ((int)val == -1)
134 135 prt_dec(pri, raw, val);
135 136 else
136 137 prt_uns(pri, raw, val);
137 138 }
138 139
139 140 /*ARGSUSED*/
140 141 void
141 142 prt_oct(private_t *pri, int raw, long val) /* print as octal */
142 143 {
143 144 GROW(24);
144 145 if (data_model == PR_MODEL_ILP32)
145 146 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
146 147 "%#o", (int)val);
147 148 else
148 149 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
149 150 "%#lo", val);
150 151 }
151 152
152 153 /*ARGSUSED*/
153 154 void
154 155 prt_hex(private_t *pri, int raw, long val) /* print as hexadecimal */
155 156 {
156 157 GROW(20);
157 158 if (data_model == PR_MODEL_ILP32)
158 159 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
159 160 "0x%.8X", (int)val);
160 161 else
161 162 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
162 163 "0x%.8lX", val);
163 164 }
164 165
165 166 /* print as hexadecimal (half size) */
166 167 /*ARGSUSED*/
167 168 void
168 169 prt_hhx(private_t *pri, int raw, long val)
169 170 {
170 171 GROW(20);
171 172 if (data_model == PR_MODEL_ILP32)
172 173 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
173 174 "0x%.4X", (int)val);
174 175 else
175 176 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
176 177 "0x%.4lX", val);
177 178 }
178 179
179 180 /* print as decimal if small, else hexadecimal */
180 181 /*ARGSUSED*/
181 182 void
182 183 prt_dex(private_t *pri, int raw, long val)
183 184 {
184 185 if (val & 0xff000000)
185 186 prt_hex(pri, 0, val);
186 187 else
187 188 prt_dec(pri, 0, val);
188 189 }
189 190
190 191 /* print long long offset */
191 192 /*ARGSUSED*/
192 193 void
193 194 prt_llo(private_t *pri, int raw, long val1, long val2)
194 195 {
195 196 int hival;
196 197 int loval;
197 198
198 199 #ifdef _LONG_LONG_LTOH
199 200 hival = (int)val2;
200 201 loval = (int)val1;
201 202 #else
202 203 hival = (int)val1;
203 204 loval = (int)val2;
204 205 #endif
205 206
206 207 if (hival == 0) {
207 208 prt_dex(pri, 0, loval);
208 209 } else {
209 210 GROW(18);
210 211 pri->sys_leng +=
211 212 sprintf(pri->sys_string + pri->sys_leng, "0x%.8X%.8X",
212 213 hival, loval);
213 214 }
214 215 }
215 216
216 217 void
217 218 escape_string(private_t *pri, const char *s)
218 219 {
219 220 /*
220 221 * We want to avoid outputting unprintable characters that may
221 222 * destroy the user's terminal. So we do one pass to find any
222 223 * unprintable characters, size the array appropriately, and
223 224 * then walk each character by hand. Those that are unprintable
224 225 * are replaced by a hex escape (\xNN). We also escape quotes for
225 226 * completeness.
226 227 */
227 228 int i, unprintable, quotes;
228 229 size_t len = strlen(s);
229 230 for (i = 0, unprintable = 0, quotes = 0; i < len; i++) {
230 231 if (!isprint(s[i]))
231 232 unprintable++;
232 233 if (s[i] == '"')
233 234 quotes++;
234 235 }
235 236
236 237 GROW(len + 3 * unprintable + quotes + 2);
237 238
238 239 pri->sys_string[pri->sys_leng++] = '"';
239 240 for (i = 0; i < len; i++) {
240 241 if (s[i] == '"')
241 242 pri->sys_string[pri->sys_leng++] = '\\';
242 243
243 244 if (isprint(s[i])) {
244 245 pri->sys_string[pri->sys_leng++] = s[i];
245 246 } else {
246 247 pri->sys_leng += sprintf(pri->sys_string +
247 248 pri->sys_leng, "\\x%02x", (uint8_t)s[i]);
248 249 }
249 250 }
250 251 pri->sys_string[pri->sys_leng++] = '"';
251 252 }
252 253
253 254 void
254 255 prt_stg(private_t *pri, int raw, long val) /* print as string */
255 256 {
256 257 char *s = raw? NULL : fetchstring(pri, (long)val, PATH_MAX);
257 258
258 259 if (s == NULL)
259 260 prt_hex(pri, 0, val);
260 261 else
261 262 escape_string(pri, s);
262 263 }
263 264
264 265 /* print as string returned from syscall */
265 266 void
266 267 prt_rst(private_t *pri, int raw, long val)
267 268 {
268 269 char *s = (raw || pri->Errno)? NULL :
269 270 fetchstring(pri, (long)val, PATH_MAX);
270 271
271 272 if (s == NULL)
272 273 prt_hex(pri, 0, val);
273 274 else {
274 275 GROW((int)strlen(s) + 2);
275 276 pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
276 277 pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
277 278 }
278 279 }
279 280
280 281 /* print contents of readlink() buffer */
281 282 void
282 283 prt_rlk(private_t *pri, int raw, long val)
283 284 {
284 285 char *s = (raw || pri->Errno || pri->Rval1 <= 0)? NULL :
285 286 fetchstring(pri, (long)val,
286 287 (pri->Rval1 > PATH_MAX)? PATH_MAX : (int)pri->Rval1);
287 288
288 289 if (s == NULL)
289 290 prt_hex(pri, 0, val);
290 291 else {
291 292 GROW((int)strlen(s) + 2);
292 293 pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
293 294 pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
294 295 }
295 296 }
296 297
297 298 void
298 299 prt_ioc(private_t *pri, int raw, long val) /* print ioctl code */
299 300 {
300 301 const char *s = raw? NULL : ioctlname(pri, (int)val);
301 302
302 303 if (s == NULL)
303 304 prt_hex(pri, 0, val);
304 305 else
305 306 outstring(pri, s);
306 307 }
307 308
308 309 void
309 310 prt_ioa(private_t *pri, int raw, long val) /* print ioctl argument */
310 311 {
311 312 const char *s;
312 313
313 314 /* cheating -- look at the ioctl() code */
314 315 switch (pri->sys_args[1]) {
315 316
316 317 /* kstat ioctl()s */
317 318 case KSTAT_IOC_READ:
318 319 case KSTAT_IOC_WRITE:
319 320 #ifdef _LP64
320 321 if (data_model == PR_MODEL_ILP32)
321 322 prt_stg(pri, raw,
322 323 val + offsetof(kstat32_t, ks_name[0]));
323 324 else
324 325 #endif
325 326 prt_stg(pri, raw,
326 327 val + offsetof(kstat_t, ks_name[0]));
327 328 break;
328 329
329 330 /* streams ioctl()s */
330 331 case I_LOOK:
331 332 prt_rst(pri, raw, val);
332 333 break;
333 334 case I_PUSH:
334 335 case I_FIND:
335 336 prt_stg(pri, raw, val);
336 337 break;
337 338 case I_LINK:
338 339 case I_UNLINK:
339 340 case I_SENDFD:
340 341 prt_dec(pri, 0, val);
341 342 break;
342 343 case I_SRDOPT:
343 344 if (raw || (s = strrdopt(val)) == NULL)
344 345 prt_dec(pri, 0, val);
345 346 else
346 347 outstring(pri, s);
347 348 break;
348 349 case I_SETSIG:
349 350 if (raw || (s = strevents(pri, val)) == NULL)
350 351 prt_hex(pri, 0, val);
351 352 else
352 353 outstring(pri, s);
353 354 break;
354 355 case I_FLUSH:
355 356 if (raw || (s = strflush(val)) == NULL)
356 357 prt_dec(pri, 0, val);
357 358 else
358 359 outstring(pri, s);
359 360 break;
360 361
361 362 /* tty ioctl()s */
362 363 case TCSBRK:
363 364 case TCXONC:
364 365 case TCFLSH:
365 366 case TCDSET:
366 367 prt_dec(pri, 0, val);
367 368 break;
368 369
369 370 default:
370 371 prt_hex(pri, 0, val);
371 372 break;
372 373 }
373 374 }
374 375
375 376 void
376 377 prt_pip(private_t *pri, int raw, long val) /* print pipe code */
377 378 {
378 379 const char *s = NULL;
379 380
380 381 if (!raw) {
381 382 switch (val) {
382 383 case O_CLOEXEC:
383 384 s = "O_CLOEXEC";
384 385 break;
385 386 case O_NONBLOCK:
386 387 s = "O_NONBLOCK";
387 388 break;
388 389 case O_CLOEXEC|O_NONBLOCK:
389 390 s = "O_CLOEXEC|O_NONBLOCK";
390 391 break;
391 392 }
392 393 }
393 394
394 395 if (s == NULL)
395 396 prt_dex(pri, 0, val);
396 397 else
397 398 outstring(pri, s);
398 399 }
399 400
400 401 void
401 402 prt_pfd(private_t *pri, int raw, long val) /* print pipe code */
402 403 {
403 404 int fds[2];
404 405 char str[32];
405 406
406 407 /* the fds only have meaning if the return value is 0 */
407 408 if (!raw &&
408 409 pri->Rval1 >= 0 &&
409 410 Pread(Proc, fds, sizeof (fds), (long)val) == sizeof (fds)) {
410 411 (void) snprintf(str, sizeof (str), "[%d,%d]", fds[0], fds[1]);
411 412 outstring(pri, str);
412 413 } else {
413 414 prt_hex(pri, 0, val);
414 415 }
415 416 }
416 417
417 418 void
418 419 prt_fcn(private_t *pri, int raw, long val) /* print fcntl code */
419 420 {
420 421 const char *s = raw? NULL : fcntlname(val);
421 422
422 423 if (s == NULL)
423 424 prt_dec(pri, 0, val);
424 425 else
425 426 outstring(pri, s);
426 427 }
427 428
428 429 void
429 430 prt_s86(private_t *pri, int raw, long val) /* print sysi86 code */
430 431 {
431 432
432 433 const char *s = raw? NULL : si86name(val);
433 434
434 435 if (s == NULL)
435 436 prt_dec(pri, 0, val);
436 437 else
437 438 outstring(pri, s);
438 439 }
439 440
440 441 void
441 442 prt_uts(private_t *pri, int raw, long val) /* print utssys code */
442 443 {
443 444 const char *s = raw? NULL : utscode(val);
444 445
445 446 if (s == NULL)
446 447 prt_dec(pri, 0, val);
447 448 else
448 449 outstring(pri, s);
449 450 }
450 451
451 452 void
452 453 prt_msc(private_t *pri, int raw, long val) /* print msgsys command */
453 454 {
454 455 const char *s = raw? NULL : msgcmd(val);
455 456
456 457 if (s == NULL)
457 458 prt_dec(pri, 0, val);
458 459 else
459 460 outstring(pri, s);
460 461 }
461 462
462 463 void
463 464 prt_msf(private_t *pri, int raw, long val) /* print msgsys flags */
464 465 {
465 466 const char *s = raw? NULL : msgflags(pri, (int)val);
466 467
467 468 if (s == NULL)
468 469 prt_oct(pri, 0, val);
469 470 else
470 471 outstring(pri, s);
471 472 }
472 473
473 474 void
474 475 prt_smc(private_t *pri, int raw, long val) /* print semsys command */
475 476 {
476 477 const char *s = raw? NULL : semcmd(val);
477 478
478 479 if (s == NULL)
479 480 prt_dec(pri, 0, val);
480 481 else
481 482 outstring(pri, s);
482 483 }
483 484
484 485 void
485 486 prt_sef(private_t *pri, int raw, long val) /* print semsys flags */
486 487 {
487 488 const char *s = raw? NULL : semflags(pri, (int)val);
488 489
489 490 if (s == NULL)
490 491 prt_oct(pri, 0, val);
491 492 else
492 493 outstring(pri, s);
493 494 }
494 495
495 496 void
496 497 prt_shc(private_t *pri, int raw, long val) /* print shmsys command */
497 498 {
498 499 const char *s = raw? NULL : shmcmd(val);
499 500
500 501 if (s == NULL)
501 502 prt_dec(pri, 0, val);
502 503 else
503 504 outstring(pri, s);
504 505 }
505 506
506 507 void
507 508 prt_shf(private_t *pri, int raw, long val) /* print shmsys flags */
508 509 {
509 510 const char *s = raw? NULL : shmflags(pri, (int)val);
510 511
511 512 if (s == NULL)
512 513 prt_oct(pri, 0, val);
513 514 else
514 515 outstring(pri, s);
515 516 }
516 517
517 518 void
518 519 prt_sfs(private_t *pri, int raw, long val) /* print sysfs code */
519 520 {
520 521 const char *s = raw? NULL : sfsname(val);
521 522
522 523 if (s == NULL)
523 524 prt_dec(pri, 0, val);
524 525 else
525 526 outstring(pri, s);
526 527 }
527 528
528 529 void
529 530 prt_opn(private_t *pri, int raw, long val) /* print open code */
530 531 {
531 532 const char *s = raw? NULL : openarg(pri, val);
532 533
533 534 if (s == NULL)
534 535 prt_oct(pri, 0, val);
535 536 else
536 537 outstring(pri, s);
537 538 }
538 539
539 540 void
540 541 prt_sig(private_t *pri, int raw, long val) /* print signal name */
541 542 {
542 543 const char *s = raw? NULL : signame(pri, (int)val);
543 544
544 545 if (s == NULL)
545 546 prt_hex(pri, 0, val);
546 547 else
547 548 outstring(pri, s);
548 549 }
549 550
550 551 void
551 552 prt_smf(private_t *pri, int raw, long val) /* print streams message flags */
552 553 {
553 554 switch (val) {
554 555 case 0:
555 556 prt_dec(pri, 0, val);
556 557 break;
557 558 case RS_HIPRI:
558 559 if (raw)
559 560 prt_hhx(pri, 0, val);
560 561 else
561 562 outstring(pri, "RS_HIPRI");
562 563 break;
563 564 default:
564 565 prt_hhx(pri, 0, val);
565 566 break;
566 567 }
567 568 }
568 569
569 570 void
570 571 prt_mtf(private_t *pri, int raw, long val) /* print mount flags */
571 572 {
572 573 const char *s = raw? NULL : mountflags(pri, val);
573 574
574 575 if (s == NULL)
575 576 prt_hex(pri, 0, val);
576 577 else
577 578 outstring(pri, s);
578 579 }
579 580
580 581 void
581 582 prt_mft(private_t *pri, int raw, long val) /* print mount file system type */
582 583 {
583 584 if (val >= 0 && val < 256)
584 585 prt_dec(pri, 0, val);
585 586 else if (raw)
586 587 prt_hex(pri, 0, val);
587 588 else
588 589 prt_stg(pri, raw, val);
589 590 }
590 591
591 592 #define ISREAD(code) \
592 593 ((code) == SYS_read || (code) == SYS_pread || (code) == SYS_pread64 || \
593 594 (code) == SYS_recv || (code) == SYS_recvfrom)
594 595 #define ISWRITE(code) \
595 596 ((code) == SYS_write || (code) == SYS_pwrite || \
596 597 (code) == SYS_pwrite64 || (code) == SYS_send || (code) == SYS_sendto)
597 598
598 599 /* print contents of read() or write() I/O buffer */
599 600 void
600 601 prt_iob(private_t *pri, int raw, long val)
601 602 {
602 603 const lwpstatus_t *Lsp = pri->lwpstat;
603 604 int syscall = Lsp->pr_what;
604 605 int fdp1 = pri->sys_args[0] + 1;
605 606 ssize_t nbyte = ISWRITE(syscall)? pri->sys_args[2] :
606 607 (pri->Errno? 0 : pri->Rval1);
607 608 int elsewhere = FALSE; /* TRUE iff dumped elsewhere */
608 609 char buffer[IOBSIZE];
609 610
610 611 pri->iob_buf[0] = '\0';
611 612
612 613 if (Lsp->pr_why == PR_SYSEXIT && nbyte > IOBSIZE) {
613 614 if (ISREAD(syscall))
614 615 elsewhere = prismember(&readfd, fdp1);
615 616 else
616 617 elsewhere = prismember(&writefd, fdp1);
617 618 }
618 619
619 620 if (nbyte <= 0 || elsewhere)
620 621 prt_hex(pri, 0, val);
621 622 else {
622 623 int nb = nbyte > IOBSIZE? IOBSIZE : (int)nbyte;
623 624
624 625 if (Pread(Proc, buffer, (size_t)nb, (long)val) != nb)
625 626 prt_hex(pri, 0, val);
626 627 else {
627 628 pri->iob_buf[0] = '"';
628 629 showbytes(buffer, nb, pri->iob_buf + 1);
629 630 (void) strlcat(pri->iob_buf,
630 631 (nb == nbyte)?
631 632 (const char *)"\"" : (const char *)"\"..",
632 633 sizeof (pri->iob_buf));
633 634 if (raw)
634 635 prt_hex(pri, 0, val);
635 636 else
636 637 outstring(pri, pri->iob_buf);
637 638 }
638 639 }
639 640 }
640 641 #undef ISREAD
641 642 #undef ISWRITE
642 643
643 644 void
644 645 prt_idt(private_t *pri, int raw, long val) /* print idtype_t, waitid() arg */
645 646 {
646 647 const char *s = raw? NULL : idtype_enum(pri, val);
647 648
648 649 if (s == NULL)
649 650 prt_dec(pri, 0, val);
650 651 else
651 652 outstring(pri, s);
652 653 }
653 654
654 655 void
655 656 prt_wop(private_t *pri, int raw, long val) /* print waitid() options */
656 657 {
657 658 const char *s = raw? NULL : woptions(pri, (int)val);
658 659
659 660 if (s == NULL)
660 661 prt_oct(pri, 0, val);
661 662 else
662 663 outstring(pri, s);
663 664 }
664 665
665 666 void
666 667 prt_whn(private_t *pri, int raw, long val) /* print lseek() whence argument */
667 668 {
668 669 const char *s = raw? NULL : whencearg(val);
669 670
670 671 if (s == NULL)
671 672 prt_dec(pri, 0, val);
672 673 else
673 674 outstring(pri, s);
674 675 }
675 676
676 677 /*ARGSUSED*/
677 678 void
678 679 prt_spm(private_t *pri, int raw, long val) /* print sigprocmask argument */
679 680 {
680 681 const char *s = NULL;
681 682
682 683 if (!raw) {
683 684 switch (val) {
684 685 case SIG_BLOCK: s = "SIG_BLOCK"; break;
685 686 case SIG_UNBLOCK: s = "SIG_UNBLOCK"; break;
686 687 case SIG_SETMASK: s = "SIG_SETMASK"; break;
687 688 }
688 689 }
689 690
690 691 if (s == NULL)
691 692 prt_dec(pri, 0, val);
692 693 else
693 694 outstring(pri, s);
694 695 }
695 696
696 697 const char *
697 698 mmap_protect(private_t *pri, long arg)
698 699 {
699 700 char *str = pri->code_buf;
700 701
701 702 if (arg & ~(PROT_READ|PROT_WRITE|PROT_EXEC))
702 703 return ((char *)NULL);
703 704
704 705 if (arg == PROT_NONE)
705 706 return ("PROT_NONE");
706 707
707 708 *str = '\0';
708 709 if (arg & PROT_READ)
709 710 (void) strlcat(str, "|PROT_READ", sizeof (pri->code_buf));
710 711 if (arg & PROT_WRITE)
711 712 (void) strlcat(str, "|PROT_WRITE", sizeof (pri->code_buf));
712 713 if (arg & PROT_EXEC)
713 714 (void) strlcat(str, "|PROT_EXEC", sizeof (pri->code_buf));
714 715 return ((const char *)(str + 1));
715 716 }
716 717
717 718 const char *
718 719 mmap_type(private_t *pri, long arg)
719 720 {
720 721 char *str = pri->code_buf;
721 722 size_t used;
722 723
723 724 #define CBSIZE sizeof (pri->code_buf)
724 725 switch (arg & MAP_TYPE) {
725 726 case MAP_SHARED:
726 727 used = strlcpy(str, "MAP_SHARED", CBSIZE);
727 728 break;
728 729 case MAP_PRIVATE:
729 730 used = strlcpy(str, "MAP_PRIVATE", CBSIZE);
730 731 break;
731 732 default:
732 733 used = snprintf(str, CBSIZE, "%ld", arg&MAP_TYPE);
733 734 break;
734 735 }
735 736
736 737 arg &= ~(_MAP_NEW|MAP_TYPE);
737 738
738 739 if (arg & ~(MAP_FIXED|MAP_RENAME|MAP_NORESERVE|MAP_ANON|MAP_ALIGN|
739 740 MAP_TEXT|MAP_INITDATA|MAP_32BIT))
740 741 (void) snprintf(str + used, sizeof (pri->code_buf) - used,
741 742 "|0x%lX", arg);
742 743 else {
743 744 if (arg & MAP_FIXED)
744 745 (void) strlcat(str, "|MAP_FIXED", CBSIZE);
745 746 if (arg & MAP_RENAME)
746 747 (void) strlcat(str, "|MAP_RENAME", CBSIZE);
747 748 if (arg & MAP_NORESERVE)
748 749 (void) strlcat(str, "|MAP_NORESERVE", CBSIZE);
749 750 if (arg & MAP_ANON)
750 751 (void) strlcat(str, "|MAP_ANON", CBSIZE);
751 752 if (arg & MAP_ALIGN)
752 753 (void) strlcat(str, "|MAP_ALIGN", CBSIZE);
753 754 if (arg & MAP_TEXT)
754 755 (void) strlcat(str, "|MAP_TEXT", CBSIZE);
755 756 if (arg & MAP_INITDATA)
756 757 (void) strlcat(str, "|MAP_INITDATA", CBSIZE);
757 758 if (arg & MAP_32BIT)
758 759 (void) strlcat(str, "|MAP_32BIT", CBSIZE);
759 760 }
760 761
761 762 return ((const char *)str);
762 763 #undef CBSIZE
763 764 }
764 765
765 766 void
766 767 prt_mpr(private_t *pri, int raw, long val) /* print mmap()/mprotect() flags */
767 768 {
768 769 const char *s = raw? NULL : mmap_protect(pri, val);
769 770
770 771 if (s == NULL)
771 772 prt_hhx(pri, 0, val);
772 773 else
773 774 outstring(pri, s);
774 775 }
775 776
776 777 void
777 778 prt_mty(private_t *pri, int raw, long val) /* print mmap() mapping type flags */
778 779 {
779 780 const char *s = raw? NULL : mmap_type(pri, val);
780 781
781 782 if (s == NULL)
782 783 prt_hhx(pri, 0, val);
783 784 else
784 785 outstring(pri, s);
785 786 }
786 787
787 788 void
788 789 prt_mob(private_t *pri, int raw, long val) /* print mmapobj() flags */
789 790 {
790 791 if (val == 0)
791 792 prt_dec(pri, 0, val);
792 793 else if (raw || (val & ~(MMOBJ_PADDING|MMOBJ_INTERPRET)) != 0)
793 794 prt_hhx(pri, 0, val);
794 795 else {
795 796 #define CBSIZE sizeof (pri->code_buf)
796 797 char *s = pri->code_buf;
797 798
798 799 *s = '\0';
799 800 if (val & MMOBJ_PADDING)
800 801 (void) strlcat(s, "|MMOBJ_PADDING", CBSIZE);
801 802 if (val & MMOBJ_INTERPRET)
802 803 (void) strlcat(s, "|MMOBJ_INTERPRET", CBSIZE);
803 804 outstring(pri, s + 1);
804 805 #undef CBSIZE
805 806 }
806 807 }
807 808
808 809 /*ARGSUSED*/
809 810 void
810 811 prt_mcf(private_t *pri, int raw, long val) /* print memcntl() function */
811 812 {
812 813 const char *s = NULL;
813 814
814 815 if (!raw) {
815 816 switch (val) {
816 817 case MC_SYNC: s = "MC_SYNC"; break;
817 818 case MC_LOCK: s = "MC_LOCK"; break;
818 819 case MC_UNLOCK: s = "MC_UNLOCK"; break;
819 820 case MC_ADVISE: s = "MC_ADVISE"; break;
820 821 case MC_LOCKAS: s = "MC_LOCKAS"; break;
821 822 case MC_UNLOCKAS: s = "MC_UNLOCKAS"; break;
822 823 case MC_HAT_ADVISE: s = "MC_HAT_ADVISE"; break;
823 824 }
824 825 }
825 826
826 827 if (s == NULL)
827 828 prt_dec(pri, 0, val);
828 829 else
829 830 outstring(pri, s);
830 831 }
831 832
832 833 void
833 834 prt_mad(private_t *pri, int raw, long val) /* print madvise() argument */
834 835 {
835 836 const char *s = NULL;
836 837
837 838 if (!raw) {
838 839 switch (val) {
839 840 case MADV_NORMAL: s = "MADV_NORMAL"; break;
840 841 case MADV_RANDOM: s = "MADV_RANDOM"; break;
841 842 case MADV_SEQUENTIAL: s = "MADV_SEQUENTIAL"; break;
842 843 case MADV_WILLNEED: s = "MADV_WILLNEED"; break;
843 844 case MADV_DONTNEED: s = "MADV_DONTNEED"; break;
844 845 case MADV_FREE: s = "MADV_FREE"; break;
845 846 case MADV_ACCESS_DEFAULT: s = "MADV_ACCESS_DEFAULT"; break;
846 847 case MADV_ACCESS_LWP: s = "MADV_ACCESS_LWP"; break;
847 848 case MADV_ACCESS_MANY: s = "MADV_ACCESS_MANY"; break;
848 849 case MADV_PURGE: s = "MADV_PURGE"; break;
849 850 }
850 851 }
851 852
852 853 if (s == NULL)
853 854 prt_dec(pri, 0, val);
854 855 else
855 856 outstring(pri, s);
856 857 }
857 858
858 859 void
859 860 prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
860 861 {
861 862 if (val == 0)
862 863 prt_dec(pri, 0, val);
863 864 else if (raw)
864 865 prt_hhx(pri, 0, val);
865 866 else {
866 867 char *s = NULL;
867 868
868 869 #define CBSIZE sizeof (pri->code_buf)
869 870 /* cheating -- look at memcntl func */
870 871 switch (pri->sys_args[2]) {
871 872 case MC_ADVISE:
872 873 prt_mad(pri, 0, val);
873 874 return;
874 875
875 876 case MC_SYNC:
876 877 if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) {
877 878 *(s = pri->code_buf) = '\0';
878 879 if (val & MS_SYNC)
879 880 (void) strlcat(s, "|MS_SYNC", CBSIZE);
880 881 if (val & MS_ASYNC)
881 882 (void) strlcat(s, "|MS_ASYNC", CBSIZE);
882 883 if (val & MS_INVALIDATE)
883 884 (void) strlcat(s, "|MS_INVALIDATE",
884 885 CBSIZE);
885 886 }
886 887 break;
887 888
888 889 case MC_LOCKAS:
889 890 case MC_UNLOCKAS:
890 891 if ((val & ~(MCL_CURRENT|MCL_FUTURE)) == 0) {
891 892 *(s = pri->code_buf) = '\0';
892 893 if (val & MCL_CURRENT)
893 894 (void) strlcat(s, "|MCL_CURRENT",
894 895 CBSIZE);
895 896 if (val & MCL_FUTURE)
896 897 (void) strlcat(s, "|MCL_FUTURE",
897 898 CBSIZE);
898 899 }
899 900 break;
900 901 }
901 902 #undef CBSIZE
902 903
903 904 if (s == NULL || *s == '\0')
904 905 prt_hhx(pri, 0, val);
905 906 else
906 907 outstring(pri, ++s);
907 908 }
908 909 }
909 910
910 911 void
911 912 prt_mc5(private_t *pri, int raw, long val) /* print memcntl() (5th) argument */
912 913 {
913 914 char *s;
914 915
915 916 #define CBSIZE sizeof (pri->code_buf)
916 917 if (val == 0)
917 918 prt_dec(pri, 0, val);
918 919 else if (raw || (val & ~VALID_ATTR))
919 920 prt_hhx(pri, 0, val);
920 921 else {
921 922 s = pri->code_buf;
922 923 *s = '\0';
923 924 if (val & SHARED)
924 925 (void) strlcat(s, "|SHARED", CBSIZE);
925 926 if (val & PRIVATE)
926 927 (void) strlcat(s, "|PRIVATE", CBSIZE);
927 928 if (val & PROT_READ)
928 929 (void) strlcat(s, "|PROT_READ", CBSIZE);
929 930 if (val & PROT_WRITE)
930 931 (void) strlcat(s, "|PROT_WRITE", CBSIZE);
931 932 if (val & PROT_EXEC)
932 933 (void) strlcat(s, "|PROT_EXEC", CBSIZE);
933 934 if (*s == '\0')
934 935 prt_hhx(pri, 0, val);
935 936 else
936 937 outstring(pri, ++s);
937 938 }
938 939 #undef CBSIZE
939 940 }
940 941
941 942 void
942 943 prt_ulm(private_t *pri, int raw, long val) /* print ulimit() argument */
943 944 {
944 945 const char *s = NULL;
945 946
946 947 if (!raw) {
947 948 switch (val) {
948 949 case UL_GFILLIM: s = "UL_GFILLIM"; break;
949 950 case UL_SFILLIM: s = "UL_SFILLIM"; break;
950 951 case UL_GMEMLIM: s = "UL_GMEMLIM"; break;
951 952 case UL_GDESLIM: s = "UL_GDESLIM"; break;
952 953 }
953 954 }
954 955
955 956 if (s == NULL)
956 957 prt_dec(pri, 0, val);
957 958 else
958 959 outstring(pri, s);
959 960 }
960 961
961 962 void
962 963 prt_rlm(private_t *pri, int raw, long val) /* print get/setrlimit() argument */
963 964 {
964 965 const char *s = NULL;
965 966
966 967 if (!raw) {
967 968 switch (val) {
968 969 case RLIMIT_CPU: s = "RLIMIT_CPU"; break;
969 970 case RLIMIT_FSIZE: s = "RLIMIT_FSIZE"; break;
970 971 case RLIMIT_DATA: s = "RLIMIT_DATA"; break;
971 972 case RLIMIT_STACK: s = "RLIMIT_STACK"; break;
972 973 case RLIMIT_CORE: s = "RLIMIT_CORE"; break;
973 974 case RLIMIT_NOFILE: s = "RLIMIT_NOFILE"; break;
974 975 case RLIMIT_VMEM: s = "RLIMIT_VMEM"; break;
975 976 }
976 977 }
977 978
978 979 if (s == NULL)
979 980 prt_dec(pri, 0, val);
980 981 else
981 982 outstring(pri, s);
982 983 }
983 984
984 985 void
985 986 prt_cnf(private_t *pri, int raw, long val) /* print sysconfig code */
986 987 {
987 988 const char *s = raw? NULL : sconfname(val);
988 989
989 990 if (s == NULL)
990 991 prt_dec(pri, 0, val);
991 992 else
992 993 outstring(pri, s);
993 994 }
994 995
995 996 void
996 997 prt_inf(private_t *pri, int raw, long val) /* print sysinfo code */
997 998 {
998 999 const char *s = NULL;
999 1000
1000 1001 if (!raw) {
1001 1002 switch (val) {
1002 1003 case SI_SYSNAME: s = "SI_SYSNAME"; break;
1003 1004 case SI_HOSTNAME: s = "SI_HOSTNAME"; break;
1004 1005 case SI_RELEASE: s = "SI_RELEASE"; break;
1005 1006 case SI_VERSION: s = "SI_VERSION"; break;
1006 1007 case SI_MACHINE: s = "SI_MACHINE"; break;
1007 1008 case SI_ARCHITECTURE: s = "SI_ARCHITECTURE"; break;
1008 1009 case SI_ARCHITECTURE_32:s = "SI_ARCHITECTURE_32"; break;
1009 1010 case SI_ARCHITECTURE_64:s = "SI_ARCHITECTURE_64"; break;
1010 1011 case SI_ARCHITECTURE_K: s = "SI_ARCHITECTURE_K"; break;
1011 1012 case SI_HW_SERIAL: s = "SI_HW_SERIAL"; break;
1012 1013 case SI_HW_PROVIDER: s = "SI_HW_PROVIDER"; break;
1013 1014 case SI_SRPC_DOMAIN: s = "SI_SRPC_DOMAIN"; break;
1014 1015 case SI_SET_HOSTNAME: s = "SI_SET_HOSTNAME"; break;
1015 1016 case SI_SET_SRPC_DOMAIN: s = "SI_SET_SRPC_DOMAIN"; break;
1016 1017 case SI_PLATFORM: s = "SI_PLATFORM"; break;
1017 1018 case SI_ISALIST: s = "SI_ISALIST"; break;
1018 1019 case SI_DHCP_CACHE: s = "SI_DHCP_CACHE"; break;
1019 1020 }
1020 1021 }
1021 1022
1022 1023 if (s == NULL)
1023 1024 prt_dec(pri, 0, val);
1024 1025 else
1025 1026 outstring(pri, s);
1026 1027 }
1027 1028
1028 1029 void
1029 1030 prt_ptc(private_t *pri, int raw, long val) /* print pathconf code */
1030 1031 {
1031 1032 const char *s = raw? NULL : pathconfname(val);
1032 1033
1033 1034 if (s == NULL)
1034 1035 prt_dec(pri, 0, val);
1035 1036 else
1036 1037 outstring(pri, s);
1037 1038 }
1038 1039
1039 1040 void
1040 1041 prt_fui(private_t *pri, int raw, long val) /* print fusers() input argument */
1041 1042 {
1042 1043 const char *s = raw? NULL : fuiname(val);
1043 1044
1044 1045 if (s == NULL)
1045 1046 prt_hhx(pri, 0, val);
1046 1047 else
1047 1048 outstring(pri, s);
1048 1049 }
1049 1050
1050 1051 void
1051 1052 prt_lwf(private_t *pri, int raw, long val) /* print lwp_create() flags */
1052 1053 {
1053 1054 char *s;
1054 1055
1055 1056 if (val == 0)
1056 1057 prt_dec(pri, 0, val);
1057 1058 else if (raw ||
1058 1059 (val & ~(LWP_DAEMON|LWP_DETACHED|LWP_SUSPENDED)))
1059 1060 prt_hhx(pri, 0, val);
1060 1061 else {
1061 1062 #define CBSIZE sizeof (pri->code_buf)
1062 1063 s = pri->code_buf;
1063 1064 *s = '\0';
1064 1065 if (val & LWP_DAEMON)
1065 1066 (void) strlcat(s, "|LWP_DAEMON", CBSIZE);
1066 1067 if (val & LWP_DETACHED)
1067 1068 (void) strlcat(s, "|LWP_DETACHED", CBSIZE);
1068 1069 if (val & LWP_SUSPENDED)
1069 1070 (void) strlcat(s, "|LWP_SUSPENDED", CBSIZE);
1070 1071 outstring(pri, ++s);
1071 1072 #undef CBSIZE
1072 1073 }
1073 1074 }
1074 1075
1075 1076 void
1076 1077 prt_itm(private_t *pri, int raw, long val) /* print [get|set]itimer() arg */
1077 1078 {
1078 1079 const char *s = NULL;
1079 1080
1080 1081 if (!raw) {
1081 1082 switch (val) {
1082 1083 case ITIMER_REAL: s = "ITIMER_REAL"; break;
1083 1084 case ITIMER_VIRTUAL: s = "ITIMER_VIRTUAL"; break;
1084 1085 case ITIMER_PROF: s = "ITIMER_PROF"; break;
1085 1086 #ifdef ITIMER_REALPROF
1086 1087 case ITIMER_REALPROF: s = "ITIMER_REALPROF"; break;
1087 1088 #endif
1088 1089 }
1089 1090 }
1090 1091
1091 1092 if (s == NULL)
1092 1093 prt_dec(pri, 0, val);
1093 1094 else
1094 1095 outstring(pri, s);
1095 1096 }
1096 1097
1097 1098 void
1098 1099 prt_mod(private_t *pri, int raw, long val) /* print modctl() code */
1099 1100 {
1100 1101 const char *s = NULL;
1101 1102
1102 1103 if (!raw) {
1103 1104 switch (val) {
1104 1105 case MODLOAD: s = "MODLOAD"; break;
1105 1106 case MODUNLOAD: s = "MODUNLOAD"; break;
1106 1107 case MODINFO: s = "MODINFO"; break;
1107 1108 case MODRESERVED: s = "MODRESERVED"; break;
1108 1109 case MODSETMINIROOT: s = "MODSETMINIROOT"; break;
1109 1110 case MODADDMAJBIND: s = "MODADDMAJBIND"; break;
1110 1111 case MODGETPATH: s = "MODGETPATH"; break;
1111 1112 case MODGETPATHLEN: s = "MODGETPATHLEN"; break;
1112 1113 case MODREADSYSBIND: s = "MODREADSYSBIND"; break;
1113 1114 case MODGETMAJBIND: s = "MODGETMAJBIND"; break;
1114 1115 case MODGETNAME: s = "MODGETNAME"; break;
1115 1116 case MODSIZEOF_DEVID: s = "MODSIZEOF_DEVID"; break;
1116 1117 case MODGETDEVID: s = "MODGETDEVID"; break;
1117 1118 case MODSIZEOF_MINORNAME: s = "MODSIZEOF_MINORNAME"; break;
1118 1119 case MODGETMINORNAME: s = "MODGETMINORNAME"; break;
1119 1120 case MODGETFBNAME: s = "MODGETFBNAME"; break;
1120 1121 case MODEVENTS: s = "MODEVENTS"; break;
1121 1122 case MODREREADDACF: s = "MODREREADDACF"; break;
1122 1123 case MODLOADDRVCONF: s = "MODLOADDRVCONF"; break;
1123 1124 case MODUNLOADDRVCONF: s = "MODUNLOADDRVCONF"; break;
1124 1125 case MODREMMAJBIND: s = "MODREMMAJBIND"; break;
1125 1126 case MODDEVT2INSTANCE: s = "MODDEVT2INSTANCE"; break;
1126 1127 case MODGETDEVFSPATH_LEN: s = "MODGETDEVFSPATH_LEN"; break;
1127 1128 case MODGETDEVFSPATH: s = "MODGETDEVFSPATH"; break;
1128 1129 case MODDEVID2PATHS: s = "MODDEVID2PATHS"; break;
1129 1130 case MODSETDEVPOLICY: s = "MODSETDEVPOLICY"; break;
1130 1131 case MODGETDEVPOLICY: s = "MODGETDEVPOLICY"; break;
1131 1132 case MODALLOCPRIV: s = "MODALLOCPRIV"; break;
1132 1133 case MODGETDEVPOLICYBYNAME:
1133 1134 s = "MODGETDEVPOLICYBYNAME"; break;
1134 1135 case MODLOADMINORPERM: s = "MODLOADMINORPERM"; break;
1135 1136 case MODADDMINORPERM: s = "MODADDMINORPERM"; break;
1136 1137 case MODREMMINORPERM: s = "MODREMMINORPERM"; break;
1137 1138 case MODREMDRVCLEANUP: s = "MODREMDRVCLEANUP"; break;
1138 1139 case MODDEVEXISTS: s = "MODDEVEXISTS"; break;
1139 1140 case MODDEVREADDIR: s = "MODDEVREADDIR"; break;
1140 1141 case MODDEVEMPTYDIR: s = "MODDEVEMPTYDIR"; break;
1141 1142 case MODDEVNAME: s = "MODDEVNAME"; break;
1142 1143 case MODGETDEVFSPATH_MI_LEN:
1143 1144 s = "MODGETDEVFSPATH_MI_LEN"; break;
1144 1145 case MODGETDEVFSPATH_MI:
1145 1146 s = "MODGETDEVFSPATH_MI"; break;
1146 1147 case MODREMDRVALIAS: s = "MODREMDRVALIAS"; break;
1147 1148 case MODHPOPS: s = "MODHPOPS"; break;
1148 1149 }
1149 1150 }
1150 1151
1151 1152 if (s == NULL)
1152 1153 prt_dec(pri, 0, val);
1153 1154 else
1154 1155 outstring(pri, s);
1155 1156 }
1156 1157
1157 1158 void
1158 1159 prt_acl(private_t *pri, int raw, long val) /* print acl() code */
1159 1160 {
1160 1161 const char *s = NULL;
1161 1162
1162 1163 if (!raw) {
1163 1164 switch (val) {
1164 1165 case GETACL: s = "GETACL"; break;
1165 1166 case SETACL: s = "SETACL"; break;
1166 1167 case GETACLCNT: s = "GETACLCNT"; break;
1167 1168 case ACE_GETACL: s = "ACE_GETACL"; break;
1168 1169 case ACE_SETACL: s = "ACE_SETACL"; break;
1169 1170 case ACE_GETACLCNT: s = "ACE_GETACLCNT"; break;
1170 1171 }
1171 1172 }
1172 1173
1173 1174 if (s == NULL)
1174 1175 prt_dec(pri, 0, val);
1175 1176 else
1176 1177 outstring(pri, s);
1177 1178 }
1178 1179
1179 1180 void
1180 1181 prt_aio(private_t *pri, int raw, long val) /* print kaio() code */
1181 1182 {
1182 1183 const char *s = NULL;
1183 1184 char buf[32];
1184 1185
1185 1186 if (!raw) {
1186 1187 switch (val & ~AIO_POLL_BIT) {
1187 1188 case AIOREAD: s = "AIOREAD"; break;
1188 1189 case AIOWRITE: s = "AIOWRITE"; break;
1189 1190 case AIOWAIT: s = "AIOWAIT"; break;
1190 1191 case AIOCANCEL: s = "AIOCANCEL"; break;
1191 1192 case AIONOTIFY: s = "AIONOTIFY"; break;
1192 1193 case AIOINIT: s = "AIOINIT"; break;
1193 1194 case AIOSTART: s = "AIOSTART"; break;
1194 1195 case AIOLIO: s = "AIOLIO"; break;
1195 1196 case AIOSUSPEND: s = "AIOSUSPEND"; break;
1196 1197 case AIOERROR: s = "AIOERROR"; break;
1197 1198 case AIOLIOWAIT: s = "AIOLIOWAIT"; break;
1198 1199 case AIOAREAD: s = "AIOAREAD"; break;
1199 1200 case AIOAWRITE: s = "AIOAWRITE"; break;
1200 1201 /*
1201 1202 * We have to hardcode the values for the 64-bit versions of
1202 1203 * these calls, because <sys/aio.h> defines them to be identical
1203 1204 * when compiled 64-bit. If our target is 32-bit, we still need
1204 1205 * to decode them correctly.
1205 1206 */
1206 1207 case 13: s = "AIOLIO64"; break;
1207 1208 case 14: s = "AIOSUSPEND64"; break;
1208 1209 case 15: s = "AUIOERROR64"; break;
1209 1210 case 16: s = "AIOLIOWAIT64"; break;
1210 1211 case 17: s = "AIOAREAD64"; break;
1211 1212 case 18: s = "AIOAWRITE64"; break;
1212 1213 case 19: s = "AIOCANCEL64"; break;
1213 1214
1214 1215 /*
1215 1216 * AIOFSYNC doesn't correspond to a syscall.
1216 1217 */
1217 1218 case AIOWAITN: s = "AIOWAITN"; break;
1218 1219 }
1219 1220 if (s != NULL && (val & AIO_POLL_BIT)) {
1220 1221 (void) strlcpy(buf, s, sizeof (buf));
1221 1222 (void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf));
1222 1223 s = (const char *)buf;
1223 1224 }
1224 1225 }
1225 1226
1226 1227 if (s == NULL)
1227 1228 prt_dec(pri, 0, val);
1228 1229 else
1229 1230 outstring(pri, s);
1230 1231 }
1231 1232
1232 1233 void
1233 1234 prt_aud(private_t *pri, int raw, long val) /* print auditsys() code */
1234 1235 {
1235 1236 const char *s = NULL;
1236 1237
1237 1238 if (!raw) {
1238 1239 switch (val) {
1239 1240 case BSM_GETAUID: s = "BSM_GETAUID"; break;
1240 1241 case BSM_SETAUID: s = "BSM_SETAUID"; break;
1241 1242 case BSM_GETAUDIT: s = "BSM_GETAUDIT"; break;
1242 1243 case BSM_SETAUDIT: s = "BSM_SETAUDIT"; break;
1243 1244 case BSM_AUDIT: s = "BSM_AUDIT"; break;
1244 1245 case BSM_AUDITCTL: s = "BSM_AUDITCTL"; break;
1245 1246 case BSM_GETAUDIT_ADDR: s = "BSM_GETAUDIT_ADDR"; break;
1246 1247 case BSM_SETAUDIT_ADDR: s = "BSM_SETAUDIT_ADDR"; break;
1247 1248 }
1248 1249 }
1249 1250
1250 1251 if (s == NULL)
1251 1252 prt_dec(pri, 0, val);
1252 1253 else
1253 1254 outstring(pri, s);
1254 1255 }
1255 1256
1256 1257 void
1257 1258 prt_cor(private_t *pri, int raw, long val) /* print corectl() subcode */
1258 1259 {
1259 1260 const char *s = NULL;
1260 1261
1261 1262 if (!raw) {
1262 1263 switch (val) {
1263 1264 case CC_SET_OPTIONS:
1264 1265 s = "CC_SET_OPTIONS"; break;
1265 1266 case CC_GET_OPTIONS:
1266 1267 s = "CC_GET_OPTIONS"; break;
1267 1268 case CC_SET_GLOBAL_PATH:
1268 1269 s = "CC_SET_GLOBAL_PATH"; break;
1269 1270 case CC_GET_GLOBAL_PATH:
1270 1271 s = "CC_GET_GLOBAL_PATH"; break;
1271 1272 case CC_SET_PROCESS_PATH:
1272 1273 s = "CC_SET_PROCESS_PATH"; break;
1273 1274 case CC_GET_PROCESS_PATH:
1274 1275 s = "CC_GET_PROCESS_PATH"; break;
1275 1276 case CC_SET_GLOBAL_CONTENT:
1276 1277 s = "CC_SET_GLOBAL_CONTENT"; break;
1277 1278 case CC_GET_GLOBAL_CONTENT:
1278 1279 s = "CC_GET_GLOBAL_CONTENT"; break;
1279 1280 case CC_SET_PROCESS_CONTENT:
1280 1281 s = "CC_SET_PROCESS_CONTENT"; break;
1281 1282 case CC_GET_PROCESS_CONTENT:
1282 1283 s = "CC_GET_PROCESS_CONTENT"; break;
1283 1284 case CC_SET_DEFAULT_PATH:
1284 1285 s = "CC_SET_DEFAULT_PATH"; break;
1285 1286 case CC_GET_DEFAULT_PATH:
1286 1287 s = "CC_GET_DEFAULT_PATH"; break;
1287 1288 case CC_SET_DEFAULT_CONTENT:
1288 1289 s = "CC_SET_DEFAULT_CONTENT"; break;
1289 1290 case CC_GET_DEFAULT_CONTENT:
1290 1291 s = "CC_GET_DEFAULT_CONTENT"; break;
1291 1292 }
1292 1293 }
1293 1294
1294 1295 if (s == NULL)
1295 1296 prt_dec(pri, 0, val);
1296 1297 else
1297 1298 outstring(pri, s);
1298 1299 }
1299 1300
1300 1301 void
1301 1302 prt_cco(private_t *pri, int raw, long val) /* print corectl() options */
1302 1303 {
1303 1304 char *s;
1304 1305
1305 1306 if (val == 0)
1306 1307 prt_dec(pri, 0, val);
1307 1308 else if (raw || (val & ~CC_OPTIONS))
1308 1309 prt_hhx(pri, 0, val);
1309 1310 else {
1310 1311 #define CBSIZE sizeof (pri->code_buf)
1311 1312 s = pri->code_buf;
1312 1313 *s = '\0';
1313 1314 if (val & CC_GLOBAL_PATH)
1314 1315 (void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE);
1315 1316 if (val & CC_PROCESS_PATH)
1316 1317 (void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE);
1317 1318 if (val & CC_GLOBAL_SETID)
1318 1319 (void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE);
1319 1320 if (val & CC_PROCESS_SETID)
1320 1321 (void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE);
1321 1322 if (val & CC_GLOBAL_LOG)
1322 1323 (void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE);
1323 1324 if (*s == '\0')
1324 1325 prt_hhx(pri, 0, val);
1325 1326 else
1326 1327 outstring(pri, ++s);
1327 1328 #undef CBSIZE
1328 1329 }
1329 1330 }
1330 1331
1331 1332 void
1332 1333 prt_ccc(private_t *pri, int raw, long val) /* print corectl() content */
1333 1334 {
1334 1335 core_content_t ccc;
1335 1336
1336 1337 if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1337 1338 prt_hex(pri, 0, val);
1338 1339 else if (!raw && proc_content2str(ccc, pri->code_buf,
1339 1340 sizeof (pri->code_buf)) >= 0)
1340 1341 outstring(pri, pri->code_buf);
1341 1342 else
1342 1343 prt_hhx(pri, 0, (long)ccc);
1343 1344 }
1344 1345
1345 1346 void
1346 1347 prt_rcc(private_t *pri, int raw, long val) /* print corectl() ret. cont. */
1347 1348 {
1348 1349 core_content_t ccc;
1349 1350
1350 1351 if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1351 1352 prt_hex(pri, 0, val);
1352 1353 else if (!raw && proc_content2str(ccc, pri->code_buf,
1353 1354 sizeof (pri->code_buf)) >= 0)
1354 1355 outstring(pri, pri->code_buf);
1355 1356 else
1356 1357 prt_hhx(pri, 0, (long)ccc);
1357 1358 }
1358 1359
1359 1360 void
1360 1361 prt_cpc(private_t *pri, int raw, long val) /* print cpc() subcode */
1361 1362 {
1362 1363 const char *s = NULL;
1363 1364
1364 1365 if (!raw) {
1365 1366 switch (val) {
1366 1367 case CPC_BIND: s = "CPC_BIND"; break;
1367 1368 case CPC_SAMPLE: s = "CPC_SAMPLE"; break;
1368 1369 case CPC_INVALIDATE: s = "CPC_INVALIDATE"; break;
1369 1370 case CPC_RELE: s = "CPC_RELE"; break;
1370 1371 case CPC_EVLIST_SIZE: s = "CPC_EVLIST_SIZE"; break;
1371 1372 case CPC_LIST_EVENTS: s = "CPC_LIST_EVENTS"; break;
1372 1373 case CPC_ATTRLIST_SIZE: s = "CPC_ATTRLIST_SIZE"; break;
1373 1374 case CPC_LIST_ATTRS: s = "CPC_LIST_ATTRS"; break;
1374 1375 case CPC_IMPL_NAME: s = "CPC_IMPL_NAME"; break;
1375 1376 case CPC_CPUREF: s = "CPC_CPUREF"; break;
1376 1377 case CPC_USR_EVENTS: s = "CPC_USR_EVENTS"; break;
1377 1378 case CPC_SYS_EVENTS: s = "CPC_SYS_EVENTS"; break;
1378 1379 case CPC_NPIC: s = "CPC_NPIC"; break;
1379 1380 case CPC_CAPS: s = "CPC_CAPS"; break;
1380 1381 case CPC_ENABLE: s = "CPC_ENABLE"; break;
1381 1382 case CPC_DISABLE: s = "CPC_DISABLE"; break;
1382 1383 }
1383 1384 }
1384 1385
1385 1386 if (s == NULL)
1386 1387 prt_dec(pri, 0, val);
1387 1388 else
1388 1389 outstring(pri, s);
1389 1390 }
1390 1391
1391 1392 void
1392 1393 outstring(private_t *pri, const char *s)
1393 1394 {
1394 1395 int len = strlen(s);
1395 1396
1396 1397 GROW(len);
1397 1398 (void) strcpy(pri->sys_string + pri->sys_leng, s);
1398 1399 pri->sys_leng += len;
1399 1400 }
1400 1401
1401 1402 void
1402 1403 grow(private_t *pri, int nbyte) /* reallocate format buffer if necessary */
1403 1404 {
1404 1405 while (pri->sys_leng + nbyte >= pri->sys_ssize)
1405 1406 pri->sys_string = my_realloc(pri->sys_string,
1406 1407 pri->sys_ssize *= 2, "format buffer");
1407 1408 }
1408 1409
1409 1410 void
1410 1411 prt_clc(private_t *pri, int raw, long val)
1411 1412 {
1412 1413 const char *s = NULL;
1413 1414
1414 1415 if (!raw) {
1415 1416 switch (val) {
1416 1417 case CL_INITIALIZE: s = "CL_INITIALIZE"; break;
1417 1418 case CL_CONFIG: s = "CL_CONFIG"; break;
1418 1419 }
1419 1420 }
1420 1421
1421 1422 if (s == NULL)
1422 1423 prt_dec(pri, 0, val);
1423 1424 else
1424 1425 outstring(pri, s);
1425 1426 }
1426 1427
1427 1428 void
1428 1429 prt_clf(private_t *pri, int raw, long val)
1429 1430 {
1430 1431 const char *s = NULL;
1431 1432
1432 1433 if (!raw) {
1433 1434 switch (pri->sys_args[0]) {
1434 1435 case CL_CONFIG:
1435 1436 switch (pri->sys_args[1]) {
1436 1437 case CL_NODEID:
1437 1438 s = "CL_NODEID"; break;
1438 1439 case CL_HIGHEST_NODEID:
1439 1440 s = "CL_HIGHEST_NODEID"; break;
1440 1441 }
1441 1442 break;
1442 1443 case CL_INITIALIZE:
1443 1444 switch (pri->sys_args[1]) {
1444 1445 case CL_GET_BOOTFLAG:
1445 1446 s = "CL_GET_BOOTFLAG"; break;
1446 1447 }
1447 1448 break;
1448 1449 }
1449 1450 }
1450 1451
1451 1452 if (s == NULL)
1452 1453 prt_dec(pri, 0, val);
1453 1454 else
1454 1455 outstring(pri, s);
1455 1456 }
1456 1457
1457 1458 void
1458 1459 prt_sqc(private_t *pri, int raw, long val) /* print sigqueue() si_code */
1459 1460 {
1460 1461 const char *s = NULL;
1461 1462
1462 1463 if (!raw) {
1463 1464 switch ((int)val) {
1464 1465 case SI_QUEUE: s = "SI_QUEUE"; break;
1465 1466 case SI_TIMER: s = "SI_TIMER"; break;
1466 1467 case SI_ASYNCIO: s = "SI_ASYNCIO"; break;
1467 1468 case SI_MESGQ: s = "SI_MESGQ"; break;
1468 1469 }
1469 1470 }
1470 1471
1471 1472 if (s == NULL)
1472 1473 prt_dec(pri, 0, val);
1473 1474 else
1474 1475 outstring(pri, s);
1475 1476 }
1476 1477
1477 1478 /*
1478 1479 * print priocntlsys() (key, value) pair key.
1479 1480 */
1480 1481 void
1481 1482 print_pck(private_t *pri, int raw, long val)
1482 1483 {
1483 1484 const char *s = NULL;
1484 1485 char clname[PC_CLNMSZ];
1485 1486
1486 1487 if ((pri->sys_args[2] != PC_GETXPARMS &&
1487 1488 pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) {
1488 1489 prt_dec(pri, 0, val);
1489 1490 return;
1490 1491 }
1491 1492
1492 1493 if (pri->sys_args[3] == NULL) {
1493 1494 if (val == PC_KY_CLNAME) {
1494 1495 s = "PC_KY_CLNAME";
1495 1496 outstring(pri, s);
1496 1497 } else
1497 1498 prt_dec(pri, 0, val);
1498 1499 return;
1499 1500 }
1500 1501
1501 1502 if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) {
1502 1503 prt_dec(pri, 0, val);
1503 1504 return;
1504 1505 }
1505 1506
1506 1507 if (strcmp(clname, "TS") == 0) {
1507 1508 switch (val) {
1508 1509 case TS_KY_UPRILIM: s = "TS_KY_UPRILIM"; break;
1509 1510 case TS_KY_UPRI: s = "TS_KY_UPRI"; break;
1510 1511 default: break;
1511 1512 }
1512 1513 } else if (strcmp(clname, "IA") == 0) {
1513 1514 switch (val) {
1514 1515 case IA_KY_UPRILIM: s = "IA_KY_UPRILIM"; break;
1515 1516 case IA_KY_UPRI: s = "IA_KY_UPRI"; break;
1516 1517 case IA_KY_MODE: s = "IA_KY_MODE"; break;
1517 1518 default: break;
1518 1519 }
1519 1520 } else if (strcmp(clname, "RT") == 0) {
1520 1521 switch (val) {
1521 1522 case RT_KY_PRI: s = "RT_KY_PRI"; break;
1522 1523 case RT_KY_TQSECS: s = "RT_KY_TQSECS"; break;
1523 1524 case RT_KY_TQNSECS: s = "RT_KY_TQNSECS"; break;
1524 1525 case RT_KY_TQSIG: s = "RT_KY_TQSIG"; break;
1525 1526 default: break;
1526 1527 }
1527 1528 } else if (strcmp(clname, "FSS") == 0) {
1528 1529 switch (val) {
1529 1530 case FSS_KY_UPRILIM: s = "FSS_KY_UPRILIM"; break;
1530 1531 case FSS_KY_UPRI: s = "FSS_KY_UPRI"; break;
1531 1532 default: break;
1532 1533 }
1533 1534 } else if (strcmp(clname, "FX") == 0) {
1534 1535 switch (val) {
1535 1536 case FX_KY_UPRILIM: s = "FX_KY_UPRILIM"; break;
1536 1537 case FX_KY_UPRI: s = "FX_KY_UPRI"; break;
1537 1538 case FX_KY_TQSECS: s = "FX_KY_TQSECS"; break;
1538 1539 case FX_KY_TQNSECS: s = "FX_KY_TQNSECS"; break;
1539 1540 default: break;
1540 1541 }
1541 1542 }
1542 1543
1543 1544 if (s == NULL)
1544 1545 prt_dec(pri, 0, val);
1545 1546 else
1546 1547 outstring(pri, s);
1547 1548 }
1548 1549
1549 1550 /*
1550 1551 * print priocntlsys() fourth argument.
1551 1552 */
1552 1553 /*ARGSUSED*/
1553 1554 void
1554 1555 prt_pc4(private_t *pri, int raw, long val)
1555 1556 {
1556 1557 /* look at pricntlsys function */
1557 1558 if ((pri->sys_args[2] != PC_GETXPARMS &&
1558 1559 pri->sys_args[2] != PC_SETXPARMS))
1559 1560 prt_hex(pri, 0, val);
1560 1561 else if (val)
1561 1562 prt_stg(pri, 0, val);
1562 1563 else
1563 1564 prt_dec(pri, 0, val);
1564 1565 }
1565 1566
1566 1567 /*
1567 1568 * print priocntlsys() (key, value) pairs (5th argument).
1568 1569 */
1569 1570 /*ARGSUSED*/
1570 1571 void
1571 1572 prt_pc5(private_t *pri, int raw, long val)
1572 1573 {
1573 1574 pc_vaparms_t prms;
1574 1575 pc_vaparm_t *vpp = &prms.pc_parms[0];
1575 1576 uint_t cnt;
1576 1577
1577 1578
1578 1579 /* look at pricntlsys function */
1579 1580 if ((pri->sys_args[2] != PC_GETXPARMS &&
1580 1581 pri->sys_args[2] != PC_SETXPARMS) || val == 0) {
1581 1582 prt_dec(pri, 0, 0);
1582 1583 return;
1583 1584 }
1584 1585
1585 1586 if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) {
1586 1587 prt_hex(pri, 0, val);
1587 1588 return;
1588 1589 }
1589 1590
1590 1591 if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT)
1591 1592 return;
1592 1593
↓ open down ↓ |
1513 lines elided |
↑ open up ↑ |
1593 1594 for (; cnt--; vpp++) {
1594 1595 print_pck(pri, 0, vpp->pc_key);
1595 1596 outstring(pri, ", ");
1596 1597 prt_hex(pri, 0, (long)vpp->pc_parm);
1597 1598 outstring(pri, ", ");
1598 1599 }
1599 1600
1600 1601 prt_dec(pri, 0, PC_KY_NULL);
1601 1602 }
1602 1603
1604 +
1605 +void
1606 +prt_psflags(private_t *pri, secflagset_t val)
1607 +{
1608 + char str[1024];
1609 +
1610 + if (val == 0) {
1611 + outstring(pri, "0x0");
1612 + return;
1613 + }
1614 +
1615 + *str = '\0';
1616 + if (secflag_isset(val, PROC_SEC_ASLR)) {
1617 + (void) strlcat(str, "|PROC_SEC_ASLR", sizeof (str));
1618 + secflag_clear(&val, PROC_SEC_ASLR);
1619 + }
1620 + if (secflag_isset(val, PROC_SEC_FORBIDNULLMAP)) {
1621 + (void) strlcat(str, "|PROC_SEC_FORBIDNULLMAP",
1622 + sizeof (str));
1623 + secflag_clear(&val, PROC_SEC_FORBIDNULLMAP);
1624 + }
1625 + if (secflag_isset(val, PROC_SEC_NOEXECSTACK)) {
1626 + (void) strlcat(str, "|PROC_SEC_NOEXECSTACK",
1627 + sizeof (str));
1628 + secflag_clear(&val, PROC_SEC_NOEXECSTACK);
1629 + }
1630 +
1631 + if (val != 0)
1632 + (void) snprintf(str, sizeof (str), "%s|%#x", str, val);
1633 +
1634 + outstring(pri, str + 1);
1635 +}
1636 +
1637 +/*
1638 + * Print a psecflags(2) delta
1639 + */
1640 +void
1641 +prt_psdelta(private_t *pri, int raw, long value)
1642 +{
1643 + secflagdelta_t psd;
1644 +
1645 + if ((raw != 0) ||
1646 + (Pread(Proc, &psd, sizeof (psd), value) != sizeof (psd))) {
1647 + prt_hex(pri, 0, value);
1648 + return;
1649 + }
1650 + outstring(pri, "{ ");
1651 + prt_psflags(pri, psd.psd_add);
1652 + outstring(pri, ", ");
1653 + prt_psflags(pri, psd.psd_rem);
1654 + outstring(pri, ", ");
1655 + prt_psflags(pri, psd.psd_assign);
1656 + outstring(pri, ", ");
1657 + outstring(pri, psd.psd_ass_active ? "B_TRUE" : "B_FALSE");
1658 + outstring(pri, " }");
1659 +}
1660 +
1661 +/*
1662 + * Print a psecflagswhich_t
1663 + */
1664 +void
1665 +prt_psfw(private_t *pri, int raw, long value)
1666 +{
1667 + psecflagwhich_t which = (psecflagwhich_t)value;
1668 + char *s;
1669 +
1670 + if (raw != 0) {
1671 + prt_dec(pri, 0, value);
1672 + return;
1673 + }
1674 +
1675 + switch (which) {
1676 + case PSF_EFFECTIVE:
1677 + s = "PSF_EFFECTIVE";
1678 + break;
1679 + case PSF_INHERIT:
1680 + s = "PSF_INHERIT";
1681 + break;
1682 + case PSF_LOWER:
1683 + s = "PSF_LOWER";
1684 + break;
1685 + case PSF_UPPER:
1686 + s = "PSF_UPPER";
1687 + break;
1688 + }
1689 +
1690 + if (s == NULL)
1691 + prt_dec(pri, 0, value);
1692 + else
1693 + outstring(pri, s);
1694 +}
1695 +
1603 1696 /*
1604 1697 * Print processor set id, including logical expansion of "special" ids.
1605 1698 */
1606 1699 void
1607 1700 prt_pst(private_t *pri, int raw, long val)
1608 1701 {
1609 1702 const char *s = NULL;
1610 1703
1611 1704 if (!raw) {
1612 1705 switch ((psetid_t)val) {
1613 1706 case PS_NONE: s = "PS_NONE"; break;
1614 1707 case PS_QUERY: s = "PS_QUERY"; break;
1615 1708 case PS_MYID: s = "PS_MYID"; break;
1616 1709 }
1617 1710 }
1618 1711
1619 1712 if (s == NULL)
1620 1713 prt_dec(pri, 0, val);
1621 1714 else
1622 1715 outstring(pri, s);
1623 1716 }
1624 1717
1625 1718 /*
1626 1719 * Print meminfo() argument.
1627 1720 */
1628 1721 /*ARGSUSED*/
1629 1722 void
1630 1723 prt_mif(private_t *pri, int raw, long val)
1631 1724 {
1632 1725 struct meminfo minfo;
1633 1726
1634 1727 #ifdef _LP64
1635 1728 if (data_model == PR_MODEL_ILP32) {
1636 1729 struct meminfo32 minfo32;
1637 1730
1638 1731 if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) !=
1639 1732 sizeof (struct meminfo32)) {
1640 1733 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1641 1734 outstring(pri, ", ");
1642 1735 prt_hex(pri, 0, val);
1643 1736 return;
1644 1737 }
1645 1738 /*
1646 1739 * arrange the arguments in the order that user calls with
1647 1740 */
1648 1741 prt_hex(pri, 0, minfo32.mi_inaddr);
1649 1742 outstring(pri, ", ");
1650 1743 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1651 1744 outstring(pri, ", ");
1652 1745 prt_hex(pri, 0, minfo32.mi_info_req);
1653 1746 outstring(pri, ", ");
1654 1747 prt_dec(pri, 0, minfo32.mi_info_count);
1655 1748 outstring(pri, ", ");
1656 1749 prt_hex(pri, 0, minfo32.mi_outdata);
1657 1750 outstring(pri, ", ");
1658 1751 prt_hex(pri, 0, minfo32.mi_validity);
1659 1752 return;
1660 1753 }
1661 1754 #endif
1662 1755 if (Pread(Proc, &minfo, sizeof (struct meminfo), val) !=
1663 1756 sizeof (struct meminfo)) {
1664 1757 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1665 1758 outstring(pri, ", ");
1666 1759 prt_hex(pri, 0, val);
1667 1760 return;
1668 1761 }
1669 1762 /*
1670 1763 * arrange the arguments in the order that user calls with
1671 1764 */
1672 1765 prt_hex(pri, 0, (long)minfo.mi_inaddr);
1673 1766 outstring(pri, ", ");
1674 1767 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1675 1768 outstring(pri, ", ");
1676 1769 prt_hex(pri, 0, (long)minfo.mi_info_req);
1677 1770 outstring(pri, ", ");
1678 1771 prt_dec(pri, 0, minfo.mi_info_count);
1679 1772 outstring(pri, ", ");
1680 1773 prt_hex(pri, 0, (long)minfo.mi_outdata);
1681 1774 outstring(pri, ", ");
1682 1775 prt_hex(pri, 0, (long)minfo.mi_validity);
1683 1776 }
1684 1777
1685 1778
1686 1779 /*
1687 1780 * Print so_socket() 1st argument.
1688 1781 */
1689 1782 /*ARGSUSED*/
1690 1783 void
1691 1784 prt_pfm(private_t *pri, int raw, long val)
1692 1785 {
1693 1786 /* Protocol Families have same names as Address Families */
1694 1787 if ((ulong_t)val < MAX_AFCODES) {
1695 1788 outstring(pri, "PF_");
1696 1789 outstring(pri, afcodes[val]);
1697 1790 } else {
1698 1791 prt_dec(pri, 0, val);
1699 1792 }
1700 1793 }
1701 1794
1702 1795 /*
1703 1796 * Print sockconfig() subcode.
1704 1797 */
1705 1798 /*ARGSUSED*/
1706 1799 void
1707 1800 prt_skc(private_t *pri, int raw, long val)
1708 1801 {
1709 1802 const char *s = NULL;
1710 1803
1711 1804 if (!raw) {
1712 1805 switch (val) {
1713 1806 case SOCKCONFIG_ADD_SOCK:
1714 1807 s = "SOCKCONFIG_ADD_SOCK"; break;
1715 1808 case SOCKCONFIG_REMOVE_SOCK:
1716 1809 s = "SOCKCONFIG_REMOVE_SOCK"; break;
1717 1810 case SOCKCONFIG_ADD_FILTER:
1718 1811 s = "SOCKCONFIG_ADD_FILTER"; break;
1719 1812 case SOCKCONFIG_REMOVE_FILTER:
1720 1813 s = "SOCKCONFIG_REMOVE_FILTER"; break;
1721 1814 }
1722 1815 }
1723 1816 if (s == NULL)
1724 1817 prt_dec(pri, 0, val);
1725 1818 else
1726 1819 outstring(pri, s);
1727 1820 }
1728 1821 /*
1729 1822 * Print so_socket() 2nd argument.
1730 1823 */
1731 1824 /*ARGSUSED*/
1732 1825 void
1733 1826 prt_skt(private_t *pri, int raw, long val)
1734 1827 {
1735 1828 const char *s;
1736 1829 long type = val & SOCK_TYPE_MASK;
1737 1830
1738 1831 if ((ulong_t)type <= MAX_SOCKTYPES &&
1739 1832 (s = socktype_codes[type]) != NULL) {
1740 1833 outstring(pri, s);
1741 1834 if ((val & SOCK_CLOEXEC) != 0) {
1742 1835 outstring(pri, "|SOCK_CLOEXEC");
1743 1836 }
1744 1837 } else {
1745 1838 prt_dec(pri, 0, val);
1746 1839 }
1747 1840 }
1748 1841
1749 1842
1750 1843 /*
1751 1844 * Print so_socket() 3rd argument.
1752 1845 */
1753 1846 /*ARGSUSED*/
1754 1847 void
1755 1848 prt_skp(private_t *pri, int raw, long val)
1756 1849 {
1757 1850 const char *s;
1758 1851
1759 1852 /* cheating -- look at the protocol-family */
1760 1853 switch (pri->sys_args[0]) {
1761 1854 case PF_INET6:
1762 1855 case PF_INET:
1763 1856 case PF_NCA: if ((s = ipprotos((int)val)) != NULL) {
1764 1857 outstring(pri, s);
1765 1858 break;
1766 1859 }
1767 1860 /* FALLTHROUGH */
1768 1861 default: prt_dec(pri, 0, val);
1769 1862 break;
1770 1863 }
1771 1864 }
1772 1865
1773 1866
1774 1867 /*
1775 1868 * Print so_socket() 5th argument.
1776 1869 */
1777 1870 /*ARGSUSED*/
1778 1871 void
1779 1872 prt_skv(private_t *pri, int raw, long val)
1780 1873 {
1781 1874 switch (val) {
1782 1875 case SOV_STREAM: outstring(pri, "SOV_STREAM"); break;
1783 1876 case SOV_DEFAULT: outstring(pri, "SOV_DEFAULT"); break;
1784 1877 case SOV_SOCKSTREAM: outstring(pri, "SOV_SOCKSTREAM"); break;
1785 1878 case SOV_SOCKBSD: outstring(pri, "SOV_SOCKBSD"); break;
1786 1879 case SOV_XPG4_2: outstring(pri, "SOV_XPG4_2"); break;
1787 1880 default: prt_dec(pri, 0, val); break;
1788 1881 }
1789 1882 }
1790 1883
1791 1884 /*
1792 1885 * Print accept4() flags argument.
1793 1886 */
1794 1887 void
1795 1888 prt_acf(private_t *pri, int raw, long val)
1796 1889 {
1797 1890 int first = 1;
1798 1891 if (raw || !val ||
1799 1892 (val & ~(SOCK_CLOEXEC|SOCK_NDELAY|SOCK_NONBLOCK))) {
1800 1893 prt_dex(pri, 0, val);
1801 1894 return;
1802 1895 }
1803 1896
1804 1897 if (val & SOCK_CLOEXEC) {
1805 1898 outstring(pri, "|SOCK_CLOEXEC" + first);
1806 1899 first = 0;
1807 1900 }
1808 1901 if (val & SOCK_NDELAY) {
1809 1902 outstring(pri, "|SOCK_NDELAY" + first);
1810 1903 first = 0;
1811 1904 }
1812 1905 if (val & SOCK_NONBLOCK) {
1813 1906 outstring(pri, "|SOCK_NONBLOCK" + first);
1814 1907 }
1815 1908 }
1816 1909
1817 1910
1818 1911 /*
1819 1912 * Print setsockopt()/getsockopt() 2nd argument.
1820 1913 */
1821 1914 /*ARGSUSED*/
1822 1915 void
1823 1916 prt_sol(private_t *pri, int raw, long val)
1824 1917 {
1825 1918 if (val == SOL_SOCKET) {
1826 1919 outstring(pri, "SOL_SOCKET");
1827 1920 } else if (val == SOL_ROUTE) {
1828 1921 outstring(pri, "SOL_ROUTE");
1829 1922 } else {
1830 1923 const struct protoent *p;
1831 1924 struct protoent res;
1832 1925 char buf[NSS_BUFLEN_PROTOCOLS];
1833 1926
1834 1927 if ((p = getprotobynumber_r(val, &res,
1835 1928 (char *)buf, sizeof (buf))) != NULL)
1836 1929 outstring(pri, p->p_name);
1837 1930 else
1838 1931 prt_dec(pri, 0, val);
1839 1932 }
1840 1933 }
1841 1934
1842 1935
1843 1936 const char *
1844 1937 sol_optname(private_t *pri, long val)
1845 1938 {
1846 1939 #define CBSIZE sizeof (pri->code_buf)
1847 1940 if (val >= SO_SNDBUF) {
1848 1941 switch (val) {
1849 1942 case SO_SNDBUF: return ("SO_SNDBUF");
1850 1943 case SO_RCVBUF: return ("SO_RCVBUF");
1851 1944 case SO_SNDLOWAT: return ("SO_SNDLOWAT");
1852 1945 case SO_RCVLOWAT: return ("SO_RCVLOWAT");
1853 1946 case SO_SNDTIMEO: return ("SO_SNDTIMEO");
1854 1947 case SO_RCVTIMEO: return ("SO_RCVTIMEO");
1855 1948 case SO_ERROR: return ("SO_ERROR");
1856 1949 case SO_TYPE: return ("SO_TYPE");
1857 1950 case SO_PROTOTYPE: return ("SO_PROTOTYPE");
1858 1951 case SO_ANON_MLP: return ("SO_ANON_MLP");
1859 1952 case SO_MAC_EXEMPT: return ("SO_MAC_EXEMPT");
1860 1953 case SO_ALLZONES: return ("SO_ALLZONES");
1861 1954 case SO_MAC_IMPLICIT: return ("SO_MAC_IMPLICIT");
1862 1955 case SO_VRRP: return ("SO_VRRP");
1863 1956 case SO_EXCLBIND: return ("SO_EXCLBIND");
1864 1957 case SO_DOMAIN: return ("SO_DOMAIN");
1865 1958
1866 1959 default: (void) snprintf(pri->code_buf, CBSIZE,
1867 1960 "0x%lx", val);
1868 1961 return (pri->code_buf);
1869 1962 }
1870 1963 } else {
1871 1964 char *s = pri->code_buf;
1872 1965 size_t used = 1;
1873 1966 long val2;
1874 1967
1875 1968 *s = '\0';
1876 1969 val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE|
1877 1970 SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER|
1878 1971 SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED);
1879 1972 if (val2)
1880 1973 used = snprintf(s, CBSIZE, "|0x%lx", val2);
1881 1974 if (val & SO_DEBUG)
1882 1975 used = strlcat(s, "|SO_DEBUG", CBSIZE);
1883 1976 if (val & SO_ACCEPTCONN)
1884 1977 used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE);
1885 1978 if (val & SO_REUSEADDR)
1886 1979 used = strlcat(s, "|SO_REUSEADDR", CBSIZE);
1887 1980 if (val & SO_KEEPALIVE)
1888 1981 used = strlcat(s, "|SO_KEEPALIVE", CBSIZE);
1889 1982 if (val & SO_DONTROUTE)
1890 1983 used = strlcat(s, "|SO_DONTROUTE", CBSIZE);
1891 1984 if (val & SO_BROADCAST)
1892 1985 used = strlcat(s, "|SO_BROADCAST", CBSIZE);
1893 1986 if (val & SO_USELOOPBACK)
1894 1987 used = strlcat(s, "|SO_USELOOPBACK", CBSIZE);
1895 1988 if (val & SO_LINGER)
1896 1989 used = strlcat(s, "|SO_LINGER", CBSIZE);
1897 1990 if (val & SO_OOBINLINE)
1898 1991 used = strlcat(s, "|SO_OOBINLINE", CBSIZE);
1899 1992 if (val & SO_DGRAM_ERRIND)
1900 1993 used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE);
1901 1994 if (val & SO_RECVUCRED)
1902 1995 used = strlcat(s, "|SO_RECVUCRED", CBSIZE);
1903 1996 if (used >= CBSIZE || val == 0)
1904 1997 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
1905 1998 return ((const char *)(s + 1));
1906 1999 }
1907 2000 #undef CBSIZE
1908 2001 }
1909 2002
1910 2003 const char *
1911 2004 route_optname(private_t *pri, long val)
1912 2005 {
1913 2006 switch (val) {
1914 2007 case RT_AWARE:
1915 2008 return ("RT_AWARE");
1916 2009 default:
1917 2010 (void) snprintf(pri->code_buf, sizeof (pri->code_buf),
1918 2011 "0x%lx", val);
1919 2012 return (pri->code_buf);
1920 2013 }
1921 2014 }
1922 2015
1923 2016 const char *
1924 2017 tcp_optname(private_t *pri, long val)
1925 2018 {
1926 2019 switch (val) {
1927 2020 case TCP_NODELAY: return ("TCP_NODELAY");
1928 2021 case TCP_MAXSEG: return ("TCP_MAXSEG");
1929 2022 case TCP_KEEPALIVE: return ("TCP_KEEPALIVE");
1930 2023 case TCP_NOTIFY_THRESHOLD: return ("TCP_NOTIFY_THRESHOLD");
1931 2024 case TCP_ABORT_THRESHOLD: return ("TCP_ABORT_THRESHOLD");
1932 2025 case TCP_CONN_NOTIFY_THRESHOLD: return ("TCP_CONN_NOTIFY_THRESHOLD");
1933 2026 case TCP_CONN_ABORT_THRESHOLD: return ("TCP_CONN_ABORT_THRESHOLD");
1934 2027 case TCP_RECVDSTADDR: return ("TCP_RECVDSTADDR");
1935 2028 case TCP_ANONPRIVBIND: return ("TCP_ANONPRIVBIND");
1936 2029 case TCP_EXCLBIND: return ("TCP_EXCLBIND");
1937 2030 case TCP_INIT_CWND: return ("TCP_INIT_CWND");
1938 2031 case TCP_KEEPALIVE_THRESHOLD: return ("TCP_KEEPALIVE_THRESHOLD");
1939 2032 case TCP_KEEPALIVE_ABORT_THRESHOLD:
1940 2033 return ("TCP_KEEPALIVE_ABORT_THRESHOLD");
1941 2034 case TCP_CORK: return ("TCP_CORK");
1942 2035 case TCP_RTO_INITIAL: return ("TCP_RTO_INITIAL");
1943 2036 case TCP_RTO_MIN: return ("TCP_RTO_MIN");
1944 2037 case TCP_RTO_MAX: return ("TCP_RTO_MAX");
1945 2038 case TCP_LINGER2: return ("TCP_LINGER2");
1946 2039 case TCP_KEEPIDLE: return ("TCP_KEEPIDLE");
1947 2040 case TCP_KEEPCNT: return ("TCP_KEEPCNT");
1948 2041 case TCP_KEEPINTVL: return ("TCP_KEEPINTVL");
1949 2042
1950 2043 default: (void) snprintf(pri->code_buf,
1951 2044 sizeof (pri->code_buf),
1952 2045 "0x%lx", val);
1953 2046 return (pri->code_buf);
1954 2047 }
1955 2048 }
1956 2049
1957 2050
1958 2051 const char *
1959 2052 sctp_optname(private_t *pri, long val)
1960 2053 {
1961 2054 switch (val) {
1962 2055 case SCTP_RTOINFO: return ("SCTP_RTOINFO");
1963 2056 case SCTP_ASSOCINFO: return ("SCTP_ASSOCINFO");
1964 2057 case SCTP_INITMSG: return ("SCTP_INITMSG");
1965 2058 case SCTP_NODELAY: return ("SCTP_NODELAY");
1966 2059 case SCTP_AUTOCLOSE: return ("SCTP_AUTOCLOSE");
1967 2060 case SCTP_SET_PEER_PRIMARY_ADDR:
1968 2061 return ("SCTP_SET_PEER_PRIMARY_ADDR");
1969 2062 case SCTP_PRIMARY_ADDR: return ("SCTP_PRIMARY_ADDR");
1970 2063 case SCTP_ADAPTATION_LAYER: return ("SCTP_ADAPTATION_LAYER");
1971 2064 case SCTP_DISABLE_FRAGMENTS: return ("SCTP_DISABLE_FRAGMENTS");
1972 2065 case SCTP_PEER_ADDR_PARAMS: return ("SCTP_PEER_ADDR_PARAMS");
1973 2066 case SCTP_DEFAULT_SEND_PARAM: return ("SCTP_DEFAULT_SEND_PARAM");
1974 2067 case SCTP_EVENTS: return ("SCTP_EVENTS");
1975 2068 case SCTP_I_WANT_MAPPED_V4_ADDR:
1976 2069 return ("SCTP_I_WANT_MAPPED_V4_ADDR");
1977 2070 case SCTP_MAXSEG: return ("SCTP_MAXSEG");
1978 2071 case SCTP_STATUS: return ("SCTP_STATUS");
1979 2072 case SCTP_GET_PEER_ADDR_INFO: return ("SCTP_GET_PEER_ADDR_INFO");
1980 2073
1981 2074 case SCTP_ADD_ADDR: return ("SCTP_ADD_ADDR");
1982 2075 case SCTP_REM_ADDR: return ("SCTP_REM_ADDR");
1983 2076
1984 2077 default: (void) snprintf(pri->code_buf,
1985 2078 sizeof (pri->code_buf),
1986 2079 "0x%lx", val);
1987 2080 return (pri->code_buf);
1988 2081 }
1989 2082 }
1990 2083
1991 2084
1992 2085 const char *
1993 2086 udp_optname(private_t *pri, long val)
1994 2087 {
1995 2088 switch (val) {
1996 2089 case UDP_CHECKSUM: return ("UDP_CHECKSUM");
1997 2090 case UDP_ANONPRIVBIND: return ("UDP_ANONPRIVBIND");
1998 2091 case UDP_EXCLBIND: return ("UDP_EXCLBIND");
1999 2092 case UDP_RCVHDR: return ("UDP_RCVHDR");
2000 2093 case UDP_NAT_T_ENDPOINT: return ("UDP_NAT_T_ENDPOINT");
2001 2094
2002 2095 default: (void) snprintf(pri->code_buf,
2003 2096 sizeof (pri->code_buf), "0x%lx",
2004 2097 val);
2005 2098 return (pri->code_buf);
2006 2099 }
2007 2100 }
2008 2101
2009 2102
2010 2103 /*
2011 2104 * Print setsockopt()/getsockopt() 3rd argument.
2012 2105 */
2013 2106 /*ARGSUSED*/
2014 2107 void
2015 2108 prt_son(private_t *pri, int raw, long val)
2016 2109 {
2017 2110 /* cheating -- look at the level */
2018 2111 switch (pri->sys_args[1]) {
2019 2112 case SOL_SOCKET: outstring(pri, sol_optname(pri, val));
2020 2113 break;
2021 2114 case SOL_ROUTE: outstring(pri, route_optname(pri, val));
2022 2115 break;
2023 2116 case IPPROTO_TCP: outstring(pri, tcp_optname(pri, val));
2024 2117 break;
2025 2118 case IPPROTO_UDP: outstring(pri, udp_optname(pri, val));
2026 2119 break;
2027 2120 case IPPROTO_SCTP: outstring(pri, sctp_optname(pri, val));
2028 2121 break;
2029 2122 default: prt_dec(pri, 0, val);
2030 2123 break;
2031 2124 }
2032 2125 }
2033 2126
2034 2127
2035 2128 /*
2036 2129 * Print utrap type
2037 2130 */
2038 2131 /*ARGSUSED*/
2039 2132 void
2040 2133 prt_utt(private_t *pri, int raw, long val)
2041 2134 {
2042 2135 const char *s = NULL;
2043 2136
2044 2137 #ifdef __sparc
2045 2138 if (!raw) {
2046 2139 switch (val) {
2047 2140 case UT_INSTRUCTION_DISABLED:
2048 2141 s = "UT_INSTRUCTION_DISABLED"; break;
2049 2142 case UT_INSTRUCTION_ERROR:
2050 2143 s = "UT_INSTRUCTION_ERROR"; break;
2051 2144 case UT_INSTRUCTION_PROTECTION:
2052 2145 s = "UT_INSTRUCTION_PROTECTION"; break;
2053 2146 case UT_ILLTRAP_INSTRUCTION:
2054 2147 s = "UT_ILLTRAP_INSTRUCTION"; break;
2055 2148 case UT_ILLEGAL_INSTRUCTION:
2056 2149 s = "UT_ILLEGAL_INSTRUCTION"; break;
2057 2150 case UT_PRIVILEGED_OPCODE:
2058 2151 s = "UT_PRIVILEGED_OPCODE"; break;
2059 2152 case UT_FP_DISABLED:
2060 2153 s = "UT_FP_DISABLED"; break;
2061 2154 case UT_FP_EXCEPTION_IEEE_754:
2062 2155 s = "UT_FP_EXCEPTION_IEEE_754"; break;
2063 2156 case UT_FP_EXCEPTION_OTHER:
2064 2157 s = "UT_FP_EXCEPTION_OTHER"; break;
2065 2158 case UT_TAG_OVERFLOW:
2066 2159 s = "UT_TAG_OVERFLOW"; break;
2067 2160 case UT_DIVISION_BY_ZERO:
2068 2161 s = "UT_DIVISION_BY_ZERO"; break;
2069 2162 case UT_DATA_EXCEPTION:
2070 2163 s = "UT_DATA_EXCEPTION"; break;
2071 2164 case UT_DATA_ERROR:
2072 2165 s = "UT_DATA_ERROR"; break;
2073 2166 case UT_DATA_PROTECTION:
2074 2167 s = "UT_DATA_PROTECTION"; break;
2075 2168 case UT_MEM_ADDRESS_NOT_ALIGNED:
2076 2169 s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break;
2077 2170 case UT_PRIVILEGED_ACTION:
2078 2171 s = "UT_PRIVILEGED_ACTION"; break;
2079 2172 case UT_ASYNC_DATA_ERROR:
2080 2173 s = "UT_ASYNC_DATA_ERROR"; break;
2081 2174 case UT_TRAP_INSTRUCTION_16:
2082 2175 s = "UT_TRAP_INSTRUCTION_16"; break;
2083 2176 case UT_TRAP_INSTRUCTION_17:
2084 2177 s = "UT_TRAP_INSTRUCTION_17"; break;
2085 2178 case UT_TRAP_INSTRUCTION_18:
2086 2179 s = "UT_TRAP_INSTRUCTION_18"; break;
2087 2180 case UT_TRAP_INSTRUCTION_19:
2088 2181 s = "UT_TRAP_INSTRUCTION_19"; break;
2089 2182 case UT_TRAP_INSTRUCTION_20:
2090 2183 s = "UT_TRAP_INSTRUCTION_20"; break;
2091 2184 case UT_TRAP_INSTRUCTION_21:
2092 2185 s = "UT_TRAP_INSTRUCTION_21"; break;
2093 2186 case UT_TRAP_INSTRUCTION_22:
2094 2187 s = "UT_TRAP_INSTRUCTION_22"; break;
2095 2188 case UT_TRAP_INSTRUCTION_23:
2096 2189 s = "UT_TRAP_INSTRUCTION_23"; break;
2097 2190 case UT_TRAP_INSTRUCTION_24:
2098 2191 s = "UT_TRAP_INSTRUCTION_24"; break;
2099 2192 case UT_TRAP_INSTRUCTION_25:
2100 2193 s = "UT_TRAP_INSTRUCTION_25"; break;
2101 2194 case UT_TRAP_INSTRUCTION_26:
2102 2195 s = "UT_TRAP_INSTRUCTION_26"; break;
2103 2196 case UT_TRAP_INSTRUCTION_27:
2104 2197 s = "UT_TRAP_INSTRUCTION_27"; break;
2105 2198 case UT_TRAP_INSTRUCTION_28:
2106 2199 s = "UT_TRAP_INSTRUCTION_28"; break;
2107 2200 case UT_TRAP_INSTRUCTION_29:
2108 2201 s = "UT_TRAP_INSTRUCTION_29"; break;
2109 2202 case UT_TRAP_INSTRUCTION_30:
2110 2203 s = "UT_TRAP_INSTRUCTION_30"; break;
2111 2204 case UT_TRAP_INSTRUCTION_31:
2112 2205 s = "UT_TRAP_INSTRUCTION_31"; break;
2113 2206 }
2114 2207 }
2115 2208 #endif /* __sparc */
2116 2209
2117 2210 if (s == NULL)
2118 2211 prt_dec(pri, 0, val);
2119 2212 else
2120 2213 outstring(pri, s);
2121 2214 }
2122 2215
2123 2216
2124 2217 /*
2125 2218 * Print utrap handler
2126 2219 */
2127 2220 void
2128 2221 prt_uth(private_t *pri, int raw, long val)
2129 2222 {
2130 2223 const char *s = NULL;
2131 2224
2132 2225 if (!raw) {
2133 2226 switch (val) {
2134 2227 case (long)UTH_NOCHANGE: s = "UTH_NOCHANGE"; break;
2135 2228 }
2136 2229 }
2137 2230
2138 2231 if (s == NULL)
2139 2232 prt_hex(pri, 0, val);
2140 2233 else
2141 2234 outstring(pri, s);
2142 2235 }
2143 2236
2144 2237 const char *
2145 2238 access_flags(private_t *pri, long arg)
2146 2239 {
2147 2240 #define E_OK 010
2148 2241 char *str = pri->code_buf;
2149 2242
2150 2243 if (arg & ~(R_OK|W_OK|X_OK|E_OK))
2151 2244 return (NULL);
2152 2245
2153 2246 /* NB: F_OK == 0 */
2154 2247 if (arg == F_OK)
2155 2248 return ("F_OK");
2156 2249 if (arg == E_OK)
2157 2250 return ("F_OK|E_OK");
2158 2251
2159 2252 *str = '\0';
2160 2253 if (arg & R_OK)
2161 2254 (void) strlcat(str, "|R_OK", sizeof (pri->code_buf));
2162 2255 if (arg & W_OK)
2163 2256 (void) strlcat(str, "|W_OK", sizeof (pri->code_buf));
2164 2257 if (arg & X_OK)
2165 2258 (void) strlcat(str, "|X_OK", sizeof (pri->code_buf));
2166 2259 if (arg & E_OK)
2167 2260 (void) strlcat(str, "|E_OK", sizeof (pri->code_buf));
2168 2261 return ((const char *)(str + 1));
2169 2262 #undef E_OK
2170 2263 }
2171 2264
2172 2265 /*
2173 2266 * Print access() flags.
2174 2267 */
2175 2268 void
2176 2269 prt_acc(private_t *pri, int raw, long val)
2177 2270 {
2178 2271 const char *s = raw? NULL : access_flags(pri, val);
2179 2272
2180 2273 if (s == NULL)
2181 2274 prt_dex(pri, 0, val);
2182 2275 else
2183 2276 outstring(pri, s);
2184 2277 }
2185 2278
2186 2279 /*
2187 2280 * Print shutdown() "how" (2nd) argument
2188 2281 */
2189 2282 void
2190 2283 prt_sht(private_t *pri, int raw, long val)
2191 2284 {
2192 2285 if (raw) {
2193 2286 prt_dex(pri, 0, val);
2194 2287 return;
2195 2288 }
2196 2289 switch (val) {
2197 2290 case SHUT_RD: outstring(pri, "SHUT_RD"); break;
2198 2291 case SHUT_WR: outstring(pri, "SHUT_WR"); break;
2199 2292 case SHUT_RDWR: outstring(pri, "SHUT_RDWR"); break;
2200 2293 default: prt_dec(pri, 0, val); break;
2201 2294 }
2202 2295 }
2203 2296
2204 2297 /*
2205 2298 * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg)
2206 2299 */
2207 2300 static struct fcntl_flags {
2208 2301 long val;
2209 2302 const char *name;
2210 2303 } fcntl_flags[] = {
2211 2304 #define FC_FL(flag) { (long)flag, "|" # flag }
2212 2305 FC_FL(FREVOKED),
2213 2306 FC_FL(FREAD),
2214 2307 FC_FL(FWRITE),
2215 2308 FC_FL(FNDELAY),
2216 2309 FC_FL(FAPPEND),
2217 2310 FC_FL(FSYNC),
2218 2311 FC_FL(FDSYNC),
2219 2312 FC_FL(FRSYNC),
2220 2313 FC_FL(FOFFMAX),
2221 2314 FC_FL(FNONBLOCK),
2222 2315 FC_FL(FCREAT),
2223 2316 FC_FL(FTRUNC),
2224 2317 FC_FL(FEXCL),
2225 2318 FC_FL(FNOCTTY),
2226 2319 FC_FL(FXATTR),
2227 2320 FC_FL(FASYNC),
2228 2321 FC_FL(FNODSYNC)
2229 2322 #undef FC_FL
2230 2323 };
2231 2324
2232 2325 void
2233 2326 prt_ffg(private_t *pri, int raw, long val)
2234 2327 {
2235 2328 #define CBSIZE sizeof (pri->code_buf)
2236 2329 char *s = pri->code_buf;
2237 2330 size_t used = 1;
2238 2331 struct fcntl_flags *fp;
2239 2332
2240 2333 if (raw) {
2241 2334 (void) snprintf(s, CBSIZE, "0x%lx", val);
2242 2335 outstring(pri, s);
2243 2336 return;
2244 2337 }
2245 2338 if (val == 0) {
2246 2339 outstring(pri, "(no flags)");
2247 2340 return;
2248 2341 }
2249 2342
2250 2343 *s = '\0';
2251 2344 for (fp = fcntl_flags;
2252 2345 fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) {
2253 2346 if (val & fp->val) {
2254 2347 used = strlcat(s, fp->name, CBSIZE);
2255 2348 val &= ~fp->val;
2256 2349 }
2257 2350 }
2258 2351
2259 2352 if (val != 0 && used <= CBSIZE)
2260 2353 used += snprintf(s + used, CBSIZE - used, "|0x%lx", val);
2261 2354
2262 2355 if (used >= CBSIZE)
2263 2356 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
2264 2357 outstring(pri, s + 1);
2265 2358 #undef CBSIZE
2266 2359 }
2267 2360
2268 2361 void
2269 2362 prt_prs(private_t *pri, int raw, long val)
2270 2363 {
2271 2364 static size_t setsize;
2272 2365 priv_set_t *set = priv_allocset();
2273 2366
2274 2367 if (setsize == 0) {
2275 2368 const priv_impl_info_t *info = getprivimplinfo();
2276 2369 if (info != NULL)
2277 2370 setsize = info->priv_setsize * sizeof (priv_chunk_t);
2278 2371 }
2279 2372
2280 2373 if (setsize != 0 && !raw && set != NULL &&
2281 2374 Pread(Proc, set, setsize, val) == setsize) {
2282 2375 int i;
2283 2376
2284 2377 outstring(pri, "{");
2285 2378 for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) {
2286 2379 char buf[9]; /* 8 hex digits + '\0' */
2287 2380 (void) snprintf(buf, sizeof (buf), "%08x",
2288 2381 ((priv_chunk_t *)set)[i]);
2289 2382 outstring(pri, buf);
2290 2383 }
2291 2384
2292 2385 outstring(pri, "}");
2293 2386 } else {
2294 2387 prt_hex(pri, 0, val);
2295 2388 }
2296 2389
2297 2390 if (set != NULL)
2298 2391 priv_freeset(set);
2299 2392 }
2300 2393
2301 2394 /*
2302 2395 * Print privilege set operation.
2303 2396 */
2304 2397 void
2305 2398 prt_pro(private_t *pri, int raw, long val)
2306 2399 {
2307 2400 const char *s = NULL;
2308 2401
2309 2402 if (!raw) {
2310 2403 switch ((priv_op_t)val) {
2311 2404 case PRIV_ON: s = "PRIV_ON"; break;
2312 2405 case PRIV_OFF: s = "PRIV_OFF"; break;
2313 2406 case PRIV_SET: s = "PRIV_SET"; break;
2314 2407 }
2315 2408 }
2316 2409
2317 2410 if (s == NULL)
2318 2411 prt_dec(pri, 0, val);
2319 2412 else
2320 2413 outstring(pri, s);
2321 2414 }
2322 2415
2323 2416 /*
2324 2417 * Print privilege set name
2325 2418 */
2326 2419 void
2327 2420 prt_prn(private_t *pri, int raw, long val)
2328 2421 {
2329 2422 const char *s = NULL;
2330 2423
2331 2424 if (!raw)
2332 2425 s = priv_getsetbynum((int)val);
2333 2426
2334 2427 if (s == NULL)
2335 2428 prt_dec(pri, 0, val);
2336 2429 else {
2337 2430 char *dup = strdup(s);
2338 2431 char *q;
2339 2432
2340 2433 /* Do the best we can in this case */
2341 2434 if (dup == NULL) {
2342 2435 outstring(pri, s);
2343 2436 return;
2344 2437 }
2345 2438
2346 2439 outstring(pri, "PRIV_");
2347 2440
2348 2441 q = dup;
2349 2442
2350 2443 while (*q != '\0') {
2351 2444 *q = toupper(*q);
2352 2445 q++;
2353 2446 }
2354 2447 outstring(pri, dup);
2355 2448 free(dup);
2356 2449 }
2357 2450 }
2358 2451
2359 2452 /*
2360 2453 * Print process flag names.
2361 2454 */
2362 2455 void
2363 2456 prt_pfl(private_t *pri, int raw, long val)
2364 2457 {
2365 2458 const char *s = NULL;
2366 2459
2367 2460 if (!raw) {
2368 2461 switch ((int)val) {
2369 2462 case PRIV_DEBUG: s = "PRIV_DEBUG"; break;
2370 2463 case PRIV_AWARE: s = "PRIV_AWARE"; break;
2371 2464 case PRIV_XPOLICY: s = "PRIV_XPOLICY"; break;
2372 2465 case PRIV_AWARE_RESET: s = "PRIV_AWARE_RESET"; break;
2373 2466 case PRIV_PFEXEC: s = "PRIV_PFEXEC"; break;
2374 2467 case NET_MAC_AWARE: s = "NET_MAC_AWARE"; break;
2375 2468 case NET_MAC_AWARE_INHERIT:
2376 2469 s = "NET_MAC_AWARE_INHERIT";
2377 2470 break;
2378 2471 }
2379 2472 }
2380 2473
2381 2474 if (s == NULL)
2382 2475 prt_dec(pri, 0, val);
2383 2476 else
2384 2477 outstring(pri, s);
2385 2478 }
2386 2479
2387 2480 /*
2388 2481 * Print lgrp_affinity_{get,set}() arguments.
2389 2482 */
2390 2483 /*ARGSUSED*/
2391 2484 void
2392 2485 prt_laf(private_t *pri, int raw, long val)
2393 2486 {
2394 2487 lgrp_affinity_args_t laff;
2395 2488
2396 2489 if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) !=
2397 2490 sizeof (lgrp_affinity_args_t)) {
2398 2491 prt_hex(pri, 0, val);
2399 2492 return;
2400 2493 }
2401 2494 /*
2402 2495 * arrange the arguments in the order that user calls with
2403 2496 */
2404 2497 prt_dec(pri, 0, laff.idtype);
2405 2498 outstring(pri, ", ");
2406 2499 prt_dec(pri, 0, laff.id);
2407 2500 outstring(pri, ", ");
2408 2501 prt_dec(pri, 0, laff.lgrp);
2409 2502 outstring(pri, ", ");
2410 2503 if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET)
2411 2504 prt_dec(pri, 0, laff.aff);
2412 2505 }
2413 2506
2414 2507 /*
2415 2508 * Print a key_t as IPC_PRIVATE if it is 0.
2416 2509 */
2417 2510 void
2418 2511 prt_key(private_t *pri, int raw, long val)
2419 2512 {
2420 2513 if (!raw && val == 0)
2421 2514 outstring(pri, "IPC_PRIVATE");
2422 2515 else
2423 2516 prt_dec(pri, 0, val);
2424 2517 }
2425 2518
2426 2519
2427 2520 /*
2428 2521 * Print zone_getattr() attribute types.
2429 2522 */
2430 2523 void
2431 2524 prt_zga(private_t *pri, int raw, long val)
2432 2525 {
2433 2526 const char *s = NULL;
2434 2527
2435 2528 if (!raw) {
2436 2529 switch ((int)val) {
2437 2530 case ZONE_ATTR_NAME: s = "ZONE_ATTR_NAME"; break;
2438 2531 case ZONE_ATTR_ROOT: s = "ZONE_ATTR_ROOT"; break;
2439 2532 case ZONE_ATTR_STATUS: s = "ZONE_ATTR_STATUS"; break;
2440 2533 case ZONE_ATTR_PRIVSET: s = "ZONE_ATTR_PRIVSET"; break;
2441 2534 case ZONE_ATTR_UNIQID: s = "ZONE_ATTR_UNIQID"; break;
2442 2535 case ZONE_ATTR_POOLID: s = "ZONE_ATTR_POOLID"; break;
2443 2536 case ZONE_ATTR_INITPID: s = "ZONE_ATTR_INITPID"; break;
2444 2537 case ZONE_ATTR_SLBL: s = "ZONE_ATTR_SLBL"; break;
2445 2538 case ZONE_ATTR_INITNAME: s = "ZONE_ATTR_INITNAME"; break;
2446 2539 case ZONE_ATTR_BOOTARGS: s = "ZONE_ATTR_BOOTARGS"; break;
2447 2540 case ZONE_ATTR_BRAND: s = "ZONE_ATTR_BRAND"; break;
2448 2541 case ZONE_ATTR_FLAGS: s = "ZONE_ATTR_FLAGS"; break;
2449 2542 case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break;
2450 2543 }
2451 2544 }
2452 2545
2453 2546 if (s == NULL)
2454 2547 prt_dec(pri, 0, val);
2455 2548 else
2456 2549 outstring(pri, s);
2457 2550 }
2458 2551
2459 2552 /*
2460 2553 * Print a file descriptor as AT_FDCWD if necessary
2461 2554 */
2462 2555 void
2463 2556 prt_atc(private_t *pri, int raw, long val)
2464 2557 {
2465 2558 if ((int)val == AT_FDCWD) {
2466 2559 if (raw)
2467 2560 prt_hex(pri, 0, (uint_t)AT_FDCWD);
2468 2561 else
2469 2562 outstring(pri, "AT_FDCWD");
2470 2563 } else {
2471 2564 prt_dec(pri, 0, val);
2472 2565 }
2473 2566 }
2474 2567
2475 2568 /*
2476 2569 * Print Trusted Networking database operation codes (labelsys; tn*)
2477 2570 */
2478 2571 static void
2479 2572 prt_tnd(private_t *pri, int raw, long val)
2480 2573 {
2481 2574 const char *s = NULL;
2482 2575
2483 2576 if (!raw) {
2484 2577 switch ((tsol_dbops_t)val) {
2485 2578 case TNDB_NOOP: s = "TNDB_NOOP"; break;
2486 2579 case TNDB_LOAD: s = "TNDB_LOAD"; break;
2487 2580 case TNDB_DELETE: s = "TNDB_DELETE"; break;
2488 2581 case TNDB_FLUSH: s = "TNDB_FLUSH"; break;
2489 2582 case TNDB_GET: s = "TNDB_GET"; break;
2490 2583 }
2491 2584 }
2492 2585
2493 2586 if (s == NULL)
2494 2587 prt_dec(pri, 0, val);
2495 2588 else
2496 2589 outstring(pri, s);
2497 2590 }
2498 2591
2499 2592 /*
2500 2593 * Print LIO_XX flags
2501 2594 */
2502 2595 void
2503 2596 prt_lio(private_t *pri, int raw, long val)
2504 2597 {
2505 2598 if (raw)
2506 2599 prt_dec(pri, 0, val);
2507 2600 else if (val == LIO_WAIT)
2508 2601 outstring(pri, "LIO_WAIT");
2509 2602 else if (val == LIO_NOWAIT)
2510 2603 outstring(pri, "LIO_NOWAIT");
2511 2604 else
2512 2605 prt_dec(pri, 0, val);
2513 2606 }
2514 2607
2515 2608 const char *
2516 2609 door_flags(private_t *pri, long val)
2517 2610 {
2518 2611 door_attr_t attr = (door_attr_t)val;
2519 2612 char *str = pri->code_buf;
2520 2613
2521 2614 *str = '\0';
2522 2615 #define PROCESS_FLAG(flg) \
2523 2616 if (attr & flg) { \
2524 2617 (void) strlcat(str, "|" #flg, sizeof (pri->code_buf)); \
2525 2618 attr &= ~flg; \
2526 2619 }
2527 2620
2528 2621 PROCESS_FLAG(DOOR_UNREF);
2529 2622 PROCESS_FLAG(DOOR_UNREF_MULTI);
2530 2623 PROCESS_FLAG(DOOR_PRIVATE);
2531 2624 PROCESS_FLAG(DOOR_REFUSE_DESC);
2532 2625 PROCESS_FLAG(DOOR_NO_CANCEL);
2533 2626 PROCESS_FLAG(DOOR_LOCAL);
2534 2627 PROCESS_FLAG(DOOR_REVOKED);
2535 2628 PROCESS_FLAG(DOOR_IS_UNREF);
2536 2629 #undef PROCESS_FLAG
2537 2630
2538 2631 if (attr != 0 || *str == '\0') {
2539 2632 size_t len = strlen(str);
2540 2633 (void) snprintf(str + len, sizeof (pri->code_buf) - len,
2541 2634 "|0x%X", attr);
2542 2635 }
2543 2636
2544 2637 return (str + 1);
2545 2638 }
2546 2639
2547 2640 /*
2548 2641 * Print door_create() flags
2549 2642 */
2550 2643 void
2551 2644 prt_dfl(private_t *pri, int raw, long val)
2552 2645 {
2553 2646 if (raw)
2554 2647 prt_hex(pri, 0, val);
2555 2648 else
2556 2649 outstring(pri, door_flags(pri, val));
2557 2650 }
2558 2651
2559 2652 /*
2560 2653 * Print door_*param() param argument
2561 2654 */
2562 2655 void
2563 2656 prt_dpm(private_t *pri, int raw, long val)
2564 2657 {
2565 2658 if (raw)
2566 2659 prt_hex(pri, 0, val);
2567 2660 else if (val == DOOR_PARAM_DESC_MAX)
2568 2661 outstring(pri, "DOOR_PARAM_DESC_MAX");
2569 2662 else if (val == DOOR_PARAM_DATA_MIN)
2570 2663 outstring(pri, "DOOR_PARAM_DATA_MIN");
2571 2664 else if (val == DOOR_PARAM_DATA_MAX)
2572 2665 outstring(pri, "DOOR_PARAM_DATA_MAX");
2573 2666 else
2574 2667 prt_hex(pri, 0, val);
2575 2668 }
2576 2669
2577 2670 /*
2578 2671 * Print rctlsys subcodes
2579 2672 */
2580 2673 void
2581 2674 prt_rsc(private_t *pri, int raw, long val) /* print utssys code */
2582 2675 {
2583 2676 const char *s = raw? NULL : rctlsyscode(val);
2584 2677
2585 2678 if (s == NULL)
2586 2679 prt_dec(pri, 0, val);
2587 2680 else
2588 2681 outstring(pri, s);
2589 2682 }
2590 2683
2591 2684 /*
2592 2685 * Print getrctl flags
2593 2686 */
2594 2687 void
2595 2688 prt_rgf(private_t *pri, int raw, long val)
2596 2689 {
2597 2690 long action = val & (~RCTLSYS_ACTION_MASK);
2598 2691
2599 2692 if (raw)
2600 2693 prt_hex(pri, 0, val);
2601 2694 else if (action == RCTL_FIRST)
2602 2695 outstring(pri, "RCTL_FIRST");
2603 2696 else if (action == RCTL_NEXT)
2604 2697 outstring(pri, "RCTL_NEXT");
2605 2698 else if (action == RCTL_USAGE)
2606 2699 outstring(pri, "RCTL_USAGE");
2607 2700 else
2608 2701 prt_hex(pri, 0, val);
2609 2702 }
2610 2703
2611 2704 /*
2612 2705 * Print setrctl flags
2613 2706 */
2614 2707 void
2615 2708 prt_rsf(private_t *pri, int raw, long val)
2616 2709 {
2617 2710 long action = val & (~RCTLSYS_ACTION_MASK);
2618 2711 long pval = val & RCTL_LOCAL_ACTION_MASK;
2619 2712 char *s = pri->code_buf;
2620 2713
2621 2714 if (raw) {
2622 2715 prt_hex(pri, 0, val);
2623 2716 return;
2624 2717 } else if (action == RCTL_INSERT)
2625 2718 (void) strcpy(s, "RCTL_INSERT");
2626 2719 else if (action == RCTL_DELETE)
2627 2720 (void) strcpy(s, "RCTL_DELETE");
2628 2721 else if (action == RCTL_REPLACE)
2629 2722 (void) strcpy(s, "RCTL_REPLACE");
2630 2723 else {
2631 2724 prt_hex(pri, 0, val);
2632 2725 return;
2633 2726 }
2634 2727
2635 2728 if (pval & RCTL_USE_RECIPIENT_PID) {
2636 2729 pval ^= RCTL_USE_RECIPIENT_PID;
2637 2730 (void) strlcat(s, "|RCTL_USE_RECIPIENT_PID",
2638 2731 sizeof (pri->code_buf));
2639 2732 }
2640 2733
2641 2734 if ((pval & RCTLSYS_ACTION_MASK) != 0)
2642 2735 prt_hex(pri, 0, val);
2643 2736 else if (*s != '\0')
2644 2737 outstring(pri, s);
2645 2738 else
2646 2739 prt_hex(pri, 0, val);
2647 2740 }
2648 2741
2649 2742 /*
2650 2743 * Print rctlctl flags
2651 2744 */
2652 2745 void
2653 2746 prt_rcf(private_t *pri, int raw, long val)
2654 2747 {
2655 2748 long action = val & (~RCTLSYS_ACTION_MASK);
2656 2749
2657 2750 if (raw)
2658 2751 prt_hex(pri, 0, val);
2659 2752 else if (action == RCTLCTL_GET)
2660 2753 outstring(pri, "RCTLCTL_GET");
2661 2754 else if (action == RCTLCTL_SET)
2662 2755 outstring(pri, "RCTLCTL_SET");
2663 2756 else
2664 2757 prt_hex(pri, 0, val);
2665 2758 }
2666 2759
2667 2760 /*
2668 2761 * Print setprojrctl flags
2669 2762 */
2670 2763 void
2671 2764 prt_spf(private_t *pri, int raw, long val)
2672 2765 {
2673 2766 long action = val & TASK_PROJ_MASK;
2674 2767
2675 2768 if (!raw && (action == TASK_PROJ_PURGE))
2676 2769 outstring(pri, "TASK_PROJ_PURGE");
2677 2770 else
2678 2771 prt_hex(pri, 0, val);
2679 2772 }
2680 2773
2681 2774 /*
2682 2775 * Print forkx() flags
2683 2776 */
2684 2777 void
2685 2778 prt_fxf(private_t *pri, int raw, long val)
2686 2779 {
2687 2780 char *str;
2688 2781
2689 2782 if (val == 0)
2690 2783 outstring(pri, "0");
2691 2784 else if (raw || (val & ~(FORK_NOSIGCHLD | FORK_WAITPID)))
2692 2785 prt_hhx(pri, 0, val);
2693 2786 else {
2694 2787 str = pri->code_buf;
2695 2788 *str = '\0';
2696 2789 if (val & FORK_NOSIGCHLD)
2697 2790 (void) strlcat(str, "|FORK_NOSIGCHLD",
2698 2791 sizeof (pri->code_buf));
2699 2792 if (val & FORK_WAITPID)
2700 2793 (void) strlcat(str, "|FORK_WAITPID",
2701 2794 sizeof (pri->code_buf));
2702 2795 outstring(pri, str + 1);
2703 2796 }
2704 2797 }
2705 2798
2706 2799 /*
2707 2800 * Print faccessat() flag
2708 2801 */
2709 2802 void
2710 2803 prt_fat(private_t *pri, int raw, long val)
2711 2804 {
2712 2805 if (val == 0)
2713 2806 outstring(pri, "0");
2714 2807 else if (!raw && val == AT_EACCESS)
2715 2808 outstring(pri, "AT_EACCESS");
2716 2809 else
2717 2810 prt_hex(pri, 0, val);
2718 2811 }
2719 2812
2720 2813 /*
2721 2814 * Print unlinkat() flag
2722 2815 */
2723 2816 void
2724 2817 prt_uat(private_t *pri, int raw, long val)
2725 2818 {
2726 2819 if (val == 0)
2727 2820 outstring(pri, "0");
2728 2821 else if (!raw && val == AT_REMOVEDIR)
2729 2822 outstring(pri, "AT_REMOVEDIR");
2730 2823 else
2731 2824 prt_hex(pri, 0, val);
2732 2825 }
2733 2826
2734 2827 /*
2735 2828 * Print AT_SYMLINK_NOFOLLOW / AT_SYMLINK_FOLLOW flag
2736 2829 */
2737 2830 void
2738 2831 prt_snf(private_t *pri, int raw, long val)
2739 2832 {
2740 2833 if (val == 0)
2741 2834 outstring(pri, "0");
2742 2835 else if (!raw && val == AT_SYMLINK_NOFOLLOW)
2743 2836 outstring(pri, "AT_SYMLINK_NOFOLLOW");
2744 2837 else if (!raw && val == AT_SYMLINK_FOLLOW)
2745 2838 outstring(pri, "AT_SYMLINK_FOLLOW");
2746 2839 else
2747 2840 prt_hex(pri, 0, val);
2748 2841 }
2749 2842
2750 2843 void
2751 2844 prt_grf(private_t *pri, int raw, long val)
2752 2845 {
2753 2846 int first = 1;
2754 2847
2755 2848 if (raw != 0 || val == 0 ||
2756 2849 (val & ~(GRND_NONBLOCK | GRND_RANDOM)) != 0) {
2757 2850 outstring(pri, "0");
2758 2851 return;
2759 2852 }
2760 2853
2761 2854 if (val & GRND_NONBLOCK) {
2762 2855 outstring(pri, "|GRND_NONBLOCK" + first);
2763 2856 first = 0;
2764 2857 }
2765 2858 if (val & GRND_RANDOM) {
2766 2859 outstring(pri, "|GRND_RANDOM" + first);
2767 2860 first = 0;
2768 2861 }
2769 2862 }
2770 2863
2771 2864 /*
2772 2865 * Array of pointers to print functions, one for each format.
2773 2866 */
2774 2867 void (* const Print[])() = {
2775 2868 prt_nov, /* NOV -- no value */
2776 2869 prt_dec, /* DEC -- print value in decimal */
2777 2870 prt_oct, /* OCT -- print value in octal */
2778 2871 prt_hex, /* HEX -- print value in hexadecimal */
2779 2872 prt_dex, /* DEX -- print value in hexadecimal if big enough */
2780 2873 prt_stg, /* STG -- print value as string */
2781 2874 prt_ioc, /* IOC -- print ioctl code */
2782 2875 prt_fcn, /* FCN -- print fcntl code */
2783 2876 prt_s86, /* S86 -- print sysi86 code */
2784 2877 prt_uts, /* UTS -- print utssys code */
2785 2878 prt_opn, /* OPN -- print open code */
2786 2879 prt_sig, /* SIG -- print signal name plus flags */
2787 2880 prt_uat, /* UAT -- print unlinkat() flag */
2788 2881 prt_msc, /* MSC -- print msgsys command */
2789 2882 prt_msf, /* MSF -- print msgsys flags */
2790 2883 prt_smc, /* SMC -- print semsys command */
2791 2884 prt_sef, /* SEF -- print semsys flags */
2792 2885 prt_shc, /* SHC -- print shmsys command */
2793 2886 prt_shf, /* SHF -- print shmsys flags */
2794 2887 prt_fat, /* FAT -- print faccessat( flag */
2795 2888 prt_sfs, /* SFS -- print sysfs code */
2796 2889 prt_rst, /* RST -- print string returned by syscall */
2797 2890 prt_smf, /* SMF -- print streams message flags */
2798 2891 prt_ioa, /* IOA -- print ioctl argument */
2799 2892 prt_pip, /* PIP -- print pipe flags */
2800 2893 prt_mtf, /* MTF -- print mount flags */
2801 2894 prt_mft, /* MFT -- print mount file system type */
2802 2895 prt_iob, /* IOB -- print contents of I/O buffer */
2803 2896 prt_hhx, /* HHX -- print value in hexadecimal (half size) */
2804 2897 prt_wop, /* WOP -- print waitsys() options */
2805 2898 prt_spm, /* SPM -- print sigprocmask argument */
2806 2899 prt_rlk, /* RLK -- print readlink buffer */
2807 2900 prt_mpr, /* MPR -- print mmap()/mprotect() flags */
2808 2901 prt_mty, /* MTY -- print mmap() mapping type flags */
2809 2902 prt_mcf, /* MCF -- print memcntl() function */
2810 2903 prt_mc4, /* MC4 -- print memcntl() (fourth) argument */
2811 2904 prt_mc5, /* MC5 -- print memcntl() (fifth) argument */
2812 2905 prt_mad, /* MAD -- print madvise() argument */
2813 2906 prt_ulm, /* ULM -- print ulimit() argument */
2814 2907 prt_rlm, /* RLM -- print get/setrlimit() argument */
2815 2908 prt_cnf, /* CNF -- print sysconfig() argument */
2816 2909 prt_inf, /* INF -- print sysinfo() argument */
2817 2910 prt_ptc, /* PTC -- print pathconf/fpathconf() argument */
2818 2911 prt_fui, /* FUI -- print fusers() input argument */
2819 2912 prt_idt, /* IDT -- print idtype_t, waitid() argument */
2820 2913 prt_lwf, /* LWF -- print lwp_create() flags */
2821 2914 prt_itm, /* ITM -- print [get|set]itimer() arg */
2822 2915 prt_llo, /* LLO -- print long long offset arg */
2823 2916 prt_mod, /* MOD -- print modctl() subcode */
2824 2917 prt_whn, /* WHN -- print lseek() whence arguiment */
2825 2918 prt_acl, /* ACL -- print acl() code */
2826 2919 prt_aio, /* AIO -- print kaio() code */
2827 2920 prt_aud, /* AUD -- print auditsys() code */
2828 2921 prt_uns, /* DEC -- print value in unsigned decimal */
2829 2922 prt_clc, /* CLC -- print cladm command argument */
2830 2923 prt_clf, /* CLF -- print cladm flag argument */
2831 2924 prt_cor, /* COR -- print corectl() subcode */
2832 2925 prt_cco, /* CCO -- print corectl() options */
2833 2926 prt_ccc, /* CCC -- print corectl() content */
2834 2927 prt_rcc, /* RCC -- print corectl() returned content */
2835 2928 prt_cpc, /* CPC -- print cpc() subcode */
2836 2929 prt_sqc, /* SQC -- print sigqueue() si_code argument */
2837 2930 prt_pc4, /* PC4 -- print priocntlsys() (fourth) argument */
2838 2931 prt_pc5, /* PC5 -- print priocntlsys() (key, value) pairs */
2839 2932 prt_pst, /* PST -- print processor set id */
2840 2933 prt_mif, /* MIF -- print meminfo() arguments */
2841 2934 prt_pfm, /* PFM -- print so_socket() proto-family (1st) arg */
2842 2935 prt_skt, /* SKT -- print so_socket() socket-type (2nd) arg */
2843 2936 prt_skp, /* SKP -- print so_socket() protocol (3rd) arg */
2844 2937 prt_skv, /* SKV -- print socket version arg */
2845 2938 prt_sol, /* SOL -- print [sg]etsockopt() level (2nd) arg */
2846 2939 prt_son, /* SON -- print [sg]etsockopt() opt-name (3rd) arg */
2847 2940 prt_utt, /* UTT -- print utrap type */
2848 2941 prt_uth, /* UTH -- print utrap handler */
2849 2942 prt_acc, /* ACC -- print access() flags */
2850 2943 prt_sht, /* SHT -- print shutdown() how (2nd) argument */
2851 2944 prt_ffg, /* FFG -- print fcntl() flags (3rd) argument */
2852 2945 prt_prs, /* PRS -- print privilege set */
2853 2946 prt_pro, /* PRO -- print privilege set operation */
2854 2947 prt_prn, /* PRN -- print privilege set name */
2855 2948 prt_pfl, /* PFL -- print privilege/process flag name */
2856 2949 prt_laf, /* LAF -- print lgrp_affinity arguments */
2857 2950 prt_key, /* KEY -- print key_t 0 as IPC_PRIVATE */
2858 2951 prt_zga, /* ZGA -- print zone_getattr attribute types */
2859 2952 prt_atc, /* ATC -- print AT_FDCWD or file descriptor */
2860 2953 prt_lio, /* LIO -- print LIO_XX flags */
2861 2954 prt_dfl, /* DFL -- print door_create() flags */
2862 2955 prt_dpm, /* DPM -- print DOOR_PARAM_XX flags */
2863 2956 prt_tnd, /* TND -- print trusted network data base opcode */
2864 2957 prt_rsc, /* RSC -- print rctlsys() subcodes */
2865 2958 prt_rgf, /* RGF -- print getrctl() flags */
2866 2959 prt_rsf, /* RSF -- print setrctl() flags */
↓ open down ↓ |
1254 lines elided |
↑ open up ↑ |
2867 2960 prt_rcf, /* RCF -- print rctlsys_ctl() flags */
2868 2961 prt_fxf, /* FXF -- print forkx() flags */
2869 2962 prt_spf, /* SPF -- print rctlsys_projset() flags */
2870 2963 prt_un1, /* UN1 -- as prt_uns except for -1 */
2871 2964 prt_mob, /* MOB -- print mmapobj() flags */
2872 2965 prt_snf, /* SNF -- print AT_SYMLINK_[NO]FOLLOW flag */
2873 2966 prt_skc, /* SKC -- print sockconfig() subcode */
2874 2967 prt_acf, /* ACF -- print accept4 flags */
2875 2968 prt_pfd, /* PFD -- print pipe fds */
2876 2969 prt_grf, /* GRF -- print getrandom flags */
2970 + prt_psdelta, /* PSDLT -- print psecflags(2) delta */
2971 + prt_psfw, /* PSFW -- print psecflags(2) set */
2877 2972 prt_dec, /* HID -- hidden argument, make this the last one */
2878 2973 };
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX