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