Print this page
uts: Allow for address space randomisation.
Randomise the base addresses of shared objects, non-fixed mappings, the
stack and the heap. Introduce a service, svc:/system/process-security,
and a tool psecflags(1) to control and observe it
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 }
849 850 }
850 851
851 852 if (s == NULL)
852 853 prt_dec(pri, 0, val);
853 854 else
854 855 outstring(pri, s);
855 856 }
856 857
857 858 void
858 859 prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
859 860 {
860 861 if (val == 0)
861 862 prt_dec(pri, 0, val);
862 863 else if (raw)
863 864 prt_hhx(pri, 0, val);
864 865 else {
865 866 char *s = NULL;
866 867
867 868 #define CBSIZE sizeof (pri->code_buf)
868 869 /* cheating -- look at memcntl func */
869 870 switch (pri->sys_args[2]) {
870 871 case MC_ADVISE:
871 872 prt_mad(pri, 0, val);
872 873 return;
873 874
874 875 case MC_SYNC:
875 876 if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) {
876 877 *(s = pri->code_buf) = '\0';
877 878 if (val & MS_SYNC)
878 879 (void) strlcat(s, "|MS_SYNC", CBSIZE);
879 880 if (val & MS_ASYNC)
880 881 (void) strlcat(s, "|MS_ASYNC", CBSIZE);
881 882 if (val & MS_INVALIDATE)
882 883 (void) strlcat(s, "|MS_INVALIDATE",
883 884 CBSIZE);
884 885 }
885 886 break;
886 887
887 888 case MC_LOCKAS:
888 889 case MC_UNLOCKAS:
889 890 if ((val & ~(MCL_CURRENT|MCL_FUTURE)) == 0) {
890 891 *(s = pri->code_buf) = '\0';
891 892 if (val & MCL_CURRENT)
892 893 (void) strlcat(s, "|MCL_CURRENT",
893 894 CBSIZE);
894 895 if (val & MCL_FUTURE)
895 896 (void) strlcat(s, "|MCL_FUTURE",
896 897 CBSIZE);
897 898 }
898 899 break;
899 900 }
900 901 #undef CBSIZE
901 902
902 903 if (s == NULL || *s == '\0')
903 904 prt_hhx(pri, 0, val);
904 905 else
905 906 outstring(pri, ++s);
906 907 }
907 908 }
908 909
909 910 void
910 911 prt_mc5(private_t *pri, int raw, long val) /* print memcntl() (5th) argument */
911 912 {
912 913 char *s;
913 914
914 915 #define CBSIZE sizeof (pri->code_buf)
915 916 if (val == 0)
916 917 prt_dec(pri, 0, val);
917 918 else if (raw || (val & ~VALID_ATTR))
918 919 prt_hhx(pri, 0, val);
919 920 else {
920 921 s = pri->code_buf;
921 922 *s = '\0';
922 923 if (val & SHARED)
923 924 (void) strlcat(s, "|SHARED", CBSIZE);
924 925 if (val & PRIVATE)
925 926 (void) strlcat(s, "|PRIVATE", CBSIZE);
926 927 if (val & PROT_READ)
927 928 (void) strlcat(s, "|PROT_READ", CBSIZE);
928 929 if (val & PROT_WRITE)
929 930 (void) strlcat(s, "|PROT_WRITE", CBSIZE);
930 931 if (val & PROT_EXEC)
931 932 (void) strlcat(s, "|PROT_EXEC", CBSIZE);
932 933 if (*s == '\0')
933 934 prt_hhx(pri, 0, val);
934 935 else
935 936 outstring(pri, ++s);
936 937 }
937 938 #undef CBSIZE
938 939 }
939 940
940 941 void
941 942 prt_ulm(private_t *pri, int raw, long val) /* print ulimit() argument */
942 943 {
943 944 const char *s = NULL;
944 945
945 946 if (!raw) {
946 947 switch (val) {
947 948 case UL_GFILLIM: s = "UL_GFILLIM"; break;
948 949 case UL_SFILLIM: s = "UL_SFILLIM"; break;
949 950 case UL_GMEMLIM: s = "UL_GMEMLIM"; break;
950 951 case UL_GDESLIM: s = "UL_GDESLIM"; break;
951 952 }
952 953 }
953 954
954 955 if (s == NULL)
955 956 prt_dec(pri, 0, val);
956 957 else
957 958 outstring(pri, s);
958 959 }
959 960
960 961 void
961 962 prt_rlm(private_t *pri, int raw, long val) /* print get/setrlimit() argument */
962 963 {
963 964 const char *s = NULL;
964 965
965 966 if (!raw) {
966 967 switch (val) {
967 968 case RLIMIT_CPU: s = "RLIMIT_CPU"; break;
968 969 case RLIMIT_FSIZE: s = "RLIMIT_FSIZE"; break;
969 970 case RLIMIT_DATA: s = "RLIMIT_DATA"; break;
970 971 case RLIMIT_STACK: s = "RLIMIT_STACK"; break;
971 972 case RLIMIT_CORE: s = "RLIMIT_CORE"; break;
972 973 case RLIMIT_NOFILE: s = "RLIMIT_NOFILE"; break;
973 974 case RLIMIT_VMEM: s = "RLIMIT_VMEM"; break;
974 975 }
975 976 }
976 977
977 978 if (s == NULL)
978 979 prt_dec(pri, 0, val);
979 980 else
980 981 outstring(pri, s);
981 982 }
982 983
983 984 void
984 985 prt_cnf(private_t *pri, int raw, long val) /* print sysconfig code */
985 986 {
986 987 const char *s = raw? NULL : sconfname(val);
987 988
988 989 if (s == NULL)
989 990 prt_dec(pri, 0, val);
990 991 else
991 992 outstring(pri, s);
992 993 }
993 994
994 995 void
995 996 prt_inf(private_t *pri, int raw, long val) /* print sysinfo code */
996 997 {
997 998 const char *s = NULL;
998 999
999 1000 if (!raw) {
1000 1001 switch (val) {
1001 1002 case SI_SYSNAME: s = "SI_SYSNAME"; break;
1002 1003 case SI_HOSTNAME: s = "SI_HOSTNAME"; break;
1003 1004 case SI_RELEASE: s = "SI_RELEASE"; break;
1004 1005 case SI_VERSION: s = "SI_VERSION"; break;
1005 1006 case SI_MACHINE: s = "SI_MACHINE"; break;
1006 1007 case SI_ARCHITECTURE: s = "SI_ARCHITECTURE"; break;
1007 1008 case SI_ARCHITECTURE_32:s = "SI_ARCHITECTURE_32"; break;
1008 1009 case SI_ARCHITECTURE_64:s = "SI_ARCHITECTURE_64"; break;
1009 1010 case SI_ARCHITECTURE_K: s = "SI_ARCHITECTURE_K"; break;
1010 1011 case SI_HW_SERIAL: s = "SI_HW_SERIAL"; break;
1011 1012 case SI_HW_PROVIDER: s = "SI_HW_PROVIDER"; break;
1012 1013 case SI_SRPC_DOMAIN: s = "SI_SRPC_DOMAIN"; break;
1013 1014 case SI_SET_HOSTNAME: s = "SI_SET_HOSTNAME"; break;
1014 1015 case SI_SET_SRPC_DOMAIN: s = "SI_SET_SRPC_DOMAIN"; break;
1015 1016 case SI_PLATFORM: s = "SI_PLATFORM"; break;
1016 1017 case SI_ISALIST: s = "SI_ISALIST"; break;
1017 1018 case SI_DHCP_CACHE: s = "SI_DHCP_CACHE"; break;
1018 1019 }
1019 1020 }
1020 1021
1021 1022 if (s == NULL)
1022 1023 prt_dec(pri, 0, val);
1023 1024 else
1024 1025 outstring(pri, s);
1025 1026 }
1026 1027
1027 1028 void
1028 1029 prt_ptc(private_t *pri, int raw, long val) /* print pathconf code */
1029 1030 {
1030 1031 const char *s = raw? NULL : pathconfname(val);
1031 1032
1032 1033 if (s == NULL)
1033 1034 prt_dec(pri, 0, val);
1034 1035 else
1035 1036 outstring(pri, s);
1036 1037 }
1037 1038
1038 1039 void
1039 1040 prt_fui(private_t *pri, int raw, long val) /* print fusers() input argument */
1040 1041 {
1041 1042 const char *s = raw? NULL : fuiname(val);
1042 1043
1043 1044 if (s == NULL)
1044 1045 prt_hhx(pri, 0, val);
1045 1046 else
1046 1047 outstring(pri, s);
1047 1048 }
1048 1049
1049 1050 void
1050 1051 prt_lwf(private_t *pri, int raw, long val) /* print lwp_create() flags */
1051 1052 {
1052 1053 char *s;
1053 1054
1054 1055 if (val == 0)
1055 1056 prt_dec(pri, 0, val);
1056 1057 else if (raw ||
1057 1058 (val & ~(LWP_DAEMON|LWP_DETACHED|LWP_SUSPENDED)))
1058 1059 prt_hhx(pri, 0, val);
1059 1060 else {
1060 1061 #define CBSIZE sizeof (pri->code_buf)
1061 1062 s = pri->code_buf;
1062 1063 *s = '\0';
1063 1064 if (val & LWP_DAEMON)
1064 1065 (void) strlcat(s, "|LWP_DAEMON", CBSIZE);
1065 1066 if (val & LWP_DETACHED)
1066 1067 (void) strlcat(s, "|LWP_DETACHED", CBSIZE);
1067 1068 if (val & LWP_SUSPENDED)
1068 1069 (void) strlcat(s, "|LWP_SUSPENDED", CBSIZE);
1069 1070 outstring(pri, ++s);
1070 1071 #undef CBSIZE
1071 1072 }
1072 1073 }
1073 1074
1074 1075 void
1075 1076 prt_itm(private_t *pri, int raw, long val) /* print [get|set]itimer() arg */
1076 1077 {
1077 1078 const char *s = NULL;
1078 1079
1079 1080 if (!raw) {
1080 1081 switch (val) {
1081 1082 case ITIMER_REAL: s = "ITIMER_REAL"; break;
1082 1083 case ITIMER_VIRTUAL: s = "ITIMER_VIRTUAL"; break;
1083 1084 case ITIMER_PROF: s = "ITIMER_PROF"; break;
1084 1085 #ifdef ITIMER_REALPROF
1085 1086 case ITIMER_REALPROF: s = "ITIMER_REALPROF"; break;
1086 1087 #endif
1087 1088 }
1088 1089 }
1089 1090
1090 1091 if (s == NULL)
1091 1092 prt_dec(pri, 0, val);
1092 1093 else
1093 1094 outstring(pri, s);
1094 1095 }
1095 1096
1096 1097 void
1097 1098 prt_mod(private_t *pri, int raw, long val) /* print modctl() code */
1098 1099 {
1099 1100 const char *s = NULL;
1100 1101
1101 1102 if (!raw) {
1102 1103 switch (val) {
1103 1104 case MODLOAD: s = "MODLOAD"; break;
1104 1105 case MODUNLOAD: s = "MODUNLOAD"; break;
1105 1106 case MODINFO: s = "MODINFO"; break;
1106 1107 case MODRESERVED: s = "MODRESERVED"; break;
1107 1108 case MODSETMINIROOT: s = "MODSETMINIROOT"; break;
1108 1109 case MODADDMAJBIND: s = "MODADDMAJBIND"; break;
1109 1110 case MODGETPATH: s = "MODGETPATH"; break;
1110 1111 case MODGETPATHLEN: s = "MODGETPATHLEN"; break;
1111 1112 case MODREADSYSBIND: s = "MODREADSYSBIND"; break;
1112 1113 case MODGETMAJBIND: s = "MODGETMAJBIND"; break;
1113 1114 case MODGETNAME: s = "MODGETNAME"; break;
1114 1115 case MODSIZEOF_DEVID: s = "MODSIZEOF_DEVID"; break;
1115 1116 case MODGETDEVID: s = "MODGETDEVID"; break;
1116 1117 case MODSIZEOF_MINORNAME: s = "MODSIZEOF_MINORNAME"; break;
1117 1118 case MODGETMINORNAME: s = "MODGETMINORNAME"; break;
1118 1119 case MODGETFBNAME: s = "MODGETFBNAME"; break;
1119 1120 case MODEVENTS: s = "MODEVENTS"; break;
1120 1121 case MODREREADDACF: s = "MODREREADDACF"; break;
1121 1122 case MODLOADDRVCONF: s = "MODLOADDRVCONF"; break;
1122 1123 case MODUNLOADDRVCONF: s = "MODUNLOADDRVCONF"; break;
1123 1124 case MODREMMAJBIND: s = "MODREMMAJBIND"; break;
1124 1125 case MODDEVT2INSTANCE: s = "MODDEVT2INSTANCE"; break;
1125 1126 case MODGETDEVFSPATH_LEN: s = "MODGETDEVFSPATH_LEN"; break;
1126 1127 case MODGETDEVFSPATH: s = "MODGETDEVFSPATH"; break;
1127 1128 case MODDEVID2PATHS: s = "MODDEVID2PATHS"; break;
1128 1129 case MODSETDEVPOLICY: s = "MODSETDEVPOLICY"; break;
1129 1130 case MODGETDEVPOLICY: s = "MODGETDEVPOLICY"; break;
1130 1131 case MODALLOCPRIV: s = "MODALLOCPRIV"; break;
1131 1132 case MODGETDEVPOLICYBYNAME:
1132 1133 s = "MODGETDEVPOLICYBYNAME"; break;
1133 1134 case MODLOADMINORPERM: s = "MODLOADMINORPERM"; break;
1134 1135 case MODADDMINORPERM: s = "MODADDMINORPERM"; break;
1135 1136 case MODREMMINORPERM: s = "MODREMMINORPERM"; break;
1136 1137 case MODREMDRVCLEANUP: s = "MODREMDRVCLEANUP"; break;
1137 1138 case MODDEVEXISTS: s = "MODDEVEXISTS"; break;
1138 1139 case MODDEVREADDIR: s = "MODDEVREADDIR"; break;
1139 1140 case MODDEVEMPTYDIR: s = "MODDEVEMPTYDIR"; break;
1140 1141 case MODDEVNAME: s = "MODDEVNAME"; break;
1141 1142 case MODGETDEVFSPATH_MI_LEN:
1142 1143 s = "MODGETDEVFSPATH_MI_LEN"; break;
1143 1144 case MODGETDEVFSPATH_MI:
1144 1145 s = "MODGETDEVFSPATH_MI"; break;
1145 1146 case MODREMDRVALIAS: s = "MODREMDRVALIAS"; break;
1146 1147 case MODHPOPS: s = "MODHPOPS"; break;
1147 1148 }
1148 1149 }
1149 1150
1150 1151 if (s == NULL)
1151 1152 prt_dec(pri, 0, val);
1152 1153 else
1153 1154 outstring(pri, s);
1154 1155 }
1155 1156
1156 1157 void
1157 1158 prt_acl(private_t *pri, int raw, long val) /* print acl() code */
1158 1159 {
1159 1160 const char *s = NULL;
1160 1161
1161 1162 if (!raw) {
1162 1163 switch (val) {
1163 1164 case GETACL: s = "GETACL"; break;
1164 1165 case SETACL: s = "SETACL"; break;
1165 1166 case GETACLCNT: s = "GETACLCNT"; break;
1166 1167 case ACE_GETACL: s = "ACE_GETACL"; break;
1167 1168 case ACE_SETACL: s = "ACE_SETACL"; break;
1168 1169 case ACE_GETACLCNT: s = "ACE_GETACLCNT"; break;
1169 1170 }
1170 1171 }
1171 1172
1172 1173 if (s == NULL)
1173 1174 prt_dec(pri, 0, val);
1174 1175 else
1175 1176 outstring(pri, s);
1176 1177 }
1177 1178
1178 1179 void
1179 1180 prt_aio(private_t *pri, int raw, long val) /* print kaio() code */
1180 1181 {
1181 1182 const char *s = NULL;
1182 1183 char buf[32];
1183 1184
1184 1185 if (!raw) {
1185 1186 switch (val & ~AIO_POLL_BIT) {
1186 1187 case AIOREAD: s = "AIOREAD"; break;
1187 1188 case AIOWRITE: s = "AIOWRITE"; break;
1188 1189 case AIOWAIT: s = "AIOWAIT"; break;
1189 1190 case AIOCANCEL: s = "AIOCANCEL"; break;
1190 1191 case AIONOTIFY: s = "AIONOTIFY"; break;
1191 1192 case AIOINIT: s = "AIOINIT"; break;
1192 1193 case AIOSTART: s = "AIOSTART"; break;
1193 1194 case AIOLIO: s = "AIOLIO"; break;
1194 1195 case AIOSUSPEND: s = "AIOSUSPEND"; break;
1195 1196 case AIOERROR: s = "AIOERROR"; break;
1196 1197 case AIOLIOWAIT: s = "AIOLIOWAIT"; break;
1197 1198 case AIOAREAD: s = "AIOAREAD"; break;
1198 1199 case AIOAWRITE: s = "AIOAWRITE"; break;
1199 1200 /*
1200 1201 * We have to hardcode the values for the 64-bit versions of
1201 1202 * these calls, because <sys/aio.h> defines them to be identical
1202 1203 * when compiled 64-bit. If our target is 32-bit, we still need
1203 1204 * to decode them correctly.
1204 1205 */
1205 1206 case 13: s = "AIOLIO64"; break;
1206 1207 case 14: s = "AIOSUSPEND64"; break;
1207 1208 case 15: s = "AUIOERROR64"; break;
1208 1209 case 16: s = "AIOLIOWAIT64"; break;
1209 1210 case 17: s = "AIOAREAD64"; break;
1210 1211 case 18: s = "AIOAWRITE64"; break;
1211 1212 case 19: s = "AIOCANCEL64"; break;
1212 1213
1213 1214 /*
1214 1215 * AIOFSYNC doesn't correspond to a syscall.
1215 1216 */
1216 1217 case AIOWAITN: s = "AIOWAITN"; break;
1217 1218 }
1218 1219 if (s != NULL && (val & AIO_POLL_BIT)) {
1219 1220 (void) strlcpy(buf, s, sizeof (buf));
1220 1221 (void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf));
1221 1222 s = (const char *)buf;
1222 1223 }
1223 1224 }
1224 1225
1225 1226 if (s == NULL)
1226 1227 prt_dec(pri, 0, val);
1227 1228 else
1228 1229 outstring(pri, s);
1229 1230 }
1230 1231
1231 1232 void
1232 1233 prt_aud(private_t *pri, int raw, long val) /* print auditsys() code */
1233 1234 {
1234 1235 const char *s = NULL;
1235 1236
1236 1237 if (!raw) {
1237 1238 switch (val) {
1238 1239 case BSM_GETAUID: s = "BSM_GETAUID"; break;
1239 1240 case BSM_SETAUID: s = "BSM_SETAUID"; break;
1240 1241 case BSM_GETAUDIT: s = "BSM_GETAUDIT"; break;
1241 1242 case BSM_SETAUDIT: s = "BSM_SETAUDIT"; break;
1242 1243 case BSM_AUDIT: s = "BSM_AUDIT"; break;
1243 1244 case BSM_AUDITCTL: s = "BSM_AUDITCTL"; break;
1244 1245 case BSM_GETAUDIT_ADDR: s = "BSM_GETAUDIT_ADDR"; break;
1245 1246 case BSM_SETAUDIT_ADDR: s = "BSM_SETAUDIT_ADDR"; break;
1246 1247 }
1247 1248 }
1248 1249
1249 1250 if (s == NULL)
1250 1251 prt_dec(pri, 0, val);
1251 1252 else
1252 1253 outstring(pri, s);
1253 1254 }
1254 1255
1255 1256 void
1256 1257 prt_cor(private_t *pri, int raw, long val) /* print corectl() subcode */
1257 1258 {
1258 1259 const char *s = NULL;
1259 1260
1260 1261 if (!raw) {
1261 1262 switch (val) {
1262 1263 case CC_SET_OPTIONS:
1263 1264 s = "CC_SET_OPTIONS"; break;
1264 1265 case CC_GET_OPTIONS:
1265 1266 s = "CC_GET_OPTIONS"; break;
1266 1267 case CC_SET_GLOBAL_PATH:
1267 1268 s = "CC_SET_GLOBAL_PATH"; break;
1268 1269 case CC_GET_GLOBAL_PATH:
1269 1270 s = "CC_GET_GLOBAL_PATH"; break;
1270 1271 case CC_SET_PROCESS_PATH:
1271 1272 s = "CC_SET_PROCESS_PATH"; break;
1272 1273 case CC_GET_PROCESS_PATH:
1273 1274 s = "CC_GET_PROCESS_PATH"; break;
1274 1275 case CC_SET_GLOBAL_CONTENT:
1275 1276 s = "CC_SET_GLOBAL_CONTENT"; break;
1276 1277 case CC_GET_GLOBAL_CONTENT:
1277 1278 s = "CC_GET_GLOBAL_CONTENT"; break;
1278 1279 case CC_SET_PROCESS_CONTENT:
1279 1280 s = "CC_SET_PROCESS_CONTENT"; break;
1280 1281 case CC_GET_PROCESS_CONTENT:
1281 1282 s = "CC_GET_PROCESS_CONTENT"; break;
1282 1283 case CC_SET_DEFAULT_PATH:
1283 1284 s = "CC_SET_DEFAULT_PATH"; break;
1284 1285 case CC_GET_DEFAULT_PATH:
1285 1286 s = "CC_GET_DEFAULT_PATH"; break;
1286 1287 case CC_SET_DEFAULT_CONTENT:
1287 1288 s = "CC_SET_DEFAULT_CONTENT"; break;
1288 1289 case CC_GET_DEFAULT_CONTENT:
1289 1290 s = "CC_GET_DEFAULT_CONTENT"; break;
1290 1291 }
1291 1292 }
1292 1293
1293 1294 if (s == NULL)
1294 1295 prt_dec(pri, 0, val);
1295 1296 else
1296 1297 outstring(pri, s);
1297 1298 }
1298 1299
1299 1300 void
1300 1301 prt_cco(private_t *pri, int raw, long val) /* print corectl() options */
1301 1302 {
1302 1303 char *s;
1303 1304
1304 1305 if (val == 0)
1305 1306 prt_dec(pri, 0, val);
1306 1307 else if (raw || (val & ~CC_OPTIONS))
1307 1308 prt_hhx(pri, 0, val);
1308 1309 else {
1309 1310 #define CBSIZE sizeof (pri->code_buf)
1310 1311 s = pri->code_buf;
1311 1312 *s = '\0';
1312 1313 if (val & CC_GLOBAL_PATH)
1313 1314 (void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE);
1314 1315 if (val & CC_PROCESS_PATH)
1315 1316 (void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE);
1316 1317 if (val & CC_GLOBAL_SETID)
1317 1318 (void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE);
1318 1319 if (val & CC_PROCESS_SETID)
1319 1320 (void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE);
1320 1321 if (val & CC_GLOBAL_LOG)
1321 1322 (void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE);
1322 1323 if (*s == '\0')
1323 1324 prt_hhx(pri, 0, val);
1324 1325 else
1325 1326 outstring(pri, ++s);
1326 1327 #undef CBSIZE
1327 1328 }
1328 1329 }
1329 1330
1330 1331 void
1331 1332 prt_ccc(private_t *pri, int raw, long val) /* print corectl() content */
1332 1333 {
1333 1334 core_content_t ccc;
1334 1335
1335 1336 if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1336 1337 prt_hex(pri, 0, val);
1337 1338 else if (!raw && proc_content2str(ccc, pri->code_buf,
1338 1339 sizeof (pri->code_buf)) >= 0)
1339 1340 outstring(pri, pri->code_buf);
1340 1341 else
1341 1342 prt_hhx(pri, 0, (long)ccc);
1342 1343 }
1343 1344
1344 1345 void
1345 1346 prt_rcc(private_t *pri, int raw, long val) /* print corectl() ret. cont. */
1346 1347 {
1347 1348 core_content_t ccc;
1348 1349
1349 1350 if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1350 1351 prt_hex(pri, 0, val);
1351 1352 else if (!raw && proc_content2str(ccc, pri->code_buf,
1352 1353 sizeof (pri->code_buf)) >= 0)
1353 1354 outstring(pri, pri->code_buf);
1354 1355 else
1355 1356 prt_hhx(pri, 0, (long)ccc);
1356 1357 }
1357 1358
1358 1359 void
1359 1360 prt_cpc(private_t *pri, int raw, long val) /* print cpc() subcode */
1360 1361 {
1361 1362 const char *s = NULL;
1362 1363
1363 1364 if (!raw) {
1364 1365 switch (val) {
1365 1366 case CPC_BIND: s = "CPC_BIND"; break;
1366 1367 case CPC_SAMPLE: s = "CPC_SAMPLE"; break;
1367 1368 case CPC_INVALIDATE: s = "CPC_INVALIDATE"; break;
1368 1369 case CPC_RELE: s = "CPC_RELE"; break;
1369 1370 case CPC_EVLIST_SIZE: s = "CPC_EVLIST_SIZE"; break;
1370 1371 case CPC_LIST_EVENTS: s = "CPC_LIST_EVENTS"; break;
1371 1372 case CPC_ATTRLIST_SIZE: s = "CPC_ATTRLIST_SIZE"; break;
1372 1373 case CPC_LIST_ATTRS: s = "CPC_LIST_ATTRS"; break;
1373 1374 case CPC_IMPL_NAME: s = "CPC_IMPL_NAME"; break;
1374 1375 case CPC_CPUREF: s = "CPC_CPUREF"; break;
1375 1376 case CPC_USR_EVENTS: s = "CPC_USR_EVENTS"; break;
1376 1377 case CPC_SYS_EVENTS: s = "CPC_SYS_EVENTS"; break;
1377 1378 case CPC_NPIC: s = "CPC_NPIC"; break;
1378 1379 case CPC_CAPS: s = "CPC_CAPS"; break;
1379 1380 case CPC_ENABLE: s = "CPC_ENABLE"; break;
1380 1381 case CPC_DISABLE: s = "CPC_DISABLE"; break;
1381 1382 }
1382 1383 }
1383 1384
1384 1385 if (s == NULL)
1385 1386 prt_dec(pri, 0, val);
1386 1387 else
1387 1388 outstring(pri, s);
1388 1389 }
1389 1390
1390 1391 void
1391 1392 outstring(private_t *pri, const char *s)
1392 1393 {
1393 1394 int len = strlen(s);
1394 1395
1395 1396 GROW(len);
1396 1397 (void) strcpy(pri->sys_string + pri->sys_leng, s);
1397 1398 pri->sys_leng += len;
1398 1399 }
1399 1400
1400 1401 void
1401 1402 grow(private_t *pri, int nbyte) /* reallocate format buffer if necessary */
1402 1403 {
1403 1404 while (pri->sys_leng + nbyte >= pri->sys_ssize)
1404 1405 pri->sys_string = my_realloc(pri->sys_string,
1405 1406 pri->sys_ssize *= 2, "format buffer");
1406 1407 }
1407 1408
1408 1409 void
1409 1410 prt_clc(private_t *pri, int raw, long val)
1410 1411 {
1411 1412 const char *s = NULL;
1412 1413
1413 1414 if (!raw) {
1414 1415 switch (val) {
1415 1416 case CL_INITIALIZE: s = "CL_INITIALIZE"; break;
1416 1417 case CL_CONFIG: s = "CL_CONFIG"; break;
1417 1418 }
1418 1419 }
1419 1420
1420 1421 if (s == NULL)
1421 1422 prt_dec(pri, 0, val);
1422 1423 else
1423 1424 outstring(pri, s);
1424 1425 }
1425 1426
1426 1427 void
1427 1428 prt_clf(private_t *pri, int raw, long val)
1428 1429 {
1429 1430 const char *s = NULL;
1430 1431
1431 1432 if (!raw) {
1432 1433 switch (pri->sys_args[0]) {
1433 1434 case CL_CONFIG:
1434 1435 switch (pri->sys_args[1]) {
1435 1436 case CL_NODEID:
1436 1437 s = "CL_NODEID"; break;
1437 1438 case CL_HIGHEST_NODEID:
1438 1439 s = "CL_HIGHEST_NODEID"; break;
1439 1440 }
1440 1441 break;
1441 1442 case CL_INITIALIZE:
1442 1443 switch (pri->sys_args[1]) {
1443 1444 case CL_GET_BOOTFLAG:
1444 1445 s = "CL_GET_BOOTFLAG"; break;
1445 1446 }
1446 1447 break;
1447 1448 }
1448 1449 }
1449 1450
1450 1451 if (s == NULL)
1451 1452 prt_dec(pri, 0, val);
1452 1453 else
1453 1454 outstring(pri, s);
1454 1455 }
1455 1456
1456 1457 void
1457 1458 prt_sqc(private_t *pri, int raw, long val) /* print sigqueue() si_code */
1458 1459 {
1459 1460 const char *s = NULL;
1460 1461
1461 1462 if (!raw) {
1462 1463 switch ((int)val) {
1463 1464 case SI_QUEUE: s = "SI_QUEUE"; break;
1464 1465 case SI_TIMER: s = "SI_TIMER"; break;
1465 1466 case SI_ASYNCIO: s = "SI_ASYNCIO"; break;
1466 1467 case SI_MESGQ: s = "SI_MESGQ"; break;
1467 1468 }
1468 1469 }
1469 1470
1470 1471 if (s == NULL)
1471 1472 prt_dec(pri, 0, val);
1472 1473 else
1473 1474 outstring(pri, s);
1474 1475 }
1475 1476
1476 1477 /*
1477 1478 * print priocntlsys() (key, value) pair key.
1478 1479 */
1479 1480 void
1480 1481 print_pck(private_t *pri, int raw, long val)
1481 1482 {
1482 1483 const char *s = NULL;
1483 1484 char clname[PC_CLNMSZ];
1484 1485
1485 1486 if ((pri->sys_args[2] != PC_GETXPARMS &&
1486 1487 pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) {
1487 1488 prt_dec(pri, 0, val);
1488 1489 return;
1489 1490 }
1490 1491
1491 1492 if (pri->sys_args[3] == NULL) {
1492 1493 if (val == PC_KY_CLNAME) {
1493 1494 s = "PC_KY_CLNAME";
1494 1495 outstring(pri, s);
1495 1496 } else
1496 1497 prt_dec(pri, 0, val);
1497 1498 return;
1498 1499 }
1499 1500
1500 1501 if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) {
1501 1502 prt_dec(pri, 0, val);
1502 1503 return;
1503 1504 }
1504 1505
1505 1506 if (strcmp(clname, "TS") == 0) {
1506 1507 switch (val) {
1507 1508 case TS_KY_UPRILIM: s = "TS_KY_UPRILIM"; break;
1508 1509 case TS_KY_UPRI: s = "TS_KY_UPRI"; break;
1509 1510 default: break;
1510 1511 }
1511 1512 } else if (strcmp(clname, "IA") == 0) {
1512 1513 switch (val) {
1513 1514 case IA_KY_UPRILIM: s = "IA_KY_UPRILIM"; break;
1514 1515 case IA_KY_UPRI: s = "IA_KY_UPRI"; break;
1515 1516 case IA_KY_MODE: s = "IA_KY_MODE"; break;
1516 1517 default: break;
1517 1518 }
1518 1519 } else if (strcmp(clname, "RT") == 0) {
1519 1520 switch (val) {
1520 1521 case RT_KY_PRI: s = "RT_KY_PRI"; break;
1521 1522 case RT_KY_TQSECS: s = "RT_KY_TQSECS"; break;
1522 1523 case RT_KY_TQNSECS: s = "RT_KY_TQNSECS"; break;
1523 1524 case RT_KY_TQSIG: s = "RT_KY_TQSIG"; break;
1524 1525 default: break;
1525 1526 }
1526 1527 } else if (strcmp(clname, "FSS") == 0) {
1527 1528 switch (val) {
1528 1529 case FSS_KY_UPRILIM: s = "FSS_KY_UPRILIM"; break;
1529 1530 case FSS_KY_UPRI: s = "FSS_KY_UPRI"; break;
1530 1531 default: break;
1531 1532 }
1532 1533 } else if (strcmp(clname, "FX") == 0) {
1533 1534 switch (val) {
1534 1535 case FX_KY_UPRILIM: s = "FX_KY_UPRILIM"; break;
1535 1536 case FX_KY_UPRI: s = "FX_KY_UPRI"; break;
1536 1537 case FX_KY_TQSECS: s = "FX_KY_TQSECS"; break;
1537 1538 case FX_KY_TQNSECS: s = "FX_KY_TQNSECS"; break;
1538 1539 default: break;
1539 1540 }
1540 1541 }
1541 1542
1542 1543 if (s == NULL)
1543 1544 prt_dec(pri, 0, val);
1544 1545 else
1545 1546 outstring(pri, s);
1546 1547 }
1547 1548
1548 1549 /*
1549 1550 * print priocntlsys() fourth argument.
1550 1551 */
1551 1552 /*ARGSUSED*/
1552 1553 void
1553 1554 prt_pc4(private_t *pri, int raw, long val)
1554 1555 {
1555 1556 /* look at pricntlsys function */
1556 1557 if ((pri->sys_args[2] != PC_GETXPARMS &&
1557 1558 pri->sys_args[2] != PC_SETXPARMS))
1558 1559 prt_hex(pri, 0, val);
1559 1560 else if (val)
1560 1561 prt_stg(pri, 0, val);
1561 1562 else
1562 1563 prt_dec(pri, 0, val);
1563 1564 }
1564 1565
1565 1566 /*
1566 1567 * print priocntlsys() (key, value) pairs (5th argument).
1567 1568 */
1568 1569 /*ARGSUSED*/
1569 1570 void
1570 1571 prt_pc5(private_t *pri, int raw, long val)
1571 1572 {
1572 1573 pc_vaparms_t prms;
1573 1574 pc_vaparm_t *vpp = &prms.pc_parms[0];
1574 1575 uint_t cnt;
1575 1576
1576 1577
1577 1578 /* look at pricntlsys function */
1578 1579 if ((pri->sys_args[2] != PC_GETXPARMS &&
1579 1580 pri->sys_args[2] != PC_SETXPARMS) || val == 0) {
1580 1581 prt_dec(pri, 0, 0);
1581 1582 return;
1582 1583 }
1583 1584
1584 1585 if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) {
1585 1586 prt_hex(pri, 0, val);
1586 1587 return;
1587 1588 }
1588 1589
1589 1590 if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT)
1590 1591 return;
1591 1592
1592 1593 for (; cnt--; vpp++) {
↓ open down ↓ |
1513 lines elided |
↑ open up ↑ |
1593 1594 print_pck(pri, 0, vpp->pc_key);
1594 1595 outstring(pri, ", ");
1595 1596 prt_hex(pri, 0, (long)vpp->pc_parm);
1596 1597 outstring(pri, ", ");
1597 1598 }
1598 1599
1599 1600 prt_dec(pri, 0, PC_KY_NULL);
1600 1601 }
1601 1602
1602 1603 /*
1604 + * Print a psecflags(2) command
1605 + */
1606 +void
1607 +prt_psfcmd(private_t *pri, int raw, long val)
1608 +{
1609 + const char *s = NULL;
1610 +
1611 + if (raw == 0) {
1612 + switch ((psecflags_cmd_t)val) {
1613 + case PSECFLAGS_SET:
1614 + s = "PSECFLAGS_SET";
1615 + break;
1616 + case PSECFLAGS_DISABLE:
1617 + s = "PSECFLAGS_DISABLE";
1618 + break;
1619 + case PSECFLAGS_ENABLE:
1620 + s = "PSECFLAGS_ENABLE";
1621 + break;
1622 + }
1623 + }
1624 +
1625 + if (s == NULL)
1626 + prt_dec(pri, 0, val);
1627 + else
1628 + outstring(pri, s);
1629 +}
1630 +
1631 +void
1632 +prt_psflags(private_t *pri, int raw, long val)
1633 +{
1634 + char *str = pri->code_buf;
1635 +
1636 + if (raw == 1) {
1637 + prt_hex(pri, 0, val);
1638 + return;
1639 + }
1640 +
1641 + *str = '\0';
1642 + if (val & PROC_SEC_ASLR) {
1643 + (void) strlcat(str, "|PROC_SEC_ASLR", sizeof (pri->code_buf));
1644 + val &= ~PROC_SEC_ASLR;
1645 + }
1646 +
1647 + if (val != 0)
1648 + (void) snprintf(str, sizeof (pri->code_buf), "%s|%x", str, val);
1649 +
1650 + outstring(pri, str + 1);
1651 +}
1652 +
1653 +/*
1603 1654 * Print processor set id, including logical expansion of "special" ids.
1604 1655 */
1605 1656 void
1606 1657 prt_pst(private_t *pri, int raw, long val)
1607 1658 {
1608 1659 const char *s = NULL;
1609 1660
1610 1661 if (!raw) {
1611 1662 switch ((psetid_t)val) {
1612 1663 case PS_NONE: s = "PS_NONE"; break;
1613 1664 case PS_QUERY: s = "PS_QUERY"; break;
1614 1665 case PS_MYID: s = "PS_MYID"; break;
1615 1666 }
1616 1667 }
1617 1668
1618 1669 if (s == NULL)
1619 1670 prt_dec(pri, 0, val);
1620 1671 else
1621 1672 outstring(pri, s);
1622 1673 }
1623 1674
1624 1675 /*
1625 1676 * Print meminfo() argument.
1626 1677 */
1627 1678 /*ARGSUSED*/
1628 1679 void
1629 1680 prt_mif(private_t *pri, int raw, long val)
1630 1681 {
1631 1682 struct meminfo minfo;
1632 1683
1633 1684 #ifdef _LP64
1634 1685 if (data_model == PR_MODEL_ILP32) {
1635 1686 struct meminfo32 minfo32;
1636 1687
1637 1688 if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) !=
1638 1689 sizeof (struct meminfo32)) {
1639 1690 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1640 1691 outstring(pri, ", ");
1641 1692 prt_hex(pri, 0, val);
1642 1693 return;
1643 1694 }
1644 1695 /*
1645 1696 * arrange the arguments in the order that user calls with
1646 1697 */
1647 1698 prt_hex(pri, 0, minfo32.mi_inaddr);
1648 1699 outstring(pri, ", ");
1649 1700 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1650 1701 outstring(pri, ", ");
1651 1702 prt_hex(pri, 0, minfo32.mi_info_req);
1652 1703 outstring(pri, ", ");
1653 1704 prt_dec(pri, 0, minfo32.mi_info_count);
1654 1705 outstring(pri, ", ");
1655 1706 prt_hex(pri, 0, minfo32.mi_outdata);
1656 1707 outstring(pri, ", ");
1657 1708 prt_hex(pri, 0, minfo32.mi_validity);
1658 1709 return;
1659 1710 }
1660 1711 #endif
1661 1712 if (Pread(Proc, &minfo, sizeof (struct meminfo), val) !=
1662 1713 sizeof (struct meminfo)) {
1663 1714 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1664 1715 outstring(pri, ", ");
1665 1716 prt_hex(pri, 0, val);
1666 1717 return;
1667 1718 }
1668 1719 /*
1669 1720 * arrange the arguments in the order that user calls with
1670 1721 */
1671 1722 prt_hex(pri, 0, (long)minfo.mi_inaddr);
1672 1723 outstring(pri, ", ");
1673 1724 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
1674 1725 outstring(pri, ", ");
1675 1726 prt_hex(pri, 0, (long)minfo.mi_info_req);
1676 1727 outstring(pri, ", ");
1677 1728 prt_dec(pri, 0, minfo.mi_info_count);
1678 1729 outstring(pri, ", ");
1679 1730 prt_hex(pri, 0, (long)minfo.mi_outdata);
1680 1731 outstring(pri, ", ");
1681 1732 prt_hex(pri, 0, (long)minfo.mi_validity);
1682 1733 }
1683 1734
1684 1735
1685 1736 /*
1686 1737 * Print so_socket() 1st argument.
1687 1738 */
1688 1739 /*ARGSUSED*/
1689 1740 void
1690 1741 prt_pfm(private_t *pri, int raw, long val)
1691 1742 {
1692 1743 /* Protocol Families have same names as Address Families */
1693 1744 if ((ulong_t)val < MAX_AFCODES) {
1694 1745 outstring(pri, "PF_");
1695 1746 outstring(pri, afcodes[val]);
1696 1747 } else {
1697 1748 prt_dec(pri, 0, val);
1698 1749 }
1699 1750 }
1700 1751
1701 1752 /*
1702 1753 * Print sockconfig() subcode.
1703 1754 */
1704 1755 /*ARGSUSED*/
1705 1756 void
1706 1757 prt_skc(private_t *pri, int raw, long val)
1707 1758 {
1708 1759 const char *s = NULL;
1709 1760
1710 1761 if (!raw) {
1711 1762 switch (val) {
1712 1763 case SOCKCONFIG_ADD_SOCK:
1713 1764 s = "SOCKCONFIG_ADD_SOCK"; break;
1714 1765 case SOCKCONFIG_REMOVE_SOCK:
1715 1766 s = "SOCKCONFIG_REMOVE_SOCK"; break;
1716 1767 case SOCKCONFIG_ADD_FILTER:
1717 1768 s = "SOCKCONFIG_ADD_FILTER"; break;
1718 1769 case SOCKCONFIG_REMOVE_FILTER:
1719 1770 s = "SOCKCONFIG_REMOVE_FILTER"; break;
1720 1771 }
1721 1772 }
1722 1773 if (s == NULL)
1723 1774 prt_dec(pri, 0, val);
1724 1775 else
1725 1776 outstring(pri, s);
1726 1777 }
1727 1778 /*
1728 1779 * Print so_socket() 2nd argument.
1729 1780 */
1730 1781 /*ARGSUSED*/
1731 1782 void
1732 1783 prt_skt(private_t *pri, int raw, long val)
1733 1784 {
1734 1785 const char *s;
1735 1786 long type = val & SOCK_TYPE_MASK;
1736 1787
1737 1788 if ((ulong_t)type <= MAX_SOCKTYPES &&
1738 1789 (s = socktype_codes[type]) != NULL) {
1739 1790 outstring(pri, s);
1740 1791 if ((val & SOCK_CLOEXEC) != 0) {
1741 1792 outstring(pri, "|SOCK_CLOEXEC");
1742 1793 }
1743 1794 } else {
1744 1795 prt_dec(pri, 0, val);
1745 1796 }
1746 1797 }
1747 1798
1748 1799
1749 1800 /*
1750 1801 * Print so_socket() 3rd argument.
1751 1802 */
1752 1803 /*ARGSUSED*/
1753 1804 void
1754 1805 prt_skp(private_t *pri, int raw, long val)
1755 1806 {
1756 1807 const char *s;
1757 1808
1758 1809 /* cheating -- look at the protocol-family */
1759 1810 switch (pri->sys_args[0]) {
1760 1811 case PF_INET6:
1761 1812 case PF_INET:
1762 1813 case PF_NCA: if ((s = ipprotos((int)val)) != NULL) {
1763 1814 outstring(pri, s);
1764 1815 break;
1765 1816 }
1766 1817 /* FALLTHROUGH */
1767 1818 default: prt_dec(pri, 0, val);
1768 1819 break;
1769 1820 }
1770 1821 }
1771 1822
1772 1823
1773 1824 /*
1774 1825 * Print so_socket() 5th argument.
1775 1826 */
1776 1827 /*ARGSUSED*/
1777 1828 void
1778 1829 prt_skv(private_t *pri, int raw, long val)
1779 1830 {
1780 1831 switch (val) {
1781 1832 case SOV_STREAM: outstring(pri, "SOV_STREAM"); break;
1782 1833 case SOV_DEFAULT: outstring(pri, "SOV_DEFAULT"); break;
1783 1834 case SOV_SOCKSTREAM: outstring(pri, "SOV_SOCKSTREAM"); break;
1784 1835 case SOV_SOCKBSD: outstring(pri, "SOV_SOCKBSD"); break;
1785 1836 case SOV_XPG4_2: outstring(pri, "SOV_XPG4_2"); break;
1786 1837 default: prt_dec(pri, 0, val); break;
1787 1838 }
1788 1839 }
1789 1840
1790 1841 /*
1791 1842 * Print accept4() flags argument.
1792 1843 */
1793 1844 void
1794 1845 prt_acf(private_t *pri, int raw, long val)
1795 1846 {
1796 1847 int first = 1;
1797 1848 if (raw || !val ||
1798 1849 (val & ~(SOCK_CLOEXEC|SOCK_NDELAY|SOCK_NONBLOCK))) {
1799 1850 prt_dex(pri, 0, val);
1800 1851 return;
1801 1852 }
1802 1853
1803 1854 if (val & SOCK_CLOEXEC) {
1804 1855 outstring(pri, "|SOCK_CLOEXEC" + first);
1805 1856 first = 0;
1806 1857 }
1807 1858 if (val & SOCK_NDELAY) {
1808 1859 outstring(pri, "|SOCK_NDELAY" + first);
1809 1860 first = 0;
1810 1861 }
1811 1862 if (val & SOCK_NONBLOCK) {
1812 1863 outstring(pri, "|SOCK_NONBLOCK" + first);
1813 1864 }
1814 1865 }
1815 1866
1816 1867
1817 1868 /*
1818 1869 * Print setsockopt()/getsockopt() 2nd argument.
1819 1870 */
1820 1871 /*ARGSUSED*/
1821 1872 void
1822 1873 prt_sol(private_t *pri, int raw, long val)
1823 1874 {
1824 1875 if (val == SOL_SOCKET) {
1825 1876 outstring(pri, "SOL_SOCKET");
1826 1877 } else if (val == SOL_ROUTE) {
1827 1878 outstring(pri, "SOL_ROUTE");
1828 1879 } else {
1829 1880 const struct protoent *p;
1830 1881 struct protoent res;
1831 1882 char buf[NSS_BUFLEN_PROTOCOLS];
1832 1883
1833 1884 if ((p = getprotobynumber_r(val, &res,
1834 1885 (char *)buf, sizeof (buf))) != NULL)
1835 1886 outstring(pri, p->p_name);
1836 1887 else
1837 1888 prt_dec(pri, 0, val);
1838 1889 }
1839 1890 }
1840 1891
1841 1892
1842 1893 const char *
1843 1894 sol_optname(private_t *pri, long val)
1844 1895 {
1845 1896 #define CBSIZE sizeof (pri->code_buf)
1846 1897 if (val >= SO_SNDBUF) {
1847 1898 switch (val) {
1848 1899 case SO_SNDBUF: return ("SO_SNDBUF");
1849 1900 case SO_RCVBUF: return ("SO_RCVBUF");
1850 1901 case SO_SNDLOWAT: return ("SO_SNDLOWAT");
1851 1902 case SO_RCVLOWAT: return ("SO_RCVLOWAT");
1852 1903 case SO_SNDTIMEO: return ("SO_SNDTIMEO");
1853 1904 case SO_RCVTIMEO: return ("SO_RCVTIMEO");
1854 1905 case SO_ERROR: return ("SO_ERROR");
1855 1906 case SO_TYPE: return ("SO_TYPE");
1856 1907 case SO_PROTOTYPE: return ("SO_PROTOTYPE");
1857 1908 case SO_ANON_MLP: return ("SO_ANON_MLP");
1858 1909 case SO_MAC_EXEMPT: return ("SO_MAC_EXEMPT");
1859 1910 case SO_ALLZONES: return ("SO_ALLZONES");
1860 1911 case SO_MAC_IMPLICIT: return ("SO_MAC_IMPLICIT");
1861 1912 case SO_VRRP: return ("SO_VRRP");
1862 1913 case SO_EXCLBIND: return ("SO_EXCLBIND");
1863 1914 case SO_DOMAIN: return ("SO_DOMAIN");
1864 1915
1865 1916 default: (void) snprintf(pri->code_buf, CBSIZE,
1866 1917 "0x%lx", val);
1867 1918 return (pri->code_buf);
1868 1919 }
1869 1920 } else {
1870 1921 char *s = pri->code_buf;
1871 1922 size_t used = 1;
1872 1923 long val2;
1873 1924
1874 1925 *s = '\0';
1875 1926 val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE|
1876 1927 SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER|
1877 1928 SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED);
1878 1929 if (val2)
1879 1930 used = snprintf(s, CBSIZE, "|0x%lx", val2);
1880 1931 if (val & SO_DEBUG)
1881 1932 used = strlcat(s, "|SO_DEBUG", CBSIZE);
1882 1933 if (val & SO_ACCEPTCONN)
1883 1934 used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE);
1884 1935 if (val & SO_REUSEADDR)
1885 1936 used = strlcat(s, "|SO_REUSEADDR", CBSIZE);
1886 1937 if (val & SO_KEEPALIVE)
1887 1938 used = strlcat(s, "|SO_KEEPALIVE", CBSIZE);
1888 1939 if (val & SO_DONTROUTE)
1889 1940 used = strlcat(s, "|SO_DONTROUTE", CBSIZE);
1890 1941 if (val & SO_BROADCAST)
1891 1942 used = strlcat(s, "|SO_BROADCAST", CBSIZE);
1892 1943 if (val & SO_USELOOPBACK)
1893 1944 used = strlcat(s, "|SO_USELOOPBACK", CBSIZE);
1894 1945 if (val & SO_LINGER)
1895 1946 used = strlcat(s, "|SO_LINGER", CBSIZE);
1896 1947 if (val & SO_OOBINLINE)
1897 1948 used = strlcat(s, "|SO_OOBINLINE", CBSIZE);
1898 1949 if (val & SO_DGRAM_ERRIND)
1899 1950 used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE);
1900 1951 if (val & SO_RECVUCRED)
1901 1952 used = strlcat(s, "|SO_RECVUCRED", CBSIZE);
1902 1953 if (used >= CBSIZE || val == 0)
1903 1954 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
1904 1955 return ((const char *)(s + 1));
1905 1956 }
1906 1957 #undef CBSIZE
1907 1958 }
1908 1959
1909 1960 const char *
1910 1961 route_optname(private_t *pri, long val)
1911 1962 {
1912 1963 switch (val) {
1913 1964 case RT_AWARE:
1914 1965 return ("RT_AWARE");
1915 1966 default:
1916 1967 (void) snprintf(pri->code_buf, sizeof (pri->code_buf),
1917 1968 "0x%lx", val);
1918 1969 return (pri->code_buf);
1919 1970 }
1920 1971 }
1921 1972
1922 1973 const char *
1923 1974 tcp_optname(private_t *pri, long val)
1924 1975 {
1925 1976 switch (val) {
1926 1977 case TCP_NODELAY: return ("TCP_NODELAY");
1927 1978 case TCP_MAXSEG: return ("TCP_MAXSEG");
1928 1979 case TCP_KEEPALIVE: return ("TCP_KEEPALIVE");
1929 1980 case TCP_NOTIFY_THRESHOLD: return ("TCP_NOTIFY_THRESHOLD");
1930 1981 case TCP_ABORT_THRESHOLD: return ("TCP_ABORT_THRESHOLD");
1931 1982 case TCP_CONN_NOTIFY_THRESHOLD: return ("TCP_CONN_NOTIFY_THRESHOLD");
1932 1983 case TCP_CONN_ABORT_THRESHOLD: return ("TCP_CONN_ABORT_THRESHOLD");
1933 1984 case TCP_RECVDSTADDR: return ("TCP_RECVDSTADDR");
1934 1985 case TCP_ANONPRIVBIND: return ("TCP_ANONPRIVBIND");
1935 1986 case TCP_EXCLBIND: return ("TCP_EXCLBIND");
1936 1987 case TCP_INIT_CWND: return ("TCP_INIT_CWND");
1937 1988 case TCP_KEEPALIVE_THRESHOLD: return ("TCP_KEEPALIVE_THRESHOLD");
1938 1989 case TCP_KEEPALIVE_ABORT_THRESHOLD:
1939 1990 return ("TCP_KEEPALIVE_ABORT_THRESHOLD");
1940 1991 case TCP_CORK: return ("TCP_CORK");
1941 1992 case TCP_RTO_INITIAL: return ("TCP_RTO_INITIAL");
1942 1993 case TCP_RTO_MIN: return ("TCP_RTO_MIN");
1943 1994 case TCP_RTO_MAX: return ("TCP_RTO_MAX");
1944 1995 case TCP_LINGER2: return ("TCP_LINGER2");
1945 1996
1946 1997 default: (void) snprintf(pri->code_buf,
1947 1998 sizeof (pri->code_buf),
1948 1999 "0x%lx", val);
1949 2000 return (pri->code_buf);
1950 2001 }
1951 2002 }
1952 2003
1953 2004
1954 2005 const char *
1955 2006 sctp_optname(private_t *pri, long val)
1956 2007 {
1957 2008 switch (val) {
1958 2009 case SCTP_RTOINFO: return ("SCTP_RTOINFO");
1959 2010 case SCTP_ASSOCINFO: return ("SCTP_ASSOCINFO");
1960 2011 case SCTP_INITMSG: return ("SCTP_INITMSG");
1961 2012 case SCTP_NODELAY: return ("SCTP_NODELAY");
1962 2013 case SCTP_AUTOCLOSE: return ("SCTP_AUTOCLOSE");
1963 2014 case SCTP_SET_PEER_PRIMARY_ADDR:
1964 2015 return ("SCTP_SET_PEER_PRIMARY_ADDR");
1965 2016 case SCTP_PRIMARY_ADDR: return ("SCTP_PRIMARY_ADDR");
1966 2017 case SCTP_ADAPTATION_LAYER: return ("SCTP_ADAPTATION_LAYER");
1967 2018 case SCTP_DISABLE_FRAGMENTS: return ("SCTP_DISABLE_FRAGMENTS");
1968 2019 case SCTP_PEER_ADDR_PARAMS: return ("SCTP_PEER_ADDR_PARAMS");
1969 2020 case SCTP_DEFAULT_SEND_PARAM: return ("SCTP_DEFAULT_SEND_PARAM");
1970 2021 case SCTP_EVENTS: return ("SCTP_EVENTS");
1971 2022 case SCTP_I_WANT_MAPPED_V4_ADDR:
1972 2023 return ("SCTP_I_WANT_MAPPED_V4_ADDR");
1973 2024 case SCTP_MAXSEG: return ("SCTP_MAXSEG");
1974 2025 case SCTP_STATUS: return ("SCTP_STATUS");
1975 2026 case SCTP_GET_PEER_ADDR_INFO: return ("SCTP_GET_PEER_ADDR_INFO");
1976 2027
1977 2028 case SCTP_ADD_ADDR: return ("SCTP_ADD_ADDR");
1978 2029 case SCTP_REM_ADDR: return ("SCTP_REM_ADDR");
1979 2030
1980 2031 default: (void) snprintf(pri->code_buf,
1981 2032 sizeof (pri->code_buf),
1982 2033 "0x%lx", val);
1983 2034 return (pri->code_buf);
1984 2035 }
1985 2036 }
1986 2037
1987 2038
1988 2039 const char *
1989 2040 udp_optname(private_t *pri, long val)
1990 2041 {
1991 2042 switch (val) {
1992 2043 case UDP_CHECKSUM: return ("UDP_CHECKSUM");
1993 2044 case UDP_ANONPRIVBIND: return ("UDP_ANONPRIVBIND");
1994 2045 case UDP_EXCLBIND: return ("UDP_EXCLBIND");
1995 2046 case UDP_RCVHDR: return ("UDP_RCVHDR");
1996 2047 case UDP_NAT_T_ENDPOINT: return ("UDP_NAT_T_ENDPOINT");
1997 2048
1998 2049 default: (void) snprintf(pri->code_buf,
1999 2050 sizeof (pri->code_buf), "0x%lx",
2000 2051 val);
2001 2052 return (pri->code_buf);
2002 2053 }
2003 2054 }
2004 2055
2005 2056
2006 2057 /*
2007 2058 * Print setsockopt()/getsockopt() 3rd argument.
2008 2059 */
2009 2060 /*ARGSUSED*/
2010 2061 void
2011 2062 prt_son(private_t *pri, int raw, long val)
2012 2063 {
2013 2064 /* cheating -- look at the level */
2014 2065 switch (pri->sys_args[1]) {
2015 2066 case SOL_SOCKET: outstring(pri, sol_optname(pri, val));
2016 2067 break;
2017 2068 case SOL_ROUTE: outstring(pri, route_optname(pri, val));
2018 2069 break;
2019 2070 case IPPROTO_TCP: outstring(pri, tcp_optname(pri, val));
2020 2071 break;
2021 2072 case IPPROTO_UDP: outstring(pri, udp_optname(pri, val));
2022 2073 break;
2023 2074 case IPPROTO_SCTP: outstring(pri, sctp_optname(pri, val));
2024 2075 break;
2025 2076 default: prt_dec(pri, 0, val);
2026 2077 break;
2027 2078 }
2028 2079 }
2029 2080
2030 2081
2031 2082 /*
2032 2083 * Print utrap type
2033 2084 */
2034 2085 /*ARGSUSED*/
2035 2086 void
2036 2087 prt_utt(private_t *pri, int raw, long val)
2037 2088 {
2038 2089 const char *s = NULL;
2039 2090
2040 2091 #ifdef __sparc
2041 2092 if (!raw) {
2042 2093 switch (val) {
2043 2094 case UT_INSTRUCTION_DISABLED:
2044 2095 s = "UT_INSTRUCTION_DISABLED"; break;
2045 2096 case UT_INSTRUCTION_ERROR:
2046 2097 s = "UT_INSTRUCTION_ERROR"; break;
2047 2098 case UT_INSTRUCTION_PROTECTION:
2048 2099 s = "UT_INSTRUCTION_PROTECTION"; break;
2049 2100 case UT_ILLTRAP_INSTRUCTION:
2050 2101 s = "UT_ILLTRAP_INSTRUCTION"; break;
2051 2102 case UT_ILLEGAL_INSTRUCTION:
2052 2103 s = "UT_ILLEGAL_INSTRUCTION"; break;
2053 2104 case UT_PRIVILEGED_OPCODE:
2054 2105 s = "UT_PRIVILEGED_OPCODE"; break;
2055 2106 case UT_FP_DISABLED:
2056 2107 s = "UT_FP_DISABLED"; break;
2057 2108 case UT_FP_EXCEPTION_IEEE_754:
2058 2109 s = "UT_FP_EXCEPTION_IEEE_754"; break;
2059 2110 case UT_FP_EXCEPTION_OTHER:
2060 2111 s = "UT_FP_EXCEPTION_OTHER"; break;
2061 2112 case UT_TAG_OVERFLOW:
2062 2113 s = "UT_TAG_OVERFLOW"; break;
2063 2114 case UT_DIVISION_BY_ZERO:
2064 2115 s = "UT_DIVISION_BY_ZERO"; break;
2065 2116 case UT_DATA_EXCEPTION:
2066 2117 s = "UT_DATA_EXCEPTION"; break;
2067 2118 case UT_DATA_ERROR:
2068 2119 s = "UT_DATA_ERROR"; break;
2069 2120 case UT_DATA_PROTECTION:
2070 2121 s = "UT_DATA_PROTECTION"; break;
2071 2122 case UT_MEM_ADDRESS_NOT_ALIGNED:
2072 2123 s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break;
2073 2124 case UT_PRIVILEGED_ACTION:
2074 2125 s = "UT_PRIVILEGED_ACTION"; break;
2075 2126 case UT_ASYNC_DATA_ERROR:
2076 2127 s = "UT_ASYNC_DATA_ERROR"; break;
2077 2128 case UT_TRAP_INSTRUCTION_16:
2078 2129 s = "UT_TRAP_INSTRUCTION_16"; break;
2079 2130 case UT_TRAP_INSTRUCTION_17:
2080 2131 s = "UT_TRAP_INSTRUCTION_17"; break;
2081 2132 case UT_TRAP_INSTRUCTION_18:
2082 2133 s = "UT_TRAP_INSTRUCTION_18"; break;
2083 2134 case UT_TRAP_INSTRUCTION_19:
2084 2135 s = "UT_TRAP_INSTRUCTION_19"; break;
2085 2136 case UT_TRAP_INSTRUCTION_20:
2086 2137 s = "UT_TRAP_INSTRUCTION_20"; break;
2087 2138 case UT_TRAP_INSTRUCTION_21:
2088 2139 s = "UT_TRAP_INSTRUCTION_21"; break;
2089 2140 case UT_TRAP_INSTRUCTION_22:
2090 2141 s = "UT_TRAP_INSTRUCTION_22"; break;
2091 2142 case UT_TRAP_INSTRUCTION_23:
2092 2143 s = "UT_TRAP_INSTRUCTION_23"; break;
2093 2144 case UT_TRAP_INSTRUCTION_24:
2094 2145 s = "UT_TRAP_INSTRUCTION_24"; break;
2095 2146 case UT_TRAP_INSTRUCTION_25:
2096 2147 s = "UT_TRAP_INSTRUCTION_25"; break;
2097 2148 case UT_TRAP_INSTRUCTION_26:
2098 2149 s = "UT_TRAP_INSTRUCTION_26"; break;
2099 2150 case UT_TRAP_INSTRUCTION_27:
2100 2151 s = "UT_TRAP_INSTRUCTION_27"; break;
2101 2152 case UT_TRAP_INSTRUCTION_28:
2102 2153 s = "UT_TRAP_INSTRUCTION_28"; break;
2103 2154 case UT_TRAP_INSTRUCTION_29:
2104 2155 s = "UT_TRAP_INSTRUCTION_29"; break;
2105 2156 case UT_TRAP_INSTRUCTION_30:
2106 2157 s = "UT_TRAP_INSTRUCTION_30"; break;
2107 2158 case UT_TRAP_INSTRUCTION_31:
2108 2159 s = "UT_TRAP_INSTRUCTION_31"; break;
2109 2160 }
2110 2161 }
2111 2162 #endif /* __sparc */
2112 2163
2113 2164 if (s == NULL)
2114 2165 prt_dec(pri, 0, val);
2115 2166 else
2116 2167 outstring(pri, s);
2117 2168 }
2118 2169
2119 2170
2120 2171 /*
2121 2172 * Print utrap handler
2122 2173 */
2123 2174 void
2124 2175 prt_uth(private_t *pri, int raw, long val)
2125 2176 {
2126 2177 const char *s = NULL;
2127 2178
2128 2179 if (!raw) {
2129 2180 switch (val) {
2130 2181 case (long)UTH_NOCHANGE: s = "UTH_NOCHANGE"; break;
2131 2182 }
2132 2183 }
2133 2184
2134 2185 if (s == NULL)
2135 2186 prt_hex(pri, 0, val);
2136 2187 else
2137 2188 outstring(pri, s);
2138 2189 }
2139 2190
2140 2191 const char *
2141 2192 access_flags(private_t *pri, long arg)
2142 2193 {
2143 2194 #define E_OK 010
2144 2195 char *str = pri->code_buf;
2145 2196
2146 2197 if (arg & ~(R_OK|W_OK|X_OK|E_OK))
2147 2198 return (NULL);
2148 2199
2149 2200 /* NB: F_OK == 0 */
2150 2201 if (arg == F_OK)
2151 2202 return ("F_OK");
2152 2203 if (arg == E_OK)
2153 2204 return ("F_OK|E_OK");
2154 2205
2155 2206 *str = '\0';
2156 2207 if (arg & R_OK)
2157 2208 (void) strlcat(str, "|R_OK", sizeof (pri->code_buf));
2158 2209 if (arg & W_OK)
2159 2210 (void) strlcat(str, "|W_OK", sizeof (pri->code_buf));
2160 2211 if (arg & X_OK)
2161 2212 (void) strlcat(str, "|X_OK", sizeof (pri->code_buf));
2162 2213 if (arg & E_OK)
2163 2214 (void) strlcat(str, "|E_OK", sizeof (pri->code_buf));
2164 2215 return ((const char *)(str + 1));
2165 2216 #undef E_OK
2166 2217 }
2167 2218
2168 2219 /*
2169 2220 * Print access() flags.
2170 2221 */
2171 2222 void
2172 2223 prt_acc(private_t *pri, int raw, long val)
2173 2224 {
2174 2225 const char *s = raw? NULL : access_flags(pri, val);
2175 2226
2176 2227 if (s == NULL)
2177 2228 prt_dex(pri, 0, val);
2178 2229 else
2179 2230 outstring(pri, s);
2180 2231 }
2181 2232
2182 2233 /*
2183 2234 * Print shutdown() "how" (2nd) argument
2184 2235 */
2185 2236 void
2186 2237 prt_sht(private_t *pri, int raw, long val)
2187 2238 {
2188 2239 if (raw) {
2189 2240 prt_dex(pri, 0, val);
2190 2241 return;
2191 2242 }
2192 2243 switch (val) {
2193 2244 case SHUT_RD: outstring(pri, "SHUT_RD"); break;
2194 2245 case SHUT_WR: outstring(pri, "SHUT_WR"); break;
2195 2246 case SHUT_RDWR: outstring(pri, "SHUT_RDWR"); break;
2196 2247 default: prt_dec(pri, 0, val); break;
2197 2248 }
2198 2249 }
2199 2250
2200 2251 /*
2201 2252 * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg)
2202 2253 */
2203 2254 static struct fcntl_flags {
2204 2255 long val;
2205 2256 const char *name;
2206 2257 } fcntl_flags[] = {
2207 2258 #define FC_FL(flag) { (long)flag, "|" # flag }
2208 2259 FC_FL(FREVOKED),
2209 2260 FC_FL(FREAD),
2210 2261 FC_FL(FWRITE),
2211 2262 FC_FL(FNDELAY),
2212 2263 FC_FL(FAPPEND),
2213 2264 FC_FL(FSYNC),
2214 2265 FC_FL(FDSYNC),
2215 2266 FC_FL(FRSYNC),
2216 2267 FC_FL(FOFFMAX),
2217 2268 FC_FL(FNONBLOCK),
2218 2269 FC_FL(FCREAT),
2219 2270 FC_FL(FTRUNC),
2220 2271 FC_FL(FEXCL),
2221 2272 FC_FL(FNOCTTY),
2222 2273 FC_FL(FXATTR),
2223 2274 FC_FL(FASYNC),
2224 2275 FC_FL(FNODSYNC)
2225 2276 #undef FC_FL
2226 2277 };
2227 2278
2228 2279 void
2229 2280 prt_ffg(private_t *pri, int raw, long val)
2230 2281 {
2231 2282 #define CBSIZE sizeof (pri->code_buf)
2232 2283 char *s = pri->code_buf;
2233 2284 size_t used = 1;
2234 2285 struct fcntl_flags *fp;
2235 2286
2236 2287 if (raw) {
2237 2288 (void) snprintf(s, CBSIZE, "0x%lx", val);
2238 2289 outstring(pri, s);
2239 2290 return;
2240 2291 }
2241 2292 if (val == 0) {
2242 2293 outstring(pri, "(no flags)");
2243 2294 return;
2244 2295 }
2245 2296
2246 2297 *s = '\0';
2247 2298 for (fp = fcntl_flags;
2248 2299 fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) {
2249 2300 if (val & fp->val) {
2250 2301 used = strlcat(s, fp->name, CBSIZE);
2251 2302 val &= ~fp->val;
2252 2303 }
2253 2304 }
2254 2305
2255 2306 if (val != 0 && used <= CBSIZE)
2256 2307 used += snprintf(s + used, CBSIZE - used, "|0x%lx", val);
2257 2308
2258 2309 if (used >= CBSIZE)
2259 2310 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
2260 2311 outstring(pri, s + 1);
2261 2312 #undef CBSIZE
2262 2313 }
2263 2314
2264 2315 void
2265 2316 prt_prs(private_t *pri, int raw, long val)
2266 2317 {
2267 2318 static size_t setsize;
2268 2319 priv_set_t *set = priv_allocset();
2269 2320
2270 2321 if (setsize == 0) {
2271 2322 const priv_impl_info_t *info = getprivimplinfo();
2272 2323 if (info != NULL)
2273 2324 setsize = info->priv_setsize * sizeof (priv_chunk_t);
2274 2325 }
2275 2326
2276 2327 if (setsize != 0 && !raw && set != NULL &&
2277 2328 Pread(Proc, set, setsize, val) == setsize) {
2278 2329 int i;
2279 2330
2280 2331 outstring(pri, "{");
2281 2332 for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) {
2282 2333 char buf[9]; /* 8 hex digits + '\0' */
2283 2334 (void) snprintf(buf, sizeof (buf), "%08x",
2284 2335 ((priv_chunk_t *)set)[i]);
2285 2336 outstring(pri, buf);
2286 2337 }
2287 2338
2288 2339 outstring(pri, "}");
2289 2340 } else {
2290 2341 prt_hex(pri, 0, val);
2291 2342 }
2292 2343
2293 2344 if (set != NULL)
2294 2345 priv_freeset(set);
2295 2346 }
2296 2347
2297 2348 /*
2298 2349 * Print privilege set operation.
2299 2350 */
2300 2351 void
2301 2352 prt_pro(private_t *pri, int raw, long val)
2302 2353 {
2303 2354 const char *s = NULL;
2304 2355
2305 2356 if (!raw) {
2306 2357 switch ((priv_op_t)val) {
2307 2358 case PRIV_ON: s = "PRIV_ON"; break;
2308 2359 case PRIV_OFF: s = "PRIV_OFF"; break;
2309 2360 case PRIV_SET: s = "PRIV_SET"; break;
2310 2361 }
2311 2362 }
2312 2363
2313 2364 if (s == NULL)
2314 2365 prt_dec(pri, 0, val);
2315 2366 else
2316 2367 outstring(pri, s);
2317 2368 }
2318 2369
2319 2370 /*
2320 2371 * Print privilege set name
2321 2372 */
2322 2373 void
2323 2374 prt_prn(private_t *pri, int raw, long val)
2324 2375 {
2325 2376 const char *s = NULL;
2326 2377
2327 2378 if (!raw)
2328 2379 s = priv_getsetbynum((int)val);
2329 2380
2330 2381 if (s == NULL)
2331 2382 prt_dec(pri, 0, val);
2332 2383 else {
2333 2384 char *dup = strdup(s);
2334 2385 char *q;
2335 2386
2336 2387 /* Do the best we can in this case */
2337 2388 if (dup == NULL) {
2338 2389 outstring(pri, s);
2339 2390 return;
2340 2391 }
2341 2392
2342 2393 outstring(pri, "PRIV_");
2343 2394
2344 2395 q = dup;
2345 2396
2346 2397 while (*q != '\0') {
2347 2398 *q = toupper(*q);
2348 2399 q++;
2349 2400 }
2350 2401 outstring(pri, dup);
2351 2402 free(dup);
2352 2403 }
2353 2404 }
2354 2405
2355 2406 /*
2356 2407 * Print process flag names.
2357 2408 */
2358 2409 void
2359 2410 prt_pfl(private_t *pri, int raw, long val)
2360 2411 {
2361 2412 const char *s = NULL;
2362 2413
2363 2414 if (!raw) {
2364 2415 switch ((int)val) {
2365 2416 case PRIV_DEBUG: s = "PRIV_DEBUG"; break;
2366 2417 case PRIV_AWARE: s = "PRIV_AWARE"; break;
2367 2418 case PRIV_XPOLICY: s = "PRIV_XPOLICY"; break;
2368 2419 case PRIV_AWARE_RESET: s = "PRIV_AWARE_RESET"; break;
2369 2420 case PRIV_PFEXEC: s = "PRIV_PFEXEC"; break;
2370 2421 case NET_MAC_AWARE: s = "NET_MAC_AWARE"; break;
2371 2422 case NET_MAC_AWARE_INHERIT:
2372 2423 s = "NET_MAC_AWARE_INHERIT";
2373 2424 break;
2374 2425 }
2375 2426 }
2376 2427
2377 2428 if (s == NULL)
2378 2429 prt_dec(pri, 0, val);
2379 2430 else
2380 2431 outstring(pri, s);
2381 2432 }
2382 2433
2383 2434 /*
2384 2435 * Print lgrp_affinity_{get,set}() arguments.
2385 2436 */
2386 2437 /*ARGSUSED*/
2387 2438 void
2388 2439 prt_laf(private_t *pri, int raw, long val)
2389 2440 {
2390 2441 lgrp_affinity_args_t laff;
2391 2442
2392 2443 if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) !=
2393 2444 sizeof (lgrp_affinity_args_t)) {
2394 2445 prt_hex(pri, 0, val);
2395 2446 return;
2396 2447 }
2397 2448 /*
2398 2449 * arrange the arguments in the order that user calls with
2399 2450 */
2400 2451 prt_dec(pri, 0, laff.idtype);
2401 2452 outstring(pri, ", ");
2402 2453 prt_dec(pri, 0, laff.id);
2403 2454 outstring(pri, ", ");
2404 2455 prt_dec(pri, 0, laff.lgrp);
2405 2456 outstring(pri, ", ");
2406 2457 if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET)
2407 2458 prt_dec(pri, 0, laff.aff);
2408 2459 }
2409 2460
2410 2461 /*
2411 2462 * Print a key_t as IPC_PRIVATE if it is 0.
2412 2463 */
2413 2464 void
2414 2465 prt_key(private_t *pri, int raw, long val)
2415 2466 {
2416 2467 if (!raw && val == 0)
2417 2468 outstring(pri, "IPC_PRIVATE");
2418 2469 else
2419 2470 prt_dec(pri, 0, val);
2420 2471 }
2421 2472
2422 2473
2423 2474 /*
2424 2475 * Print zone_getattr() attribute types.
2425 2476 */
2426 2477 void
2427 2478 prt_zga(private_t *pri, int raw, long val)
2428 2479 {
2429 2480 const char *s = NULL;
2430 2481
2431 2482 if (!raw) {
2432 2483 switch ((int)val) {
2433 2484 case ZONE_ATTR_NAME: s = "ZONE_ATTR_NAME"; break;
2434 2485 case ZONE_ATTR_ROOT: s = "ZONE_ATTR_ROOT"; break;
2435 2486 case ZONE_ATTR_STATUS: s = "ZONE_ATTR_STATUS"; break;
2436 2487 case ZONE_ATTR_PRIVSET: s = "ZONE_ATTR_PRIVSET"; break;
2437 2488 case ZONE_ATTR_UNIQID: s = "ZONE_ATTR_UNIQID"; break;
2438 2489 case ZONE_ATTR_POOLID: s = "ZONE_ATTR_POOLID"; break;
2439 2490 case ZONE_ATTR_INITPID: s = "ZONE_ATTR_INITPID"; break;
2440 2491 case ZONE_ATTR_SLBL: s = "ZONE_ATTR_SLBL"; break;
2441 2492 case ZONE_ATTR_INITNAME: s = "ZONE_ATTR_INITNAME"; break;
2442 2493 case ZONE_ATTR_BOOTARGS: s = "ZONE_ATTR_BOOTARGS"; break;
2443 2494 case ZONE_ATTR_BRAND: s = "ZONE_ATTR_BRAND"; break;
2444 2495 case ZONE_ATTR_FLAGS: s = "ZONE_ATTR_FLAGS"; break;
2445 2496 case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break;
2446 2497 }
2447 2498 }
2448 2499
2449 2500 if (s == NULL)
2450 2501 prt_dec(pri, 0, val);
2451 2502 else
2452 2503 outstring(pri, s);
2453 2504 }
2454 2505
2455 2506 /*
2456 2507 * Print a file descriptor as AT_FDCWD if necessary
2457 2508 */
2458 2509 void
2459 2510 prt_atc(private_t *pri, int raw, long val)
2460 2511 {
2461 2512 if ((int)val == AT_FDCWD) {
2462 2513 if (raw)
2463 2514 prt_hex(pri, 0, (uint_t)AT_FDCWD);
2464 2515 else
2465 2516 outstring(pri, "AT_FDCWD");
2466 2517 } else {
2467 2518 prt_dec(pri, 0, val);
2468 2519 }
2469 2520 }
2470 2521
2471 2522 /*
2472 2523 * Print Trusted Networking database operation codes (labelsys; tn*)
2473 2524 */
2474 2525 static void
2475 2526 prt_tnd(private_t *pri, int raw, long val)
2476 2527 {
2477 2528 const char *s = NULL;
2478 2529
2479 2530 if (!raw) {
2480 2531 switch ((tsol_dbops_t)val) {
2481 2532 case TNDB_NOOP: s = "TNDB_NOOP"; break;
2482 2533 case TNDB_LOAD: s = "TNDB_LOAD"; break;
2483 2534 case TNDB_DELETE: s = "TNDB_DELETE"; break;
2484 2535 case TNDB_FLUSH: s = "TNDB_FLUSH"; break;
2485 2536 case TNDB_GET: s = "TNDB_GET"; break;
2486 2537 }
2487 2538 }
2488 2539
2489 2540 if (s == NULL)
2490 2541 prt_dec(pri, 0, val);
2491 2542 else
2492 2543 outstring(pri, s);
2493 2544 }
2494 2545
2495 2546 /*
2496 2547 * Print LIO_XX flags
2497 2548 */
2498 2549 void
2499 2550 prt_lio(private_t *pri, int raw, long val)
2500 2551 {
2501 2552 if (raw)
2502 2553 prt_dec(pri, 0, val);
2503 2554 else if (val == LIO_WAIT)
2504 2555 outstring(pri, "LIO_WAIT");
2505 2556 else if (val == LIO_NOWAIT)
2506 2557 outstring(pri, "LIO_NOWAIT");
2507 2558 else
2508 2559 prt_dec(pri, 0, val);
2509 2560 }
2510 2561
2511 2562 const char *
2512 2563 door_flags(private_t *pri, long val)
2513 2564 {
2514 2565 door_attr_t attr = (door_attr_t)val;
2515 2566 char *str = pri->code_buf;
2516 2567
2517 2568 *str = '\0';
2518 2569 #define PROCESS_FLAG(flg) \
2519 2570 if (attr & flg) { \
2520 2571 (void) strlcat(str, "|" #flg, sizeof (pri->code_buf)); \
2521 2572 attr &= ~flg; \
2522 2573 }
2523 2574
2524 2575 PROCESS_FLAG(DOOR_UNREF);
2525 2576 PROCESS_FLAG(DOOR_UNREF_MULTI);
2526 2577 PROCESS_FLAG(DOOR_PRIVATE);
2527 2578 PROCESS_FLAG(DOOR_REFUSE_DESC);
2528 2579 PROCESS_FLAG(DOOR_NO_CANCEL);
2529 2580 PROCESS_FLAG(DOOR_LOCAL);
2530 2581 PROCESS_FLAG(DOOR_REVOKED);
2531 2582 PROCESS_FLAG(DOOR_IS_UNREF);
2532 2583 #undef PROCESS_FLAG
2533 2584
2534 2585 if (attr != 0 || *str == '\0') {
2535 2586 size_t len = strlen(str);
2536 2587 (void) snprintf(str + len, sizeof (pri->code_buf) - len,
2537 2588 "|0x%X", attr);
2538 2589 }
2539 2590
2540 2591 return (str + 1);
2541 2592 }
2542 2593
2543 2594 /*
2544 2595 * Print door_create() flags
2545 2596 */
2546 2597 void
2547 2598 prt_dfl(private_t *pri, int raw, long val)
2548 2599 {
2549 2600 if (raw)
2550 2601 prt_hex(pri, 0, val);
2551 2602 else
2552 2603 outstring(pri, door_flags(pri, val));
2553 2604 }
2554 2605
2555 2606 /*
2556 2607 * Print door_*param() param argument
2557 2608 */
2558 2609 void
2559 2610 prt_dpm(private_t *pri, int raw, long val)
2560 2611 {
2561 2612 if (raw)
2562 2613 prt_hex(pri, 0, val);
2563 2614 else if (val == DOOR_PARAM_DESC_MAX)
2564 2615 outstring(pri, "DOOR_PARAM_DESC_MAX");
2565 2616 else if (val == DOOR_PARAM_DATA_MIN)
2566 2617 outstring(pri, "DOOR_PARAM_DATA_MIN");
2567 2618 else if (val == DOOR_PARAM_DATA_MAX)
2568 2619 outstring(pri, "DOOR_PARAM_DATA_MAX");
2569 2620 else
2570 2621 prt_hex(pri, 0, val);
2571 2622 }
2572 2623
2573 2624 /*
2574 2625 * Print rctlsys subcodes
2575 2626 */
2576 2627 void
2577 2628 prt_rsc(private_t *pri, int raw, long val) /* print utssys code */
2578 2629 {
2579 2630 const char *s = raw? NULL : rctlsyscode(val);
2580 2631
2581 2632 if (s == NULL)
2582 2633 prt_dec(pri, 0, val);
2583 2634 else
2584 2635 outstring(pri, s);
2585 2636 }
2586 2637
2587 2638 /*
2588 2639 * Print getrctl flags
2589 2640 */
2590 2641 void
2591 2642 prt_rgf(private_t *pri, int raw, long val)
2592 2643 {
2593 2644 long action = val & (~RCTLSYS_ACTION_MASK);
2594 2645
2595 2646 if (raw)
2596 2647 prt_hex(pri, 0, val);
2597 2648 else if (action == RCTL_FIRST)
2598 2649 outstring(pri, "RCTL_FIRST");
2599 2650 else if (action == RCTL_NEXT)
2600 2651 outstring(pri, "RCTL_NEXT");
2601 2652 else if (action == RCTL_USAGE)
2602 2653 outstring(pri, "RCTL_USAGE");
2603 2654 else
2604 2655 prt_hex(pri, 0, val);
2605 2656 }
2606 2657
2607 2658 /*
2608 2659 * Print setrctl flags
2609 2660 */
2610 2661 void
2611 2662 prt_rsf(private_t *pri, int raw, long val)
2612 2663 {
2613 2664 long action = val & (~RCTLSYS_ACTION_MASK);
2614 2665 long pval = val & RCTL_LOCAL_ACTION_MASK;
2615 2666 char *s = pri->code_buf;
2616 2667
2617 2668 if (raw) {
2618 2669 prt_hex(pri, 0, val);
2619 2670 return;
2620 2671 } else if (action == RCTL_INSERT)
2621 2672 (void) strcpy(s, "RCTL_INSERT");
2622 2673 else if (action == RCTL_DELETE)
2623 2674 (void) strcpy(s, "RCTL_DELETE");
2624 2675 else if (action == RCTL_REPLACE)
2625 2676 (void) strcpy(s, "RCTL_REPLACE");
2626 2677 else {
2627 2678 prt_hex(pri, 0, val);
2628 2679 return;
2629 2680 }
2630 2681
2631 2682 if (pval & RCTL_USE_RECIPIENT_PID) {
2632 2683 pval ^= RCTL_USE_RECIPIENT_PID;
2633 2684 (void) strlcat(s, "|RCTL_USE_RECIPIENT_PID",
2634 2685 sizeof (pri->code_buf));
2635 2686 }
2636 2687
2637 2688 if ((pval & RCTLSYS_ACTION_MASK) != 0)
2638 2689 prt_hex(pri, 0, val);
2639 2690 else if (*s != '\0')
2640 2691 outstring(pri, s);
2641 2692 else
2642 2693 prt_hex(pri, 0, val);
2643 2694 }
2644 2695
2645 2696 /*
2646 2697 * Print rctlctl flags
2647 2698 */
2648 2699 void
2649 2700 prt_rcf(private_t *pri, int raw, long val)
2650 2701 {
2651 2702 long action = val & (~RCTLSYS_ACTION_MASK);
2652 2703
2653 2704 if (raw)
2654 2705 prt_hex(pri, 0, val);
2655 2706 else if (action == RCTLCTL_GET)
2656 2707 outstring(pri, "RCTLCTL_GET");
2657 2708 else if (action == RCTLCTL_SET)
2658 2709 outstring(pri, "RCTLCTL_SET");
2659 2710 else
2660 2711 prt_hex(pri, 0, val);
2661 2712 }
2662 2713
2663 2714 /*
2664 2715 * Print setprojrctl flags
2665 2716 */
2666 2717 void
2667 2718 prt_spf(private_t *pri, int raw, long val)
2668 2719 {
2669 2720 long action = val & TASK_PROJ_MASK;
2670 2721
2671 2722 if (!raw && (action == TASK_PROJ_PURGE))
2672 2723 outstring(pri, "TASK_PROJ_PURGE");
2673 2724 else
2674 2725 prt_hex(pri, 0, val);
2675 2726 }
2676 2727
2677 2728 /*
2678 2729 * Print forkx() flags
2679 2730 */
2680 2731 void
2681 2732 prt_fxf(private_t *pri, int raw, long val)
2682 2733 {
2683 2734 char *str;
2684 2735
2685 2736 if (val == 0)
2686 2737 outstring(pri, "0");
2687 2738 else if (raw || (val & ~(FORK_NOSIGCHLD | FORK_WAITPID)))
2688 2739 prt_hhx(pri, 0, val);
2689 2740 else {
2690 2741 str = pri->code_buf;
2691 2742 *str = '\0';
2692 2743 if (val & FORK_NOSIGCHLD)
2693 2744 (void) strlcat(str, "|FORK_NOSIGCHLD",
2694 2745 sizeof (pri->code_buf));
2695 2746 if (val & FORK_WAITPID)
2696 2747 (void) strlcat(str, "|FORK_WAITPID",
2697 2748 sizeof (pri->code_buf));
2698 2749 outstring(pri, str + 1);
2699 2750 }
2700 2751 }
2701 2752
2702 2753 /*
2703 2754 * Print faccessat() flag
2704 2755 */
2705 2756 void
2706 2757 prt_fat(private_t *pri, int raw, long val)
2707 2758 {
2708 2759 if (val == 0)
2709 2760 outstring(pri, "0");
2710 2761 else if (!raw && val == AT_EACCESS)
2711 2762 outstring(pri, "AT_EACCESS");
2712 2763 else
2713 2764 prt_hex(pri, 0, val);
2714 2765 }
2715 2766
2716 2767 /*
2717 2768 * Print unlinkat() flag
2718 2769 */
2719 2770 void
2720 2771 prt_uat(private_t *pri, int raw, long val)
2721 2772 {
2722 2773 if (val == 0)
2723 2774 outstring(pri, "0");
2724 2775 else if (!raw && val == AT_REMOVEDIR)
2725 2776 outstring(pri, "AT_REMOVEDIR");
2726 2777 else
2727 2778 prt_hex(pri, 0, val);
2728 2779 }
2729 2780
2730 2781 /*
2731 2782 * Print AT_SYMLINK_NOFOLLOW / AT_SYMLINK_FOLLOW flag
2732 2783 */
2733 2784 void
2734 2785 prt_snf(private_t *pri, int raw, long val)
2735 2786 {
2736 2787 if (val == 0)
2737 2788 outstring(pri, "0");
2738 2789 else if (!raw && val == AT_SYMLINK_NOFOLLOW)
2739 2790 outstring(pri, "AT_SYMLINK_NOFOLLOW");
2740 2791 else if (!raw && val == AT_SYMLINK_FOLLOW)
2741 2792 outstring(pri, "AT_SYMLINK_FOLLOW");
2742 2793 else
2743 2794 prt_hex(pri, 0, val);
2744 2795 }
2745 2796
2746 2797 void
2747 2798 prt_grf(private_t *pri, int raw, long val)
2748 2799 {
2749 2800 int first = 1;
2750 2801
2751 2802 if (raw != 0 || val == 0 ||
2752 2803 (val & ~(GRND_NONBLOCK | GRND_RANDOM)) != 0) {
2753 2804 outstring(pri, "0");
2754 2805 return;
2755 2806 }
2756 2807
2757 2808 if (val & GRND_NONBLOCK) {
2758 2809 outstring(pri, "|GRND_NONBLOCK" + first);
2759 2810 first = 0;
2760 2811 }
2761 2812 if (val & GRND_RANDOM) {
2762 2813 outstring(pri, "|GRND_RANDOM" + first);
2763 2814 first = 0;
2764 2815 }
2765 2816 }
2766 2817
2767 2818 /*
2768 2819 * Array of pointers to print functions, one for each format.
2769 2820 */
2770 2821 void (* const Print[])() = {
2771 2822 prt_nov, /* NOV -- no value */
2772 2823 prt_dec, /* DEC -- print value in decimal */
2773 2824 prt_oct, /* OCT -- print value in octal */
2774 2825 prt_hex, /* HEX -- print value in hexadecimal */
2775 2826 prt_dex, /* DEX -- print value in hexadecimal if big enough */
2776 2827 prt_stg, /* STG -- print value as string */
2777 2828 prt_ioc, /* IOC -- print ioctl code */
2778 2829 prt_fcn, /* FCN -- print fcntl code */
2779 2830 prt_s86, /* S86 -- print sysi86 code */
2780 2831 prt_uts, /* UTS -- print utssys code */
2781 2832 prt_opn, /* OPN -- print open code */
2782 2833 prt_sig, /* SIG -- print signal name plus flags */
2783 2834 prt_uat, /* UAT -- print unlinkat() flag */
2784 2835 prt_msc, /* MSC -- print msgsys command */
2785 2836 prt_msf, /* MSF -- print msgsys flags */
2786 2837 prt_smc, /* SMC -- print semsys command */
2787 2838 prt_sef, /* SEF -- print semsys flags */
2788 2839 prt_shc, /* SHC -- print shmsys command */
2789 2840 prt_shf, /* SHF -- print shmsys flags */
2790 2841 prt_fat, /* FAT -- print faccessat( flag */
2791 2842 prt_sfs, /* SFS -- print sysfs code */
2792 2843 prt_rst, /* RST -- print string returned by syscall */
2793 2844 prt_smf, /* SMF -- print streams message flags */
2794 2845 prt_ioa, /* IOA -- print ioctl argument */
2795 2846 prt_pip, /* PIP -- print pipe flags */
2796 2847 prt_mtf, /* MTF -- print mount flags */
2797 2848 prt_mft, /* MFT -- print mount file system type */
2798 2849 prt_iob, /* IOB -- print contents of I/O buffer */
2799 2850 prt_hhx, /* HHX -- print value in hexadecimal (half size) */
2800 2851 prt_wop, /* WOP -- print waitsys() options */
2801 2852 prt_spm, /* SPM -- print sigprocmask argument */
2802 2853 prt_rlk, /* RLK -- print readlink buffer */
2803 2854 prt_mpr, /* MPR -- print mmap()/mprotect() flags */
2804 2855 prt_mty, /* MTY -- print mmap() mapping type flags */
2805 2856 prt_mcf, /* MCF -- print memcntl() function */
2806 2857 prt_mc4, /* MC4 -- print memcntl() (fourth) argument */
2807 2858 prt_mc5, /* MC5 -- print memcntl() (fifth) argument */
2808 2859 prt_mad, /* MAD -- print madvise() argument */
2809 2860 prt_ulm, /* ULM -- print ulimit() argument */
2810 2861 prt_rlm, /* RLM -- print get/setrlimit() argument */
2811 2862 prt_cnf, /* CNF -- print sysconfig() argument */
2812 2863 prt_inf, /* INF -- print sysinfo() argument */
2813 2864 prt_ptc, /* PTC -- print pathconf/fpathconf() argument */
2814 2865 prt_fui, /* FUI -- print fusers() input argument */
2815 2866 prt_idt, /* IDT -- print idtype_t, waitid() argument */
2816 2867 prt_lwf, /* LWF -- print lwp_create() flags */
2817 2868 prt_itm, /* ITM -- print [get|set]itimer() arg */
2818 2869 prt_llo, /* LLO -- print long long offset arg */
2819 2870 prt_mod, /* MOD -- print modctl() subcode */
2820 2871 prt_whn, /* WHN -- print lseek() whence arguiment */
2821 2872 prt_acl, /* ACL -- print acl() code */
2822 2873 prt_aio, /* AIO -- print kaio() code */
2823 2874 prt_aud, /* AUD -- print auditsys() code */
2824 2875 prt_uns, /* DEC -- print value in unsigned decimal */
2825 2876 prt_clc, /* CLC -- print cladm command argument */
2826 2877 prt_clf, /* CLF -- print cladm flag argument */
2827 2878 prt_cor, /* COR -- print corectl() subcode */
2828 2879 prt_cco, /* CCO -- print corectl() options */
2829 2880 prt_ccc, /* CCC -- print corectl() content */
2830 2881 prt_rcc, /* RCC -- print corectl() returned content */
2831 2882 prt_cpc, /* CPC -- print cpc() subcode */
2832 2883 prt_sqc, /* SQC -- print sigqueue() si_code argument */
2833 2884 prt_pc4, /* PC4 -- print priocntlsys() (fourth) argument */
2834 2885 prt_pc5, /* PC5 -- print priocntlsys() (key, value) pairs */
2835 2886 prt_pst, /* PST -- print processor set id */
2836 2887 prt_mif, /* MIF -- print meminfo() arguments */
2837 2888 prt_pfm, /* PFM -- print so_socket() proto-family (1st) arg */
2838 2889 prt_skt, /* SKT -- print so_socket() socket-type (2nd) arg */
2839 2890 prt_skp, /* SKP -- print so_socket() protocol (3rd) arg */
2840 2891 prt_skv, /* SKV -- print socket version arg */
2841 2892 prt_sol, /* SOL -- print [sg]etsockopt() level (2nd) arg */
2842 2893 prt_son, /* SON -- print [sg]etsockopt() opt-name (3rd) arg */
2843 2894 prt_utt, /* UTT -- print utrap type */
2844 2895 prt_uth, /* UTH -- print utrap handler */
2845 2896 prt_acc, /* ACC -- print access() flags */
2846 2897 prt_sht, /* SHT -- print shutdown() how (2nd) argument */
2847 2898 prt_ffg, /* FFG -- print fcntl() flags (3rd) argument */
2848 2899 prt_prs, /* PRS -- print privilege set */
2849 2900 prt_pro, /* PRO -- print privilege set operation */
2850 2901 prt_prn, /* PRN -- print privilege set name */
2851 2902 prt_pfl, /* PFL -- print privilege/process flag name */
2852 2903 prt_laf, /* LAF -- print lgrp_affinity arguments */
2853 2904 prt_key, /* KEY -- print key_t 0 as IPC_PRIVATE */
2854 2905 prt_zga, /* ZGA -- print zone_getattr attribute types */
2855 2906 prt_atc, /* ATC -- print AT_FDCWD or file descriptor */
2856 2907 prt_lio, /* LIO -- print LIO_XX flags */
2857 2908 prt_dfl, /* DFL -- print door_create() flags */
2858 2909 prt_dpm, /* DPM -- print DOOR_PARAM_XX flags */
2859 2910 prt_tnd, /* TND -- print trusted network data base opcode */
2860 2911 prt_rsc, /* RSC -- print rctlsys() subcodes */
2861 2912 prt_rgf, /* RGF -- print getrctl() flags */
2862 2913 prt_rsf, /* RSF -- print setrctl() flags */
↓ open down ↓ |
1250 lines elided |
↑ open up ↑ |
2863 2914 prt_rcf, /* RCF -- print rctlsys_ctl() flags */
2864 2915 prt_fxf, /* FXF -- print forkx() flags */
2865 2916 prt_spf, /* SPF -- print rctlsys_projset() flags */
2866 2917 prt_un1, /* UN1 -- as prt_uns except for -1 */
2867 2918 prt_mob, /* MOB -- print mmapobj() flags */
2868 2919 prt_snf, /* SNF -- print AT_SYMLINK_[NO]FOLLOW flag */
2869 2920 prt_skc, /* SKC -- print sockconfig() subcode */
2870 2921 prt_acf, /* ACF -- print accept4 flags */
2871 2922 prt_pfd, /* PFD -- print pipe fds */
2872 2923 prt_grf, /* GRF -- print getrandom flags */
2924 + prt_psfcmd, /* PSFCMD -- print psecflags(2) command */
2925 + prt_psflags, /* PSFLG -- print psecflags(2) flags */
2873 2926 prt_dec, /* HID -- hidden argument, make this the last one */
2874 2927 };
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX