17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
545916cd2Sjpk * Common Development and Distribution License (the "License").
645916cd2Sjpk * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
21794f0adbSRoger A. Faulkner
227c478bd9Sstevel@tonic-gate /*
23134a1f4eSCasper H.S. Dik * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24b377984aSJohn Levon * Copyright 2020 Joyent, Inc.
2515f90b02SGarrett D'Amore * Copyright 2022 Garrett D'Amore
265fcf5f87SRobert Mustacchi * Copyright 2022 Oxide Computer Company
277c478bd9Sstevel@tonic-gate */
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
3027aa4812SToomas Soome /* All Rights Reserved */
317c478bd9Sstevel@tonic-gate
32187670a0STheo Schlossnagle /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
33187670a0STheo Schlossnagle
347c478bd9Sstevel@tonic-gate #define _SYSCALL32 /* make 32-bit compat headers visible */
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate #include <stdio.h>
377c478bd9Sstevel@tonic-gate #include <stdlib.h>
387c478bd9Sstevel@tonic-gate #include <unistd.h>
397c478bd9Sstevel@tonic-gate #include <string.h>
407c478bd9Sstevel@tonic-gate #include <signal.h>
417c478bd9Sstevel@tonic-gate #include <termio.h>
427c478bd9Sstevel@tonic-gate #include <stddef.h>
437c478bd9Sstevel@tonic-gate #include <limits.h>
443b862e9aSRoger A. Faulkner #include <fcntl.h>
457c478bd9Sstevel@tonic-gate #include <ctype.h>
467c478bd9Sstevel@tonic-gate #include <sys/types.h>
477c478bd9Sstevel@tonic-gate #include <sys/mman.h>
487c478bd9Sstevel@tonic-gate #include <sys/resource.h>
497c478bd9Sstevel@tonic-gate #include <sys/ulimit.h>
507c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
517c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
527c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
537c478bd9Sstevel@tonic-gate #include <sys/acl.h>
547c478bd9Sstevel@tonic-gate #include <stropts.h>
557c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
567c478bd9Sstevel@tonic-gate #include <sys/systeminfo.h>
577c478bd9Sstevel@tonic-gate #include <sys/cladm.h>
587c478bd9Sstevel@tonic-gate #include <sys/lwp.h>
597c478bd9Sstevel@tonic-gate #include <bsm/audit.h>
607c478bd9Sstevel@tonic-gate #include <libproc.h>
617c478bd9Sstevel@tonic-gate #include <priv.h>
627c478bd9Sstevel@tonic-gate #include <sys/aio.h>
637c478bd9Sstevel@tonic-gate #include <sys/aiocb.h>
647c478bd9Sstevel@tonic-gate #include <sys/corectl.h>
657c478bd9Sstevel@tonic-gate #include <sys/cpc_impl.h>
66*2b395c3cSAndy Fiddaman #include <sys/execx.h>
677c478bd9Sstevel@tonic-gate #include <sys/priocntl.h>
687c478bd9Sstevel@tonic-gate #include <sys/tspriocntl.h>
697c478bd9Sstevel@tonic-gate #include <sys/iapriocntl.h>
707c478bd9Sstevel@tonic-gate #include <sys/rtpriocntl.h>
717c478bd9Sstevel@tonic-gate #include <sys/fsspriocntl.h>
727c478bd9Sstevel@tonic-gate #include <sys/fxpriocntl.h>
73d2a70789SRichard Lowe #include <sys/proc.h>
747c478bd9Sstevel@tonic-gate #include <netdb.h>
757c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h>
767c478bd9Sstevel@tonic-gate #include <sys/socketvar.h>
777c478bd9Sstevel@tonic-gate #include <netinet/in.h>
787c478bd9Sstevel@tonic-gate #include <netinet/tcp.h>
797c478bd9Sstevel@tonic-gate #include <netinet/udp.h>
807c478bd9Sstevel@tonic-gate #include <netinet/sctp.h>
815fcf5f87SRobert Mustacchi #include <netinet/ip_mroute.h>
825fcf5f87SRobert Mustacchi #include <netinet/icmp6.h>
83e11c3f44Smeem #include <net/route.h>
847c478bd9Sstevel@tonic-gate #include <sys/utrap.h>
857c478bd9Sstevel@tonic-gate #include <sys/lgrp_user.h>
867c478bd9Sstevel@tonic-gate #include <sys/door.h>
8745916cd2Sjpk #include <sys/tsol/tndb.h>
88aa4a4f3bSnf #include <sys/rctl.h>
89aa4a4f3bSnf #include <sys/rctl_impl.h>
90657b1f3dSraf #include <sys/fork.h>
91532877c4Srd #include <sys/task.h>
929d12795fSRobert Mustacchi #include <sys/random.h>
937c478bd9Sstevel@tonic-gate #include "ramdata.h"
947c478bd9Sstevel@tonic-gate #include "print.h"
957c478bd9Sstevel@tonic-gate #include "proto.h"
967c478bd9Sstevel@tonic-gate #include "systable.h"
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate void grow(private_t *, int nbyte);
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate #define GROW(nb) if (pri->sys_leng + (nb) >= pri->sys_ssize) grow(pri, (nb))
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1047c478bd9Sstevel@tonic-gate void
prt_nov(private_t * pri,int raw,long val)1057c478bd9Sstevel@tonic-gate prt_nov(private_t *pri, int raw, long val) /* print nothing */
1067c478bd9Sstevel@tonic-gate {
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1107c478bd9Sstevel@tonic-gate void
prt_dec(private_t * pri,int raw,long val)1117c478bd9Sstevel@tonic-gate prt_dec(private_t *pri, int raw, long val) /* print as decimal */
1127c478bd9Sstevel@tonic-gate {
1137c478bd9Sstevel@tonic-gate GROW(24);
1147c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
1157c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
116fac3008cSeschrock "%d", (int)val);
1177c478bd9Sstevel@tonic-gate else
1187c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
119fac3008cSeschrock "%ld", val);
1207c478bd9Sstevel@tonic-gate }
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1237c478bd9Sstevel@tonic-gate void
prt_uns(private_t * pri,int raw,long val)1247c478bd9Sstevel@tonic-gate prt_uns(private_t *pri, int raw, long val) /* print as unsigned decimal */
1257c478bd9Sstevel@tonic-gate {
1267c478bd9Sstevel@tonic-gate GROW(24);
1277c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
1287c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
129fac3008cSeschrock "%u", (int)val);
1307c478bd9Sstevel@tonic-gate else
1317c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
132fac3008cSeschrock "%lu", val);
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate
135f48205beScasper /* print as unsigned decimal, except for -1 */
136f48205beScasper void
prt_un1(private_t * pri,int raw,long val)137f48205beScasper prt_un1(private_t *pri, int raw, long val)
138f48205beScasper {
139f48205beScasper if ((int)val == -1)
140f48205beScasper prt_dec(pri, raw, val);
141f48205beScasper else
142f48205beScasper prt_uns(pri, raw, val);
143f48205beScasper }
144f48205beScasper
1457c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1467c478bd9Sstevel@tonic-gate void
prt_oct(private_t * pri,int raw,long val)1477c478bd9Sstevel@tonic-gate prt_oct(private_t *pri, int raw, long val) /* print as octal */
1487c478bd9Sstevel@tonic-gate {
1497c478bd9Sstevel@tonic-gate GROW(24);
1507c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
1517c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
152fac3008cSeschrock "%#o", (int)val);
1537c478bd9Sstevel@tonic-gate else
1547c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
155fac3008cSeschrock "%#lo", val);
1567c478bd9Sstevel@tonic-gate }
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1597c478bd9Sstevel@tonic-gate void
prt_hex(private_t * pri,int raw,long val)1607c478bd9Sstevel@tonic-gate prt_hex(private_t *pri, int raw, long val) /* print as hexadecimal */
1617c478bd9Sstevel@tonic-gate {
1627c478bd9Sstevel@tonic-gate GROW(20);
1637c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
1647c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
165fac3008cSeschrock "0x%.8X", (int)val);
1667c478bd9Sstevel@tonic-gate else
1677c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
168fac3008cSeschrock "0x%.8lX", val);
1697c478bd9Sstevel@tonic-gate }
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gate /* print as hexadecimal (half size) */
1727c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1737c478bd9Sstevel@tonic-gate void
prt_hhx(private_t * pri,int raw,long val)1747c478bd9Sstevel@tonic-gate prt_hhx(private_t *pri, int raw, long val)
1757c478bd9Sstevel@tonic-gate {
1767c478bd9Sstevel@tonic-gate GROW(20);
1777c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
1787c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
179fac3008cSeschrock "0x%.4X", (int)val);
1807c478bd9Sstevel@tonic-gate else
1817c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
182fac3008cSeschrock "0x%.4lX", val);
1837c478bd9Sstevel@tonic-gate }
1847c478bd9Sstevel@tonic-gate
1857c478bd9Sstevel@tonic-gate /* print as decimal if small, else hexadecimal */
1867c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1877c478bd9Sstevel@tonic-gate void
prt_dex(private_t * pri,int raw,long val)1887c478bd9Sstevel@tonic-gate prt_dex(private_t *pri, int raw, long val)
1897c478bd9Sstevel@tonic-gate {
1907c478bd9Sstevel@tonic-gate if (val & 0xff000000)
1917c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
1927c478bd9Sstevel@tonic-gate else
1937c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
1947c478bd9Sstevel@tonic-gate }
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate /* print long long offset */
1977c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1987c478bd9Sstevel@tonic-gate void
prt_llo(private_t * pri,int raw,long val1,long val2)1997c478bd9Sstevel@tonic-gate prt_llo(private_t *pri, int raw, long val1, long val2)
2007c478bd9Sstevel@tonic-gate {
2017c478bd9Sstevel@tonic-gate int hival;
2027c478bd9Sstevel@tonic-gate int loval;
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_LTOH
2057c478bd9Sstevel@tonic-gate hival = (int)val2;
2067c478bd9Sstevel@tonic-gate loval = (int)val1;
2077c478bd9Sstevel@tonic-gate #else
2087c478bd9Sstevel@tonic-gate hival = (int)val1;
2097c478bd9Sstevel@tonic-gate loval = (int)val2;
2107c478bd9Sstevel@tonic-gate #endif
2117c478bd9Sstevel@tonic-gate
212fac3008cSeschrock if (hival == 0) {
2137c478bd9Sstevel@tonic-gate prt_dex(pri, 0, loval);
214fac3008cSeschrock } else {
2157c478bd9Sstevel@tonic-gate GROW(18);
2167c478bd9Sstevel@tonic-gate pri->sys_leng +=
217fac3008cSeschrock sprintf(pri->sys_string + pri->sys_leng, "0x%.8X%.8X",
218fac3008cSeschrock hival, loval);
2197c478bd9Sstevel@tonic-gate }
2207c478bd9Sstevel@tonic-gate }
2217c478bd9Sstevel@tonic-gate
2227c478bd9Sstevel@tonic-gate void
escape_string(private_t * pri,const char * s)2237c478bd9Sstevel@tonic-gate escape_string(private_t *pri, const char *s)
2247c478bd9Sstevel@tonic-gate {
2257c478bd9Sstevel@tonic-gate /*
2267c478bd9Sstevel@tonic-gate * We want to avoid outputting unprintable characters that may
2277c478bd9Sstevel@tonic-gate * destroy the user's terminal. So we do one pass to find any
2287c478bd9Sstevel@tonic-gate * unprintable characters, size the array appropriately, and
2297c478bd9Sstevel@tonic-gate * then walk each character by hand. Those that are unprintable
2307c478bd9Sstevel@tonic-gate * are replaced by a hex escape (\xNN). We also escape quotes for
2317c478bd9Sstevel@tonic-gate * completeness.
2327c478bd9Sstevel@tonic-gate */
2337c478bd9Sstevel@tonic-gate int i, unprintable, quotes;
2347c478bd9Sstevel@tonic-gate size_t len = strlen(s);
2357c478bd9Sstevel@tonic-gate for (i = 0, unprintable = 0, quotes = 0; i < len; i++) {
2367c478bd9Sstevel@tonic-gate if (!isprint(s[i]))
2377c478bd9Sstevel@tonic-gate unprintable++;
2387c478bd9Sstevel@tonic-gate if (s[i] == '"')
2397c478bd9Sstevel@tonic-gate quotes++;
2407c478bd9Sstevel@tonic-gate }
2417c478bd9Sstevel@tonic-gate
2427c478bd9Sstevel@tonic-gate GROW(len + 3 * unprintable + quotes + 2);
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate pri->sys_string[pri->sys_leng++] = '"';
2457c478bd9Sstevel@tonic-gate for (i = 0; i < len; i++) {
2467c478bd9Sstevel@tonic-gate if (s[i] == '"')
2477c478bd9Sstevel@tonic-gate pri->sys_string[pri->sys_leng++] = '\\';
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gate if (isprint(s[i])) {
2507c478bd9Sstevel@tonic-gate pri->sys_string[pri->sys_leng++] = s[i];
2517c478bd9Sstevel@tonic-gate } else {
2527c478bd9Sstevel@tonic-gate pri->sys_leng += sprintf(pri->sys_string +
253fac3008cSeschrock pri->sys_leng, "\\x%02x", (uint8_t)s[i]);
2547c478bd9Sstevel@tonic-gate }
2557c478bd9Sstevel@tonic-gate }
2567c478bd9Sstevel@tonic-gate pri->sys_string[pri->sys_leng++] = '"';
2577c478bd9Sstevel@tonic-gate }
2587c478bd9Sstevel@tonic-gate
2597c478bd9Sstevel@tonic-gate void
prt_stg(private_t * pri,int raw,long val)2607c478bd9Sstevel@tonic-gate prt_stg(private_t *pri, int raw, long val) /* print as string */
2617c478bd9Sstevel@tonic-gate {
2627c478bd9Sstevel@tonic-gate char *s = raw? NULL : fetchstring(pri, (long)val, PATH_MAX);
2637c478bd9Sstevel@tonic-gate
2647c478bd9Sstevel@tonic-gate if (s == NULL)
2657c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
2667c478bd9Sstevel@tonic-gate else
2677c478bd9Sstevel@tonic-gate escape_string(pri, s);
2687c478bd9Sstevel@tonic-gate }
2697c478bd9Sstevel@tonic-gate
2707c478bd9Sstevel@tonic-gate /* print as string returned from syscall */
2717c478bd9Sstevel@tonic-gate void
prt_rst(private_t * pri,int raw,long val)2727c478bd9Sstevel@tonic-gate prt_rst(private_t *pri, int raw, long val)
2737c478bd9Sstevel@tonic-gate {
2747c478bd9Sstevel@tonic-gate char *s = (raw || pri->Errno)? NULL :
275fac3008cSeschrock fetchstring(pri, (long)val, PATH_MAX);
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate if (s == NULL)
2787c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
2797c478bd9Sstevel@tonic-gate else {
2807c478bd9Sstevel@tonic-gate GROW((int)strlen(s) + 2);
2817c478bd9Sstevel@tonic-gate pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
2827c478bd9Sstevel@tonic-gate pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
2837c478bd9Sstevel@tonic-gate }
2847c478bd9Sstevel@tonic-gate }
2857c478bd9Sstevel@tonic-gate
2867c478bd9Sstevel@tonic-gate /* print contents of readlink() buffer */
2877c478bd9Sstevel@tonic-gate void
prt_rlk(private_t * pri,int raw,long val)2887c478bd9Sstevel@tonic-gate prt_rlk(private_t *pri, int raw, long val)
2897c478bd9Sstevel@tonic-gate {
2907c478bd9Sstevel@tonic-gate char *s = (raw || pri->Errno || pri->Rval1 <= 0)? NULL :
291fac3008cSeschrock fetchstring(pri, (long)val,
292fac3008cSeschrock (pri->Rval1 > PATH_MAX)? PATH_MAX : (int)pri->Rval1);
2937c478bd9Sstevel@tonic-gate
2947c478bd9Sstevel@tonic-gate if (s == NULL)
2957c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
2967c478bd9Sstevel@tonic-gate else {
2977c478bd9Sstevel@tonic-gate GROW((int)strlen(s) + 2);
2987c478bd9Sstevel@tonic-gate pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
2997c478bd9Sstevel@tonic-gate pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
3007c478bd9Sstevel@tonic-gate }
3017c478bd9Sstevel@tonic-gate }
3027c478bd9Sstevel@tonic-gate
3037c478bd9Sstevel@tonic-gate void
prt_ioc(private_t * pri,int raw,long val)3047c478bd9Sstevel@tonic-gate prt_ioc(private_t *pri, int raw, long val) /* print ioctl code */
3057c478bd9Sstevel@tonic-gate {
3067c478bd9Sstevel@tonic-gate const char *s = raw? NULL : ioctlname(pri, (int)val);
3077c478bd9Sstevel@tonic-gate
3087c478bd9Sstevel@tonic-gate if (s == NULL)
3097c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
3107c478bd9Sstevel@tonic-gate else
3117c478bd9Sstevel@tonic-gate outstring(pri, s);
3127c478bd9Sstevel@tonic-gate }
3137c478bd9Sstevel@tonic-gate
3147c478bd9Sstevel@tonic-gate void
prt_ioa(private_t * pri,int raw,long val)3157c478bd9Sstevel@tonic-gate prt_ioa(private_t *pri, int raw, long val) /* print ioctl argument */
3167c478bd9Sstevel@tonic-gate {
3177c478bd9Sstevel@tonic-gate const char *s;
3187c478bd9Sstevel@tonic-gate
3197c478bd9Sstevel@tonic-gate /* cheating -- look at the ioctl() code */
3207c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) {
3217c478bd9Sstevel@tonic-gate
3227c478bd9Sstevel@tonic-gate /* kstat ioctl()s */
3237c478bd9Sstevel@tonic-gate case KSTAT_IOC_READ:
3247c478bd9Sstevel@tonic-gate case KSTAT_IOC_WRITE:
3257c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32)
3267c478bd9Sstevel@tonic-gate prt_stg(pri, raw,
327fac3008cSeschrock val + offsetof(kstat32_t, ks_name[0]));
3287c478bd9Sstevel@tonic-gate else
3297c478bd9Sstevel@tonic-gate prt_stg(pri, raw,
330fac3008cSeschrock val + offsetof(kstat_t, ks_name[0]));
3317c478bd9Sstevel@tonic-gate break;
3327c478bd9Sstevel@tonic-gate
3337c478bd9Sstevel@tonic-gate /* streams ioctl()s */
3347c478bd9Sstevel@tonic-gate case I_LOOK:
3357c478bd9Sstevel@tonic-gate prt_rst(pri, raw, val);
3367c478bd9Sstevel@tonic-gate break;
3377c478bd9Sstevel@tonic-gate case I_PUSH:
3387c478bd9Sstevel@tonic-gate case I_FIND:
3397c478bd9Sstevel@tonic-gate prt_stg(pri, raw, val);
3407c478bd9Sstevel@tonic-gate break;
3417c478bd9Sstevel@tonic-gate case I_LINK:
3427c478bd9Sstevel@tonic-gate case I_UNLINK:
3437c478bd9Sstevel@tonic-gate case I_SENDFD:
3447c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
3457c478bd9Sstevel@tonic-gate break;
3467c478bd9Sstevel@tonic-gate case I_SRDOPT:
3477c478bd9Sstevel@tonic-gate if (raw || (s = strrdopt(val)) == NULL)
3487c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
3497c478bd9Sstevel@tonic-gate else
3507c478bd9Sstevel@tonic-gate outstring(pri, s);
3517c478bd9Sstevel@tonic-gate break;
3527c478bd9Sstevel@tonic-gate case I_SETSIG:
3537c478bd9Sstevel@tonic-gate if (raw || (s = strevents(pri, val)) == NULL)
3547c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
3557c478bd9Sstevel@tonic-gate else
3567c478bd9Sstevel@tonic-gate outstring(pri, s);
3577c478bd9Sstevel@tonic-gate break;
3587c478bd9Sstevel@tonic-gate case I_FLUSH:
3597c478bd9Sstevel@tonic-gate if (raw || (s = strflush(val)) == NULL)
3607c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
3617c478bd9Sstevel@tonic-gate else
3627c478bd9Sstevel@tonic-gate outstring(pri, s);
3637c478bd9Sstevel@tonic-gate break;
3647c478bd9Sstevel@tonic-gate
3657c478bd9Sstevel@tonic-gate /* tty ioctl()s */
3667c478bd9Sstevel@tonic-gate case TCSBRK:
3677c478bd9Sstevel@tonic-gate case TCXONC:
3687c478bd9Sstevel@tonic-gate case TCFLSH:
3697c478bd9Sstevel@tonic-gate case TCDSET:
3707c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
3717c478bd9Sstevel@tonic-gate break;
3727c478bd9Sstevel@tonic-gate
3737c478bd9Sstevel@tonic-gate default:
3747c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
3757c478bd9Sstevel@tonic-gate break;
3767c478bd9Sstevel@tonic-gate }
3777c478bd9Sstevel@tonic-gate }
3787c478bd9Sstevel@tonic-gate
3795dbfd19aSTheo Schlossnagle void
prt_pip(private_t * pri,int raw,long val)3805dbfd19aSTheo Schlossnagle prt_pip(private_t *pri, int raw, long val) /* print pipe code */
3815dbfd19aSTheo Schlossnagle {
3825dbfd19aSTheo Schlossnagle const char *s = NULL;
3835dbfd19aSTheo Schlossnagle
3845dbfd19aSTheo Schlossnagle if (!raw) {
3855dbfd19aSTheo Schlossnagle switch (val) {
3865dbfd19aSTheo Schlossnagle case O_CLOEXEC:
3875dbfd19aSTheo Schlossnagle s = "O_CLOEXEC";
3885dbfd19aSTheo Schlossnagle break;
3895dbfd19aSTheo Schlossnagle case O_NONBLOCK:
3905dbfd19aSTheo Schlossnagle s = "O_NONBLOCK";
3915dbfd19aSTheo Schlossnagle break;
3925dbfd19aSTheo Schlossnagle case O_CLOEXEC|O_NONBLOCK:
3935dbfd19aSTheo Schlossnagle s = "O_CLOEXEC|O_NONBLOCK";
3945dbfd19aSTheo Schlossnagle break;
3955dbfd19aSTheo Schlossnagle }
3965dbfd19aSTheo Schlossnagle }
3975dbfd19aSTheo Schlossnagle
3985dbfd19aSTheo Schlossnagle if (s == NULL)
3995dbfd19aSTheo Schlossnagle prt_dex(pri, 0, val);
4005dbfd19aSTheo Schlossnagle else
4015dbfd19aSTheo Schlossnagle outstring(pri, s);
4025dbfd19aSTheo Schlossnagle }
4035dbfd19aSTheo Schlossnagle
4045dbfd19aSTheo Schlossnagle void
prt_pfd(private_t * pri,int raw,long val)4055dbfd19aSTheo Schlossnagle prt_pfd(private_t *pri, int raw, long val) /* print pipe code */
4065dbfd19aSTheo Schlossnagle {
4075dbfd19aSTheo Schlossnagle int fds[2];
4085dbfd19aSTheo Schlossnagle char str[32];
4095dbfd19aSTheo Schlossnagle
4105dbfd19aSTheo Schlossnagle /* the fds only have meaning if the return value is 0 */
4115dbfd19aSTheo Schlossnagle if (!raw &&
4125dbfd19aSTheo Schlossnagle pri->Rval1 >= 0 &&
4135dbfd19aSTheo Schlossnagle Pread(Proc, fds, sizeof (fds), (long)val) == sizeof (fds)) {
4145eaceb49STheo Schlossnagle (void) snprintf(str, sizeof (str), "[%d,%d]", fds[0], fds[1]);
4155dbfd19aSTheo Schlossnagle outstring(pri, str);
4165dbfd19aSTheo Schlossnagle } else {
4175dbfd19aSTheo Schlossnagle prt_hex(pri, 0, val);
4185dbfd19aSTheo Schlossnagle }
4195dbfd19aSTheo Schlossnagle }
4205dbfd19aSTheo Schlossnagle
4217c478bd9Sstevel@tonic-gate void
prt_fcn(private_t * pri,int raw,long val)4227c478bd9Sstevel@tonic-gate prt_fcn(private_t *pri, int raw, long val) /* print fcntl code */
4237c478bd9Sstevel@tonic-gate {
4247c478bd9Sstevel@tonic-gate const char *s = raw? NULL : fcntlname(val);
4257c478bd9Sstevel@tonic-gate
4267c478bd9Sstevel@tonic-gate if (s == NULL)
4277c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
4287c478bd9Sstevel@tonic-gate else
4297c478bd9Sstevel@tonic-gate outstring(pri, s);
4307c478bd9Sstevel@tonic-gate }
4317c478bd9Sstevel@tonic-gate
4327c478bd9Sstevel@tonic-gate void
prt_s86(private_t * pri,int raw,long val)4337c478bd9Sstevel@tonic-gate prt_s86(private_t *pri, int raw, long val) /* print sysi86 code */
4347c478bd9Sstevel@tonic-gate {
4357c478bd9Sstevel@tonic-gate
4367c478bd9Sstevel@tonic-gate const char *s = raw? NULL : si86name(val);
4377c478bd9Sstevel@tonic-gate
4387c478bd9Sstevel@tonic-gate if (s == NULL)
4397c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
4407c478bd9Sstevel@tonic-gate else
4417c478bd9Sstevel@tonic-gate outstring(pri, s);
4427c478bd9Sstevel@tonic-gate }
4437c478bd9Sstevel@tonic-gate
4447c478bd9Sstevel@tonic-gate void
prt_uts(private_t * pri,int raw,long val)4457c478bd9Sstevel@tonic-gate prt_uts(private_t *pri, int raw, long val) /* print utssys code */
4467c478bd9Sstevel@tonic-gate {
4477c478bd9Sstevel@tonic-gate const char *s = raw? NULL : utscode(val);
4487c478bd9Sstevel@tonic-gate
4497c478bd9Sstevel@tonic-gate if (s == NULL)
4507c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
4517c478bd9Sstevel@tonic-gate else
4527c478bd9Sstevel@tonic-gate outstring(pri, s);
4537c478bd9Sstevel@tonic-gate }
4547c478bd9Sstevel@tonic-gate
4557c478bd9Sstevel@tonic-gate void
prt_msc(private_t * pri,int raw,long val)4567c478bd9Sstevel@tonic-gate prt_msc(private_t *pri, int raw, long val) /* print msgsys command */
4577c478bd9Sstevel@tonic-gate {
4587c478bd9Sstevel@tonic-gate const char *s = raw? NULL : msgcmd(val);
4597c478bd9Sstevel@tonic-gate
4607c478bd9Sstevel@tonic-gate if (s == NULL)
4617c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
4627c478bd9Sstevel@tonic-gate else
4637c478bd9Sstevel@tonic-gate outstring(pri, s);
4647c478bd9Sstevel@tonic-gate }
4657c478bd9Sstevel@tonic-gate
4667c478bd9Sstevel@tonic-gate void
prt_msf(private_t * pri,int raw,long val)4677c478bd9Sstevel@tonic-gate prt_msf(private_t *pri, int raw, long val) /* print msgsys flags */
4687c478bd9Sstevel@tonic-gate {
4697c478bd9Sstevel@tonic-gate const char *s = raw? NULL : msgflags(pri, (int)val);
4707c478bd9Sstevel@tonic-gate
4717c478bd9Sstevel@tonic-gate if (s == NULL)
4727c478bd9Sstevel@tonic-gate prt_oct(pri, 0, val);
4737c478bd9Sstevel@tonic-gate else
4747c478bd9Sstevel@tonic-gate outstring(pri, s);
4757c478bd9Sstevel@tonic-gate }
4767c478bd9Sstevel@tonic-gate
4777c478bd9Sstevel@tonic-gate void
prt_smc(private_t * pri,int raw,long val)4787c478bd9Sstevel@tonic-gate prt_smc(private_t *pri, int raw, long val) /* print semsys command */
4797c478bd9Sstevel@tonic-gate {
4807c478bd9Sstevel@tonic-gate const char *s = raw? NULL : semcmd(val);
4817c478bd9Sstevel@tonic-gate
4827c478bd9Sstevel@tonic-gate if (s == NULL)
4837c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
4847c478bd9Sstevel@tonic-gate else
4857c478bd9Sstevel@tonic-gate outstring(pri, s);
4867c478bd9Sstevel@tonic-gate }
4877c478bd9Sstevel@tonic-gate
4887c478bd9Sstevel@tonic-gate void
prt_sef(private_t * pri,int raw,long val)4897c478bd9Sstevel@tonic-gate prt_sef(private_t *pri, int raw, long val) /* print semsys flags */
4907c478bd9Sstevel@tonic-gate {
4917c478bd9Sstevel@tonic-gate const char *s = raw? NULL : semflags(pri, (int)val);
4927c478bd9Sstevel@tonic-gate
4937c478bd9Sstevel@tonic-gate if (s == NULL)
4947c478bd9Sstevel@tonic-gate prt_oct(pri, 0, val);
4957c478bd9Sstevel@tonic-gate else
4967c478bd9Sstevel@tonic-gate outstring(pri, s);
4977c478bd9Sstevel@tonic-gate }
4987c478bd9Sstevel@tonic-gate
4997c478bd9Sstevel@tonic-gate void
prt_shc(private_t * pri,int raw,long val)5007c478bd9Sstevel@tonic-gate prt_shc(private_t *pri, int raw, long val) /* print shmsys command */
5017c478bd9Sstevel@tonic-gate {
5027c478bd9Sstevel@tonic-gate const char *s = raw? NULL : shmcmd(val);
5037c478bd9Sstevel@tonic-gate
5047c478bd9Sstevel@tonic-gate if (s == NULL)
5057c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
5067c478bd9Sstevel@tonic-gate else
5077c478bd9Sstevel@tonic-gate outstring(pri, s);
5087c478bd9Sstevel@tonic-gate }
5097c478bd9Sstevel@tonic-gate
5107c478bd9Sstevel@tonic-gate void
prt_shf(private_t * pri,int raw,long val)5117c478bd9Sstevel@tonic-gate prt_shf(private_t *pri, int raw, long val) /* print shmsys flags */
5127c478bd9Sstevel@tonic-gate {
5137c478bd9Sstevel@tonic-gate const char *s = raw? NULL : shmflags(pri, (int)val);
5147c478bd9Sstevel@tonic-gate
5157c478bd9Sstevel@tonic-gate if (s == NULL)
5167c478bd9Sstevel@tonic-gate prt_oct(pri, 0, val);
5177c478bd9Sstevel@tonic-gate else
5187c478bd9Sstevel@tonic-gate outstring(pri, s);
5197c478bd9Sstevel@tonic-gate }
5207c478bd9Sstevel@tonic-gate
5217c478bd9Sstevel@tonic-gate void
prt_sfs(private_t * pri,int raw,long val)5227c478bd9Sstevel@tonic-gate prt_sfs(private_t *pri, int raw, long val) /* print sysfs code */
5237c478bd9Sstevel@tonic-gate {
5247c478bd9Sstevel@tonic-gate const char *s = raw? NULL : sfsname(val);
5257c478bd9Sstevel@tonic-gate
5267c478bd9Sstevel@tonic-gate if (s == NULL)
5277c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
5287c478bd9Sstevel@tonic-gate else
5297c478bd9Sstevel@tonic-gate outstring(pri, s);
5307c478bd9Sstevel@tonic-gate }
5317c478bd9Sstevel@tonic-gate
5327c478bd9Sstevel@tonic-gate void
prt_opn(private_t * pri,int raw,long val)5337c478bd9Sstevel@tonic-gate prt_opn(private_t *pri, int raw, long val) /* print open code */
5347c478bd9Sstevel@tonic-gate {
5357c478bd9Sstevel@tonic-gate const char *s = raw? NULL : openarg(pri, val);
5367c478bd9Sstevel@tonic-gate
5377c478bd9Sstevel@tonic-gate if (s == NULL)
5387c478bd9Sstevel@tonic-gate prt_oct(pri, 0, val);
5397c478bd9Sstevel@tonic-gate else
5407c478bd9Sstevel@tonic-gate outstring(pri, s);
5417c478bd9Sstevel@tonic-gate }
5427c478bd9Sstevel@tonic-gate
5437c478bd9Sstevel@tonic-gate void
prt_sig(private_t * pri,int raw,long val)5445403172aSRoger A. Faulkner prt_sig(private_t *pri, int raw, long val) /* print signal name */
5457c478bd9Sstevel@tonic-gate {
5465403172aSRoger A. Faulkner const char *s = raw? NULL : signame(pri, (int)val);
5477c478bd9Sstevel@tonic-gate
5487c478bd9Sstevel@tonic-gate if (s == NULL)
5497c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
5507c478bd9Sstevel@tonic-gate else
5517c478bd9Sstevel@tonic-gate outstring(pri, s);
5527c478bd9Sstevel@tonic-gate }
5537c478bd9Sstevel@tonic-gate
5547c478bd9Sstevel@tonic-gate void
prt_smf(private_t * pri,int raw,long val)5557c478bd9Sstevel@tonic-gate prt_smf(private_t *pri, int raw, long val) /* print streams message flags */
5567c478bd9Sstevel@tonic-gate {
5577c478bd9Sstevel@tonic-gate switch (val) {
5587c478bd9Sstevel@tonic-gate case 0:
5597c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
5607c478bd9Sstevel@tonic-gate break;
5617c478bd9Sstevel@tonic-gate case RS_HIPRI:
5627c478bd9Sstevel@tonic-gate if (raw)
5637c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
5647c478bd9Sstevel@tonic-gate else
5657c478bd9Sstevel@tonic-gate outstring(pri, "RS_HIPRI");
5667c478bd9Sstevel@tonic-gate break;
5677c478bd9Sstevel@tonic-gate default:
5687c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
5697c478bd9Sstevel@tonic-gate break;
5707c478bd9Sstevel@tonic-gate }
5717c478bd9Sstevel@tonic-gate }
5727c478bd9Sstevel@tonic-gate
5737c478bd9Sstevel@tonic-gate void
prt_mtf(private_t * pri,int raw,long val)5747c478bd9Sstevel@tonic-gate prt_mtf(private_t *pri, int raw, long val) /* print mount flags */
5757c478bd9Sstevel@tonic-gate {
5767c478bd9Sstevel@tonic-gate const char *s = raw? NULL : mountflags(pri, val);
5777c478bd9Sstevel@tonic-gate
5787c478bd9Sstevel@tonic-gate if (s == NULL)
5797c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
5807c478bd9Sstevel@tonic-gate else
5817c478bd9Sstevel@tonic-gate outstring(pri, s);
5827c478bd9Sstevel@tonic-gate }
5837c478bd9Sstevel@tonic-gate
5847c478bd9Sstevel@tonic-gate void
prt_mft(private_t * pri,int raw,long val)5857c478bd9Sstevel@tonic-gate prt_mft(private_t *pri, int raw, long val) /* print mount file system type */
5867c478bd9Sstevel@tonic-gate {
5877c478bd9Sstevel@tonic-gate if (val >= 0 && val < 256)
5887c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
5897c478bd9Sstevel@tonic-gate else if (raw)
5907c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
5917c478bd9Sstevel@tonic-gate else
5927c478bd9Sstevel@tonic-gate prt_stg(pri, raw, val);
5937c478bd9Sstevel@tonic-gate }
5947c478bd9Sstevel@tonic-gate
5957c478bd9Sstevel@tonic-gate #define ISREAD(code) \
5967c478bd9Sstevel@tonic-gate ((code) == SYS_read || (code) == SYS_pread || (code) == SYS_pread64 || \
5977c478bd9Sstevel@tonic-gate (code) == SYS_recv || (code) == SYS_recvfrom)
5987c478bd9Sstevel@tonic-gate #define ISWRITE(code) \
5997c478bd9Sstevel@tonic-gate ((code) == SYS_write || (code) == SYS_pwrite || \
6007c478bd9Sstevel@tonic-gate (code) == SYS_pwrite64 || (code) == SYS_send || (code) == SYS_sendto)
6017c478bd9Sstevel@tonic-gate
6027c478bd9Sstevel@tonic-gate /* print contents of read() or write() I/O buffer */
6037c478bd9Sstevel@tonic-gate void
prt_iob(private_t * pri,int raw,long val)6047c478bd9Sstevel@tonic-gate prt_iob(private_t *pri, int raw, long val)
6057c478bd9Sstevel@tonic-gate {
6067c478bd9Sstevel@tonic-gate const lwpstatus_t *Lsp = pri->lwpstat;
6077c478bd9Sstevel@tonic-gate int syscall = Lsp->pr_what;
6087c478bd9Sstevel@tonic-gate int fdp1 = pri->sys_args[0] + 1;
6097c478bd9Sstevel@tonic-gate ssize_t nbyte = ISWRITE(syscall)? pri->sys_args[2] :
610fac3008cSeschrock (pri->Errno? 0 : pri->Rval1);
6117c478bd9Sstevel@tonic-gate int elsewhere = FALSE; /* TRUE iff dumped elsewhere */
6127c478bd9Sstevel@tonic-gate char buffer[IOBSIZE];
6137c478bd9Sstevel@tonic-gate
6147c478bd9Sstevel@tonic-gate pri->iob_buf[0] = '\0';
6157c478bd9Sstevel@tonic-gate
6167c478bd9Sstevel@tonic-gate if (Lsp->pr_why == PR_SYSEXIT && nbyte > IOBSIZE) {
6177c478bd9Sstevel@tonic-gate if (ISREAD(syscall))
6187c478bd9Sstevel@tonic-gate elsewhere = prismember(&readfd, fdp1);
6197c478bd9Sstevel@tonic-gate else
6207c478bd9Sstevel@tonic-gate elsewhere = prismember(&writefd, fdp1);
6217c478bd9Sstevel@tonic-gate }
6227c478bd9Sstevel@tonic-gate
6237c478bd9Sstevel@tonic-gate if (nbyte <= 0 || elsewhere)
6247c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
6257c478bd9Sstevel@tonic-gate else {
6267c478bd9Sstevel@tonic-gate int nb = nbyte > IOBSIZE? IOBSIZE : (int)nbyte;
6277c478bd9Sstevel@tonic-gate
6287c478bd9Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)val) != nb)
6297c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
6307c478bd9Sstevel@tonic-gate else {
6317c478bd9Sstevel@tonic-gate pri->iob_buf[0] = '"';
6327c478bd9Sstevel@tonic-gate showbytes(buffer, nb, pri->iob_buf + 1);
6337c478bd9Sstevel@tonic-gate (void) strlcat(pri->iob_buf,
634fac3008cSeschrock (nb == nbyte)?
635fac3008cSeschrock (const char *)"\"" : (const char *)"\"..",
636fac3008cSeschrock sizeof (pri->iob_buf));
6377c478bd9Sstevel@tonic-gate if (raw)
6387c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
6397c478bd9Sstevel@tonic-gate else
6407c478bd9Sstevel@tonic-gate outstring(pri, pri->iob_buf);
6417c478bd9Sstevel@tonic-gate }
6427c478bd9Sstevel@tonic-gate }
6437c478bd9Sstevel@tonic-gate }
6447c478bd9Sstevel@tonic-gate #undef ISREAD
6457c478bd9Sstevel@tonic-gate #undef ISWRITE
6467c478bd9Sstevel@tonic-gate
6477c478bd9Sstevel@tonic-gate void
prt_idt(private_t * pri,int raw,long val)6487c478bd9Sstevel@tonic-gate prt_idt(private_t *pri, int raw, long val) /* print idtype_t, waitid() arg */
6497c478bd9Sstevel@tonic-gate {
6507c478bd9Sstevel@tonic-gate const char *s = raw? NULL : idtype_enum(pri, val);
6517c478bd9Sstevel@tonic-gate
6527c478bd9Sstevel@tonic-gate if (s == NULL)
6537c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
6547c478bd9Sstevel@tonic-gate else
6557c478bd9Sstevel@tonic-gate outstring(pri, s);
6567c478bd9Sstevel@tonic-gate }
6577c478bd9Sstevel@tonic-gate
6587c478bd9Sstevel@tonic-gate void
prt_wop(private_t * pri,int raw,long val)6597c478bd9Sstevel@tonic-gate prt_wop(private_t *pri, int raw, long val) /* print waitid() options */
6607c478bd9Sstevel@tonic-gate {
6617c478bd9Sstevel@tonic-gate const char *s = raw? NULL : woptions(pri, (int)val);
6627c478bd9Sstevel@tonic-gate
6637c478bd9Sstevel@tonic-gate if (s == NULL)
6647c478bd9Sstevel@tonic-gate prt_oct(pri, 0, val);
6657c478bd9Sstevel@tonic-gate else
6667c478bd9Sstevel@tonic-gate outstring(pri, s);
6677c478bd9Sstevel@tonic-gate }
6687c478bd9Sstevel@tonic-gate
6697c478bd9Sstevel@tonic-gate void
prt_whn(private_t * pri,int raw,long val)6707c478bd9Sstevel@tonic-gate prt_whn(private_t *pri, int raw, long val) /* print lseek() whence argument */
6717c478bd9Sstevel@tonic-gate {
6727c478bd9Sstevel@tonic-gate const char *s = raw? NULL : whencearg(val);
6737c478bd9Sstevel@tonic-gate
6747c478bd9Sstevel@tonic-gate if (s == NULL)
6757c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
6767c478bd9Sstevel@tonic-gate else
6777c478bd9Sstevel@tonic-gate outstring(pri, s);
6787c478bd9Sstevel@tonic-gate }
6797c478bd9Sstevel@tonic-gate
6807c478bd9Sstevel@tonic-gate /*ARGSUSED*/
6817c478bd9Sstevel@tonic-gate void
prt_spm(private_t * pri,int raw,long val)6827c478bd9Sstevel@tonic-gate prt_spm(private_t *pri, int raw, long val) /* print sigprocmask argument */
6837c478bd9Sstevel@tonic-gate {
6847c478bd9Sstevel@tonic-gate const char *s = NULL;
6857c478bd9Sstevel@tonic-gate
6867c478bd9Sstevel@tonic-gate if (!raw) {
6877c478bd9Sstevel@tonic-gate switch (val) {
6887c478bd9Sstevel@tonic-gate case SIG_BLOCK: s = "SIG_BLOCK"; break;
6897c478bd9Sstevel@tonic-gate case SIG_UNBLOCK: s = "SIG_UNBLOCK"; break;
6907c478bd9Sstevel@tonic-gate case SIG_SETMASK: s = "SIG_SETMASK"; break;
6917c478bd9Sstevel@tonic-gate }
6927c478bd9Sstevel@tonic-gate }
6937c478bd9Sstevel@tonic-gate
6947c478bd9Sstevel@tonic-gate if (s == NULL)
6957c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
6967c478bd9Sstevel@tonic-gate else
6977c478bd9Sstevel@tonic-gate outstring(pri, s);
6987c478bd9Sstevel@tonic-gate }
6997c478bd9Sstevel@tonic-gate
7007c478bd9Sstevel@tonic-gate const char *
mmap_protect(private_t * pri,long arg)7017c478bd9Sstevel@tonic-gate mmap_protect(private_t *pri, long arg)
7027c478bd9Sstevel@tonic-gate {
7037c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
7047c478bd9Sstevel@tonic-gate
7057c478bd9Sstevel@tonic-gate if (arg & ~(PROT_READ|PROT_WRITE|PROT_EXEC))
7067c478bd9Sstevel@tonic-gate return ((char *)NULL);
7077c478bd9Sstevel@tonic-gate
7087c478bd9Sstevel@tonic-gate if (arg == PROT_NONE)
7097c478bd9Sstevel@tonic-gate return ("PROT_NONE");
7107c478bd9Sstevel@tonic-gate
7117c478bd9Sstevel@tonic-gate *str = '\0';
7127c478bd9Sstevel@tonic-gate if (arg & PROT_READ)
7137c478bd9Sstevel@tonic-gate (void) strlcat(str, "|PROT_READ", sizeof (pri->code_buf));
7147c478bd9Sstevel@tonic-gate if (arg & PROT_WRITE)
7157c478bd9Sstevel@tonic-gate (void) strlcat(str, "|PROT_WRITE", sizeof (pri->code_buf));
7167c478bd9Sstevel@tonic-gate if (arg & PROT_EXEC)
7177c478bd9Sstevel@tonic-gate (void) strlcat(str, "|PROT_EXEC", sizeof (pri->code_buf));
7187c478bd9Sstevel@tonic-gate return ((const char *)(str + 1));
7197c478bd9Sstevel@tonic-gate }
7207c478bd9Sstevel@tonic-gate
7217c478bd9Sstevel@tonic-gate const char *
mmap_type(private_t * pri,long arg)7227c478bd9Sstevel@tonic-gate mmap_type(private_t *pri, long arg)
7237c478bd9Sstevel@tonic-gate {
7247c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
7257c478bd9Sstevel@tonic-gate size_t used;
7267c478bd9Sstevel@tonic-gate
7277c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
7287c478bd9Sstevel@tonic-gate switch (arg & MAP_TYPE) {
7297c478bd9Sstevel@tonic-gate case MAP_SHARED:
7307c478bd9Sstevel@tonic-gate used = strlcpy(str, "MAP_SHARED", CBSIZE);
7317c478bd9Sstevel@tonic-gate break;
7327c478bd9Sstevel@tonic-gate case MAP_PRIVATE:
7337c478bd9Sstevel@tonic-gate used = strlcpy(str, "MAP_PRIVATE", CBSIZE);
7347c478bd9Sstevel@tonic-gate break;
7357c478bd9Sstevel@tonic-gate default:
7367c478bd9Sstevel@tonic-gate used = snprintf(str, CBSIZE, "%ld", arg&MAP_TYPE);
7377c478bd9Sstevel@tonic-gate break;
7387c478bd9Sstevel@tonic-gate }
7397c478bd9Sstevel@tonic-gate
7407c478bd9Sstevel@tonic-gate arg &= ~(_MAP_NEW|MAP_TYPE);
7417c478bd9Sstevel@tonic-gate
7427c478bd9Sstevel@tonic-gate if (arg & ~(MAP_FIXED|MAP_RENAME|MAP_NORESERVE|MAP_ANON|MAP_ALIGN|
7431b3b16f3STheo Schlossnagle MAP_TEXT|MAP_INITDATA|MAP_32BIT))
7447c478bd9Sstevel@tonic-gate (void) snprintf(str + used, sizeof (pri->code_buf) - used,
745fac3008cSeschrock "|0x%lX", arg);
7467c478bd9Sstevel@tonic-gate else {
7477c478bd9Sstevel@tonic-gate if (arg & MAP_FIXED)
7487c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_FIXED", CBSIZE);
7497c478bd9Sstevel@tonic-gate if (arg & MAP_RENAME)
7507c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_RENAME", CBSIZE);
7517c478bd9Sstevel@tonic-gate if (arg & MAP_NORESERVE)
7527c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_NORESERVE", CBSIZE);
7537c478bd9Sstevel@tonic-gate if (arg & MAP_ANON)
7547c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_ANON", CBSIZE);
7557c478bd9Sstevel@tonic-gate if (arg & MAP_ALIGN)
7567c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_ALIGN", CBSIZE);
7577c478bd9Sstevel@tonic-gate if (arg & MAP_TEXT)
7587c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_TEXT", CBSIZE);
7597c478bd9Sstevel@tonic-gate if (arg & MAP_INITDATA)
7607c478bd9Sstevel@tonic-gate (void) strlcat(str, "|MAP_INITDATA", CBSIZE);
7611b3b16f3STheo Schlossnagle if (arg & MAP_32BIT)
7621b3b16f3STheo Schlossnagle (void) strlcat(str, "|MAP_32BIT", CBSIZE);
7637c478bd9Sstevel@tonic-gate }
7647c478bd9Sstevel@tonic-gate
7657c478bd9Sstevel@tonic-gate return ((const char *)str);
7667c478bd9Sstevel@tonic-gate #undef CBSIZE
7677c478bd9Sstevel@tonic-gate }
7687c478bd9Sstevel@tonic-gate
7697c478bd9Sstevel@tonic-gate void
prt_mpr(private_t * pri,int raw,long val)7707c478bd9Sstevel@tonic-gate prt_mpr(private_t *pri, int raw, long val) /* print mmap()/mprotect() flags */
7717c478bd9Sstevel@tonic-gate {
7727c478bd9Sstevel@tonic-gate const char *s = raw? NULL : mmap_protect(pri, val);
7737c478bd9Sstevel@tonic-gate
7747c478bd9Sstevel@tonic-gate if (s == NULL)
7757c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
7767c478bd9Sstevel@tonic-gate else
7777c478bd9Sstevel@tonic-gate outstring(pri, s);
7787c478bd9Sstevel@tonic-gate }
7797c478bd9Sstevel@tonic-gate
7807c478bd9Sstevel@tonic-gate void
prt_mty(private_t * pri,int raw,long val)7817c478bd9Sstevel@tonic-gate prt_mty(private_t *pri, int raw, long val) /* print mmap() mapping type flags */
7827c478bd9Sstevel@tonic-gate {
7837c478bd9Sstevel@tonic-gate const char *s = raw? NULL : mmap_type(pri, val);
7847c478bd9Sstevel@tonic-gate
7857c478bd9Sstevel@tonic-gate if (s == NULL)
7867c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
7877c478bd9Sstevel@tonic-gate else
7887c478bd9Sstevel@tonic-gate outstring(pri, s);
7897c478bd9Sstevel@tonic-gate }
7907c478bd9Sstevel@tonic-gate
791bcddb677SAli Bahrami void
prt_mob(private_t * pri,int raw,long val)792bcddb677SAli Bahrami prt_mob(private_t *pri, int raw, long val) /* print mmapobj() flags */
793bcddb677SAli Bahrami {
794bcddb677SAli Bahrami if (val == 0)
795bcddb677SAli Bahrami prt_dec(pri, 0, val);
796bcddb677SAli Bahrami else if (raw || (val & ~(MMOBJ_PADDING|MMOBJ_INTERPRET)) != 0)
797bcddb677SAli Bahrami prt_hhx(pri, 0, val);
798bcddb677SAli Bahrami else {
799bcddb677SAli Bahrami #define CBSIZE sizeof (pri->code_buf)
800bcddb677SAli Bahrami char *s = pri->code_buf;
801bcddb677SAli Bahrami
802bcddb677SAli Bahrami *s = '\0';
803bcddb677SAli Bahrami if (val & MMOBJ_PADDING)
804bcddb677SAli Bahrami (void) strlcat(s, "|MMOBJ_PADDING", CBSIZE);
805bcddb677SAli Bahrami if (val & MMOBJ_INTERPRET)
806bcddb677SAli Bahrami (void) strlcat(s, "|MMOBJ_INTERPRET", CBSIZE);
807bcddb677SAli Bahrami outstring(pri, s + 1);
808bcddb677SAli Bahrami #undef CBSIZE
809bcddb677SAli Bahrami }
810bcddb677SAli Bahrami }
811bcddb677SAli Bahrami
8127c478bd9Sstevel@tonic-gate /*ARGSUSED*/
8137c478bd9Sstevel@tonic-gate void
prt_mcf(private_t * pri,int raw,long val)8147c478bd9Sstevel@tonic-gate prt_mcf(private_t *pri, int raw, long val) /* print memcntl() function */
8157c478bd9Sstevel@tonic-gate {
8167c478bd9Sstevel@tonic-gate const char *s = NULL;
8177c478bd9Sstevel@tonic-gate
8187c478bd9Sstevel@tonic-gate if (!raw) {
8197c478bd9Sstevel@tonic-gate switch (val) {
8207c478bd9Sstevel@tonic-gate case MC_SYNC: s = "MC_SYNC"; break;
8217c478bd9Sstevel@tonic-gate case MC_LOCK: s = "MC_LOCK"; break;
8227c478bd9Sstevel@tonic-gate case MC_UNLOCK: s = "MC_UNLOCK"; break;
8237c478bd9Sstevel@tonic-gate case MC_ADVISE: s = "MC_ADVISE"; break;
8247c478bd9Sstevel@tonic-gate case MC_LOCKAS: s = "MC_LOCKAS"; break;
8257c478bd9Sstevel@tonic-gate case MC_UNLOCKAS: s = "MC_UNLOCKAS"; break;
8267c478bd9Sstevel@tonic-gate case MC_HAT_ADVISE: s = "MC_HAT_ADVISE"; break;
8277c478bd9Sstevel@tonic-gate }
8287c478bd9Sstevel@tonic-gate }
8297c478bd9Sstevel@tonic-gate
8307c478bd9Sstevel@tonic-gate if (s == NULL)
8317c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
8327c478bd9Sstevel@tonic-gate else
8337c478bd9Sstevel@tonic-gate outstring(pri, s);
8347c478bd9Sstevel@tonic-gate }
8357c478bd9Sstevel@tonic-gate
8367c478bd9Sstevel@tonic-gate void
prt_mad(private_t * pri,int raw,long val)8377c478bd9Sstevel@tonic-gate prt_mad(private_t *pri, int raw, long val) /* print madvise() argument */
8387c478bd9Sstevel@tonic-gate {
8397c478bd9Sstevel@tonic-gate const char *s = NULL;
8407c478bd9Sstevel@tonic-gate
8417c478bd9Sstevel@tonic-gate if (!raw) {
8427c478bd9Sstevel@tonic-gate switch (val) {
8437c478bd9Sstevel@tonic-gate case MADV_NORMAL: s = "MADV_NORMAL"; break;
8447c478bd9Sstevel@tonic-gate case MADV_RANDOM: s = "MADV_RANDOM"; break;
8457c478bd9Sstevel@tonic-gate case MADV_SEQUENTIAL: s = "MADV_SEQUENTIAL"; break;
8467c478bd9Sstevel@tonic-gate case MADV_WILLNEED: s = "MADV_WILLNEED"; break;
8477c478bd9Sstevel@tonic-gate case MADV_DONTNEED: s = "MADV_DONTNEED"; break;
8487c478bd9Sstevel@tonic-gate case MADV_FREE: s = "MADV_FREE"; break;
8497c478bd9Sstevel@tonic-gate case MADV_ACCESS_DEFAULT: s = "MADV_ACCESS_DEFAULT"; break;
8507c478bd9Sstevel@tonic-gate case MADV_ACCESS_LWP: s = "MADV_ACCESS_LWP"; break;
8517c478bd9Sstevel@tonic-gate case MADV_ACCESS_MANY: s = "MADV_ACCESS_MANY"; break;
8528905f42cSBryan Cantrill case MADV_PURGE: s = "MADV_PURGE"; break;
8537c478bd9Sstevel@tonic-gate }
8547c478bd9Sstevel@tonic-gate }
8557c478bd9Sstevel@tonic-gate
8567c478bd9Sstevel@tonic-gate if (s == NULL)
8577c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
8587c478bd9Sstevel@tonic-gate else
8597c478bd9Sstevel@tonic-gate outstring(pri, s);
8607c478bd9Sstevel@tonic-gate }
8617c478bd9Sstevel@tonic-gate
8627c478bd9Sstevel@tonic-gate void
prt_mc4(private_t * pri,int raw,long val)8637c478bd9Sstevel@tonic-gate prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
8647c478bd9Sstevel@tonic-gate {
8657c478bd9Sstevel@tonic-gate if (val == 0)
8667c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
8677c478bd9Sstevel@tonic-gate else if (raw)
8687c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
8697c478bd9Sstevel@tonic-gate else {
8707c478bd9Sstevel@tonic-gate char *s = NULL;
8717c478bd9Sstevel@tonic-gate
8727c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
8737c478bd9Sstevel@tonic-gate /* cheating -- look at memcntl func */
8747c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) {
8757c478bd9Sstevel@tonic-gate case MC_ADVISE:
8767c478bd9Sstevel@tonic-gate prt_mad(pri, 0, val);
8777c478bd9Sstevel@tonic-gate return;
8787c478bd9Sstevel@tonic-gate
8797c478bd9Sstevel@tonic-gate case MC_SYNC:
8807c478bd9Sstevel@tonic-gate if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) {
8817c478bd9Sstevel@tonic-gate *(s = pri->code_buf) = '\0';
8827c478bd9Sstevel@tonic-gate if (val & MS_SYNC)
8837c478bd9Sstevel@tonic-gate (void) strlcat(s, "|MS_SYNC", CBSIZE);
8847c478bd9Sstevel@tonic-gate if (val & MS_ASYNC)
8857c478bd9Sstevel@tonic-gate (void) strlcat(s, "|MS_ASYNC", CBSIZE);
8867c478bd9Sstevel@tonic-gate if (val & MS_INVALIDATE)
8877c478bd9Sstevel@tonic-gate (void) strlcat(s, "|MS_INVALIDATE",
888fac3008cSeschrock CBSIZE);
8897c478bd9Sstevel@tonic-gate }
8907c478bd9Sstevel@tonic-gate break;
8917c478bd9Sstevel@tonic-gate
8927c478bd9Sstevel@tonic-gate case MC_LOCKAS:
8937c478bd9Sstevel@tonic-gate case MC_UNLOCKAS:
8947c478bd9Sstevel@tonic-gate if ((val & ~(MCL_CURRENT|MCL_FUTURE)) == 0) {
8957c478bd9Sstevel@tonic-gate *(s = pri->code_buf) = '\0';
8967c478bd9Sstevel@tonic-gate if (val & MCL_CURRENT)
8977c478bd9Sstevel@tonic-gate (void) strlcat(s, "|MCL_CURRENT",
898fac3008cSeschrock CBSIZE);
8997c478bd9Sstevel@tonic-gate if (val & MCL_FUTURE)
9007c478bd9Sstevel@tonic-gate (void) strlcat(s, "|MCL_FUTURE",
901fac3008cSeschrock CBSIZE);
9027c478bd9Sstevel@tonic-gate }
9037c478bd9Sstevel@tonic-gate break;
9047c478bd9Sstevel@tonic-gate }
9057c478bd9Sstevel@tonic-gate #undef CBSIZE
9067c478bd9Sstevel@tonic-gate
9077c478bd9Sstevel@tonic-gate if (s == NULL || *s == '\0')
9087c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
9097c478bd9Sstevel@tonic-gate else
9107c478bd9Sstevel@tonic-gate outstring(pri, ++s);
9117c478bd9Sstevel@tonic-gate }
9127c478bd9Sstevel@tonic-gate }
9137c478bd9Sstevel@tonic-gate
9147c478bd9Sstevel@tonic-gate void
prt_mc5(private_t * pri,int raw,long val)9157c478bd9Sstevel@tonic-gate prt_mc5(private_t *pri, int raw, long val) /* print memcntl() (5th) argument */
9167c478bd9Sstevel@tonic-gate {
9177c478bd9Sstevel@tonic-gate char *s;
9187c478bd9Sstevel@tonic-gate
9197c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
9207c478bd9Sstevel@tonic-gate if (val == 0)
9217c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
9227c478bd9Sstevel@tonic-gate else if (raw || (val & ~VALID_ATTR))
9237c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
9247c478bd9Sstevel@tonic-gate else {
9257c478bd9Sstevel@tonic-gate s = pri->code_buf;
9267c478bd9Sstevel@tonic-gate *s = '\0';
9277c478bd9Sstevel@tonic-gate if (val & SHARED)
9287c478bd9Sstevel@tonic-gate (void) strlcat(s, "|SHARED", CBSIZE);
9297c478bd9Sstevel@tonic-gate if (val & PRIVATE)
9307c478bd9Sstevel@tonic-gate (void) strlcat(s, "|PRIVATE", CBSIZE);
9317c478bd9Sstevel@tonic-gate if (val & PROT_READ)
9327c478bd9Sstevel@tonic-gate (void) strlcat(s, "|PROT_READ", CBSIZE);
9337c478bd9Sstevel@tonic-gate if (val & PROT_WRITE)
9347c478bd9Sstevel@tonic-gate (void) strlcat(s, "|PROT_WRITE", CBSIZE);
9357c478bd9Sstevel@tonic-gate if (val & PROT_EXEC)
9367c478bd9Sstevel@tonic-gate (void) strlcat(s, "|PROT_EXEC", CBSIZE);
9377c478bd9Sstevel@tonic-gate if (*s == '\0')
9387c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
9397c478bd9Sstevel@tonic-gate else
9407c478bd9Sstevel@tonic-gate outstring(pri, ++s);
9417c478bd9Sstevel@tonic-gate }
9427c478bd9Sstevel@tonic-gate #undef CBSIZE
9437c478bd9Sstevel@tonic-gate }
9447c478bd9Sstevel@tonic-gate
9457c478bd9Sstevel@tonic-gate void
prt_ulm(private_t * pri,int raw,long val)9467c478bd9Sstevel@tonic-gate prt_ulm(private_t *pri, int raw, long val) /* print ulimit() argument */
9477c478bd9Sstevel@tonic-gate {
9487c478bd9Sstevel@tonic-gate const char *s = NULL;
9497c478bd9Sstevel@tonic-gate
9507c478bd9Sstevel@tonic-gate if (!raw) {
9517c478bd9Sstevel@tonic-gate switch (val) {
9527c478bd9Sstevel@tonic-gate case UL_GFILLIM: s = "UL_GFILLIM"; break;
9537c478bd9Sstevel@tonic-gate case UL_SFILLIM: s = "UL_SFILLIM"; break;
9547c478bd9Sstevel@tonic-gate case UL_GMEMLIM: s = "UL_GMEMLIM"; break;
9557c478bd9Sstevel@tonic-gate case UL_GDESLIM: s = "UL_GDESLIM"; break;
9567c478bd9Sstevel@tonic-gate }
9577c478bd9Sstevel@tonic-gate }
9587c478bd9Sstevel@tonic-gate
9597c478bd9Sstevel@tonic-gate if (s == NULL)
9607c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
9617c478bd9Sstevel@tonic-gate else
9627c478bd9Sstevel@tonic-gate outstring(pri, s);
9637c478bd9Sstevel@tonic-gate }
9647c478bd9Sstevel@tonic-gate
9657c478bd9Sstevel@tonic-gate void
prt_rlm(private_t * pri,int raw,long val)9667c478bd9Sstevel@tonic-gate prt_rlm(private_t *pri, int raw, long val) /* print get/setrlimit() argument */
9677c478bd9Sstevel@tonic-gate {
9687c478bd9Sstevel@tonic-gate const char *s = NULL;
9697c478bd9Sstevel@tonic-gate
9707c478bd9Sstevel@tonic-gate if (!raw) {
9717c478bd9Sstevel@tonic-gate switch (val) {
9727c478bd9Sstevel@tonic-gate case RLIMIT_CPU: s = "RLIMIT_CPU"; break;
9737c478bd9Sstevel@tonic-gate case RLIMIT_FSIZE: s = "RLIMIT_FSIZE"; break;
9747c478bd9Sstevel@tonic-gate case RLIMIT_DATA: s = "RLIMIT_DATA"; break;
9757c478bd9Sstevel@tonic-gate case RLIMIT_STACK: s = "RLIMIT_STACK"; break;
9767c478bd9Sstevel@tonic-gate case RLIMIT_CORE: s = "RLIMIT_CORE"; break;
9777c478bd9Sstevel@tonic-gate case RLIMIT_NOFILE: s = "RLIMIT_NOFILE"; break;
9787c478bd9Sstevel@tonic-gate case RLIMIT_VMEM: s = "RLIMIT_VMEM"; break;
9797c478bd9Sstevel@tonic-gate }
9807c478bd9Sstevel@tonic-gate }
9817c478bd9Sstevel@tonic-gate
9827c478bd9Sstevel@tonic-gate if (s == NULL)
9837c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
9847c478bd9Sstevel@tonic-gate else
9857c478bd9Sstevel@tonic-gate outstring(pri, s);
9867c478bd9Sstevel@tonic-gate }
9877c478bd9Sstevel@tonic-gate
9887c478bd9Sstevel@tonic-gate void
prt_cnf(private_t * pri,int raw,long val)9897c478bd9Sstevel@tonic-gate prt_cnf(private_t *pri, int raw, long val) /* print sysconfig code */
9907c478bd9Sstevel@tonic-gate {
9917c478bd9Sstevel@tonic-gate const char *s = raw? NULL : sconfname(val);
9927c478bd9Sstevel@tonic-gate
9937c478bd9Sstevel@tonic-gate if (s == NULL)
9947c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
9957c478bd9Sstevel@tonic-gate else
9967c478bd9Sstevel@tonic-gate outstring(pri, s);
9977c478bd9Sstevel@tonic-gate }
9987c478bd9Sstevel@tonic-gate
9997c478bd9Sstevel@tonic-gate void
prt_inf(private_t * pri,int raw,long val)10007c478bd9Sstevel@tonic-gate prt_inf(private_t *pri, int raw, long val) /* print sysinfo code */
10017c478bd9Sstevel@tonic-gate {
10027c478bd9Sstevel@tonic-gate const char *s = NULL;
10037c478bd9Sstevel@tonic-gate
10047c478bd9Sstevel@tonic-gate if (!raw) {
10057c478bd9Sstevel@tonic-gate switch (val) {
10067c478bd9Sstevel@tonic-gate case SI_SYSNAME: s = "SI_SYSNAME"; break;
10077c478bd9Sstevel@tonic-gate case SI_HOSTNAME: s = "SI_HOSTNAME"; break;
10087c478bd9Sstevel@tonic-gate case SI_RELEASE: s = "SI_RELEASE"; break;
10097c478bd9Sstevel@tonic-gate case SI_VERSION: s = "SI_VERSION"; break;
10107c478bd9Sstevel@tonic-gate case SI_MACHINE: s = "SI_MACHINE"; break;
10117c478bd9Sstevel@tonic-gate case SI_ARCHITECTURE: s = "SI_ARCHITECTURE"; break;
10127c478bd9Sstevel@tonic-gate case SI_ARCHITECTURE_32:s = "SI_ARCHITECTURE_32"; break;
10137c478bd9Sstevel@tonic-gate case SI_ARCHITECTURE_64:s = "SI_ARCHITECTURE_64"; break;
10147c478bd9Sstevel@tonic-gate case SI_ARCHITECTURE_K: s = "SI_ARCHITECTURE_K"; break;
10157c478bd9Sstevel@tonic-gate case SI_HW_SERIAL: s = "SI_HW_SERIAL"; break;
10167c478bd9Sstevel@tonic-gate case SI_HW_PROVIDER: s = "SI_HW_PROVIDER"; break;
10177c478bd9Sstevel@tonic-gate case SI_SRPC_DOMAIN: s = "SI_SRPC_DOMAIN"; break;
10187c478bd9Sstevel@tonic-gate case SI_SET_HOSTNAME: s = "SI_SET_HOSTNAME"; break;
10197c478bd9Sstevel@tonic-gate case SI_SET_SRPC_DOMAIN: s = "SI_SET_SRPC_DOMAIN"; break;
10207c478bd9Sstevel@tonic-gate case SI_PLATFORM: s = "SI_PLATFORM"; break;
10217c478bd9Sstevel@tonic-gate case SI_ISALIST: s = "SI_ISALIST"; break;
10227c478bd9Sstevel@tonic-gate case SI_DHCP_CACHE: s = "SI_DHCP_CACHE"; break;
10237c478bd9Sstevel@tonic-gate }
10247c478bd9Sstevel@tonic-gate }
10257c478bd9Sstevel@tonic-gate
10267c478bd9Sstevel@tonic-gate if (s == NULL)
10277c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
10287c478bd9Sstevel@tonic-gate else
10297c478bd9Sstevel@tonic-gate outstring(pri, s);
10307c478bd9Sstevel@tonic-gate }
10317c478bd9Sstevel@tonic-gate
10327c478bd9Sstevel@tonic-gate void
prt_ptc(private_t * pri,int raw,long val)10337c478bd9Sstevel@tonic-gate prt_ptc(private_t *pri, int raw, long val) /* print pathconf code */
10347c478bd9Sstevel@tonic-gate {
10357c478bd9Sstevel@tonic-gate const char *s = raw? NULL : pathconfname(val);
10367c478bd9Sstevel@tonic-gate
10377c478bd9Sstevel@tonic-gate if (s == NULL)
10387c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
10397c478bd9Sstevel@tonic-gate else
10407c478bd9Sstevel@tonic-gate outstring(pri, s);
10417c478bd9Sstevel@tonic-gate }
10427c478bd9Sstevel@tonic-gate
10437c478bd9Sstevel@tonic-gate void
prt_fui(private_t * pri,int raw,long val)10447c478bd9Sstevel@tonic-gate prt_fui(private_t *pri, int raw, long val) /* print fusers() input argument */
10457c478bd9Sstevel@tonic-gate {
10467c478bd9Sstevel@tonic-gate const char *s = raw? NULL : fuiname(val);
10477c478bd9Sstevel@tonic-gate
10487c478bd9Sstevel@tonic-gate if (s == NULL)
10497c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
10507c478bd9Sstevel@tonic-gate else
10517c478bd9Sstevel@tonic-gate outstring(pri, s);
10527c478bd9Sstevel@tonic-gate }
10537c478bd9Sstevel@tonic-gate
10547c478bd9Sstevel@tonic-gate void
prt_lwf(private_t * pri,int raw,long val)10557c478bd9Sstevel@tonic-gate prt_lwf(private_t *pri, int raw, long val) /* print lwp_create() flags */
10567c478bd9Sstevel@tonic-gate {
10577c478bd9Sstevel@tonic-gate char *s;
10587c478bd9Sstevel@tonic-gate
10597c478bd9Sstevel@tonic-gate if (val == 0)
10607c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
10617c478bd9Sstevel@tonic-gate else if (raw ||
10627c478bd9Sstevel@tonic-gate (val & ~(LWP_DAEMON|LWP_DETACHED|LWP_SUSPENDED)))
10637c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
10647c478bd9Sstevel@tonic-gate else {
10657c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
10667c478bd9Sstevel@tonic-gate s = pri->code_buf;
10677c478bd9Sstevel@tonic-gate *s = '\0';
10687c478bd9Sstevel@tonic-gate if (val & LWP_DAEMON)
10697c478bd9Sstevel@tonic-gate (void) strlcat(s, "|LWP_DAEMON", CBSIZE);
10707c478bd9Sstevel@tonic-gate if (val & LWP_DETACHED)
10717c478bd9Sstevel@tonic-gate (void) strlcat(s, "|LWP_DETACHED", CBSIZE);
10727c478bd9Sstevel@tonic-gate if (val & LWP_SUSPENDED)
10737c478bd9Sstevel@tonic-gate (void) strlcat(s, "|LWP_SUSPENDED", CBSIZE);
10747c478bd9Sstevel@tonic-gate outstring(pri, ++s);
10757c478bd9Sstevel@tonic-gate #undef CBSIZE
10767c478bd9Sstevel@tonic-gate }
10777c478bd9Sstevel@tonic-gate }
10787c478bd9Sstevel@tonic-gate
10797c478bd9Sstevel@tonic-gate void
prt_itm(private_t * pri,int raw,long val)10807c478bd9Sstevel@tonic-gate prt_itm(private_t *pri, int raw, long val) /* print [get|set]itimer() arg */
10817c478bd9Sstevel@tonic-gate {
10827c478bd9Sstevel@tonic-gate const char *s = NULL;
10837c478bd9Sstevel@tonic-gate
10847c478bd9Sstevel@tonic-gate if (!raw) {
10857c478bd9Sstevel@tonic-gate switch (val) {
10867c478bd9Sstevel@tonic-gate case ITIMER_REAL: s = "ITIMER_REAL"; break;
10877c478bd9Sstevel@tonic-gate case ITIMER_VIRTUAL: s = "ITIMER_VIRTUAL"; break;
10887c478bd9Sstevel@tonic-gate case ITIMER_PROF: s = "ITIMER_PROF"; break;
10897c478bd9Sstevel@tonic-gate #ifdef ITIMER_REALPROF
10907c478bd9Sstevel@tonic-gate case ITIMER_REALPROF: s = "ITIMER_REALPROF"; break;
10917c478bd9Sstevel@tonic-gate #endif
10927c478bd9Sstevel@tonic-gate }
10937c478bd9Sstevel@tonic-gate }
10947c478bd9Sstevel@tonic-gate
10957c478bd9Sstevel@tonic-gate if (s == NULL)
10967c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
10977c478bd9Sstevel@tonic-gate else
10987c478bd9Sstevel@tonic-gate outstring(pri, s);
10997c478bd9Sstevel@tonic-gate }
11007c478bd9Sstevel@tonic-gate
11017c478bd9Sstevel@tonic-gate void
prt_mod(private_t * pri,int raw,long val)11027c478bd9Sstevel@tonic-gate prt_mod(private_t *pri, int raw, long val) /* print modctl() code */
11037c478bd9Sstevel@tonic-gate {
11047c478bd9Sstevel@tonic-gate const char *s = NULL;
11057c478bd9Sstevel@tonic-gate
11067c478bd9Sstevel@tonic-gate if (!raw) {
11077c478bd9Sstevel@tonic-gate switch (val) {
11087c478bd9Sstevel@tonic-gate case MODLOAD: s = "MODLOAD"; break;
11097c478bd9Sstevel@tonic-gate case MODUNLOAD: s = "MODUNLOAD"; break;
11107c478bd9Sstevel@tonic-gate case MODINFO: s = "MODINFO"; break;
11117c478bd9Sstevel@tonic-gate case MODRESERVED: s = "MODRESERVED"; break;
11127c478bd9Sstevel@tonic-gate case MODSETMINIROOT: s = "MODSETMINIROOT"; break;
11137c478bd9Sstevel@tonic-gate case MODADDMAJBIND: s = "MODADDMAJBIND"; break;
11147c478bd9Sstevel@tonic-gate case MODGETPATH: s = "MODGETPATH"; break;
11157c478bd9Sstevel@tonic-gate case MODGETPATHLEN: s = "MODGETPATHLEN"; break;
11167c478bd9Sstevel@tonic-gate case MODREADSYSBIND: s = "MODREADSYSBIND"; break;
11177c478bd9Sstevel@tonic-gate case MODGETMAJBIND: s = "MODGETMAJBIND"; break;
11187c478bd9Sstevel@tonic-gate case MODGETNAME: s = "MODGETNAME"; break;
11197c478bd9Sstevel@tonic-gate case MODSIZEOF_DEVID: s = "MODSIZEOF_DEVID"; break;
11207c478bd9Sstevel@tonic-gate case MODGETDEVID: s = "MODGETDEVID"; break;
11217c478bd9Sstevel@tonic-gate case MODSIZEOF_MINORNAME: s = "MODSIZEOF_MINORNAME"; break;
11227c478bd9Sstevel@tonic-gate case MODGETMINORNAME: s = "MODGETMINORNAME"; break;
11237c478bd9Sstevel@tonic-gate case MODGETFBNAME: s = "MODGETFBNAME"; break;
11247c478bd9Sstevel@tonic-gate case MODEVENTS: s = "MODEVENTS"; break;
11257c478bd9Sstevel@tonic-gate case MODREREADDACF: s = "MODREREADDACF"; break;
11267c478bd9Sstevel@tonic-gate case MODLOADDRVCONF: s = "MODLOADDRVCONF"; break;
11277c478bd9Sstevel@tonic-gate case MODUNLOADDRVCONF: s = "MODUNLOADDRVCONF"; break;
11287c478bd9Sstevel@tonic-gate case MODREMMAJBIND: s = "MODREMMAJBIND"; break;
11297c478bd9Sstevel@tonic-gate case MODDEVT2INSTANCE: s = "MODDEVT2INSTANCE"; break;
11307c478bd9Sstevel@tonic-gate case MODGETDEVFSPATH_LEN: s = "MODGETDEVFSPATH_LEN"; break;
11317c478bd9Sstevel@tonic-gate case MODGETDEVFSPATH: s = "MODGETDEVFSPATH"; break;
11327c478bd9Sstevel@tonic-gate case MODDEVID2PATHS: s = "MODDEVID2PATHS"; break;
11337c478bd9Sstevel@tonic-gate case MODSETDEVPOLICY: s = "MODSETDEVPOLICY"; break;
11347c478bd9Sstevel@tonic-gate case MODGETDEVPOLICY: s = "MODGETDEVPOLICY"; break;
11357c478bd9Sstevel@tonic-gate case MODALLOCPRIV: s = "MODALLOCPRIV"; break;
11367c478bd9Sstevel@tonic-gate case MODGETDEVPOLICYBYNAME:
11377c478bd9Sstevel@tonic-gate s = "MODGETDEVPOLICYBYNAME"; break;
11387c478bd9Sstevel@tonic-gate case MODLOADMINORPERM: s = "MODLOADMINORPERM"; break;
11397c478bd9Sstevel@tonic-gate case MODADDMINORPERM: s = "MODADDMINORPERM"; break;
11407c478bd9Sstevel@tonic-gate case MODREMMINORPERM: s = "MODREMMINORPERM"; break;
11417c478bd9Sstevel@tonic-gate case MODREMDRVCLEANUP: s = "MODREMDRVCLEANUP"; break;
1142facf4a8dSllai case MODDEVEXISTS: s = "MODDEVEXISTS"; break;
1143facf4a8dSllai case MODDEVREADDIR: s = "MODDEVREADDIR"; break;
1144e37c6c37Scth case MODDEVEMPTYDIR: s = "MODDEVEMPTYDIR"; break;
1145facf4a8dSllai case MODDEVNAME: s = "MODDEVNAME"; break;
1146a08731ecScth case MODGETDEVFSPATH_MI_LEN:
1147a08731ecScth s = "MODGETDEVFSPATH_MI_LEN"; break;
1148a08731ecScth case MODGETDEVFSPATH_MI:
1149a08731ecScth s = "MODGETDEVFSPATH_MI"; break;
11506532b960SJerry Gilliam case MODREMDRVALIAS: s = "MODREMDRVALIAS"; break;
115126947304SEvan Yan case MODHPOPS: s = "MODHPOPS"; break;
11527c478bd9Sstevel@tonic-gate }
11537c478bd9Sstevel@tonic-gate }
11547c478bd9Sstevel@tonic-gate
11557c478bd9Sstevel@tonic-gate if (s == NULL)
11567c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
11577c478bd9Sstevel@tonic-gate else
11587c478bd9Sstevel@tonic-gate outstring(pri, s);
11597c478bd9Sstevel@tonic-gate }
11607c478bd9Sstevel@tonic-gate
11617c478bd9Sstevel@tonic-gate void
prt_acl(private_t * pri,int raw,long val)11627c478bd9Sstevel@tonic-gate prt_acl(private_t *pri, int raw, long val) /* print acl() code */
11637c478bd9Sstevel@tonic-gate {
11647c478bd9Sstevel@tonic-gate const char *s = NULL;
11657c478bd9Sstevel@tonic-gate
11667c478bd9Sstevel@tonic-gate if (!raw) {
11677c478bd9Sstevel@tonic-gate switch (val) {
11687c478bd9Sstevel@tonic-gate case GETACL: s = "GETACL"; break;
11697c478bd9Sstevel@tonic-gate case SETACL: s = "SETACL"; break;
11707c478bd9Sstevel@tonic-gate case GETACLCNT: s = "GETACLCNT"; break;
1171fa9e4066Sahrens case ACE_GETACL: s = "ACE_GETACL"; break;
1172fa9e4066Sahrens case ACE_SETACL: s = "ACE_SETACL"; break;
1173fa9e4066Sahrens case ACE_GETACLCNT: s = "ACE_GETACLCNT"; break;
11747c478bd9Sstevel@tonic-gate }
11757c478bd9Sstevel@tonic-gate }
11767c478bd9Sstevel@tonic-gate
11777c478bd9Sstevel@tonic-gate if (s == NULL)
11787c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
11797c478bd9Sstevel@tonic-gate else
11807c478bd9Sstevel@tonic-gate outstring(pri, s);
11817c478bd9Sstevel@tonic-gate }
11827c478bd9Sstevel@tonic-gate
11837c478bd9Sstevel@tonic-gate void
prt_aio(private_t * pri,int raw,long val)11847c478bd9Sstevel@tonic-gate prt_aio(private_t *pri, int raw, long val) /* print kaio() code */
11857c478bd9Sstevel@tonic-gate {
11867c478bd9Sstevel@tonic-gate const char *s = NULL;
11877c478bd9Sstevel@tonic-gate char buf[32];
11887c478bd9Sstevel@tonic-gate
11897c478bd9Sstevel@tonic-gate if (!raw) {
11907c478bd9Sstevel@tonic-gate switch (val & ~AIO_POLL_BIT) {
11917c478bd9Sstevel@tonic-gate case AIOREAD: s = "AIOREAD"; break;
11927c478bd9Sstevel@tonic-gate case AIOWRITE: s = "AIOWRITE"; break;
11937c478bd9Sstevel@tonic-gate case AIOWAIT: s = "AIOWAIT"; break;
11947c478bd9Sstevel@tonic-gate case AIOCANCEL: s = "AIOCANCEL"; break;
11957c478bd9Sstevel@tonic-gate case AIONOTIFY: s = "AIONOTIFY"; break;
11967c478bd9Sstevel@tonic-gate case AIOINIT: s = "AIOINIT"; break;
11977c478bd9Sstevel@tonic-gate case AIOSTART: s = "AIOSTART"; break;
11987c478bd9Sstevel@tonic-gate case AIOLIO: s = "AIOLIO"; break;
11997c478bd9Sstevel@tonic-gate case AIOSUSPEND: s = "AIOSUSPEND"; break;
12007c478bd9Sstevel@tonic-gate case AIOERROR: s = "AIOERROR"; break;
12017c478bd9Sstevel@tonic-gate case AIOLIOWAIT: s = "AIOLIOWAIT"; break;
12027c478bd9Sstevel@tonic-gate case AIOAREAD: s = "AIOAREAD"; break;
12037c478bd9Sstevel@tonic-gate case AIOAWRITE: s = "AIOAWRITE"; break;
12047c478bd9Sstevel@tonic-gate /*
12057c478bd9Sstevel@tonic-gate * We have to hardcode the values for the 64-bit versions of
12067c478bd9Sstevel@tonic-gate * these calls, because <sys/aio.h> defines them to be identical
12077c478bd9Sstevel@tonic-gate * when compiled 64-bit. If our target is 32-bit, we still need
12087c478bd9Sstevel@tonic-gate * to decode them correctly.
12097c478bd9Sstevel@tonic-gate */
12107c478bd9Sstevel@tonic-gate case 13: s = "AIOLIO64"; break;
12117c478bd9Sstevel@tonic-gate case 14: s = "AIOSUSPEND64"; break;
12127c478bd9Sstevel@tonic-gate case 15: s = "AUIOERROR64"; break;
12137c478bd9Sstevel@tonic-gate case 16: s = "AIOLIOWAIT64"; break;
12147c478bd9Sstevel@tonic-gate case 17: s = "AIOAREAD64"; break;
12157c478bd9Sstevel@tonic-gate case 18: s = "AIOAWRITE64"; break;
12167c478bd9Sstevel@tonic-gate case 19: s = "AIOCANCEL64"; break;
12177c478bd9Sstevel@tonic-gate
12187c478bd9Sstevel@tonic-gate /*
12197c478bd9Sstevel@tonic-gate * AIOFSYNC doesn't correspond to a syscall.
12207c478bd9Sstevel@tonic-gate */
12217c478bd9Sstevel@tonic-gate case AIOWAITN: s = "AIOWAITN"; break;
12227c478bd9Sstevel@tonic-gate }
12237c478bd9Sstevel@tonic-gate if (s != NULL && (val & AIO_POLL_BIT)) {
12247c478bd9Sstevel@tonic-gate (void) strlcpy(buf, s, sizeof (buf));
12257c478bd9Sstevel@tonic-gate (void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf));
12267c478bd9Sstevel@tonic-gate s = (const char *)buf;
12277c478bd9Sstevel@tonic-gate }
12287c478bd9Sstevel@tonic-gate }
12297c478bd9Sstevel@tonic-gate
12307c478bd9Sstevel@tonic-gate if (s == NULL)
12317c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
12327c478bd9Sstevel@tonic-gate else
12337c478bd9Sstevel@tonic-gate outstring(pri, s);
12347c478bd9Sstevel@tonic-gate }
12357c478bd9Sstevel@tonic-gate
12367c478bd9Sstevel@tonic-gate void
prt_aud(private_t * pri,int raw,long val)12377c478bd9Sstevel@tonic-gate prt_aud(private_t *pri, int raw, long val) /* print auditsys() code */
12387c478bd9Sstevel@tonic-gate {
12397c478bd9Sstevel@tonic-gate const char *s = NULL;
12407c478bd9Sstevel@tonic-gate
12417c478bd9Sstevel@tonic-gate if (!raw) {
12427c478bd9Sstevel@tonic-gate switch (val) {
12437c478bd9Sstevel@tonic-gate case BSM_GETAUID: s = "BSM_GETAUID"; break;
12447c478bd9Sstevel@tonic-gate case BSM_SETAUID: s = "BSM_SETAUID"; break;
12457c478bd9Sstevel@tonic-gate case BSM_GETAUDIT: s = "BSM_GETAUDIT"; break;
12467c478bd9Sstevel@tonic-gate case BSM_SETAUDIT: s = "BSM_SETAUDIT"; break;
12477c478bd9Sstevel@tonic-gate case BSM_AUDIT: s = "BSM_AUDIT"; break;
12487c478bd9Sstevel@tonic-gate case BSM_AUDITCTL: s = "BSM_AUDITCTL"; break;
12497c478bd9Sstevel@tonic-gate case BSM_GETAUDIT_ADDR: s = "BSM_GETAUDIT_ADDR"; break;
12507c478bd9Sstevel@tonic-gate case BSM_SETAUDIT_ADDR: s = "BSM_SETAUDIT_ADDR"; break;
12517c478bd9Sstevel@tonic-gate }
12527c478bd9Sstevel@tonic-gate }
12537c478bd9Sstevel@tonic-gate
12547c478bd9Sstevel@tonic-gate if (s == NULL)
12557c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
12567c478bd9Sstevel@tonic-gate else
12577c478bd9Sstevel@tonic-gate outstring(pri, s);
12587c478bd9Sstevel@tonic-gate }
12597c478bd9Sstevel@tonic-gate
12607c478bd9Sstevel@tonic-gate void
prt_cor(private_t * pri,int raw,long val)12617c478bd9Sstevel@tonic-gate prt_cor(private_t *pri, int raw, long val) /* print corectl() subcode */
12627c478bd9Sstevel@tonic-gate {
12637c478bd9Sstevel@tonic-gate const char *s = NULL;
12647c478bd9Sstevel@tonic-gate
12657c478bd9Sstevel@tonic-gate if (!raw) {
12667c478bd9Sstevel@tonic-gate switch (val) {
12677c478bd9Sstevel@tonic-gate case CC_SET_OPTIONS:
12687c478bd9Sstevel@tonic-gate s = "CC_SET_OPTIONS"; break;
12697c478bd9Sstevel@tonic-gate case CC_GET_OPTIONS:
12707c478bd9Sstevel@tonic-gate s = "CC_GET_OPTIONS"; break;
12717c478bd9Sstevel@tonic-gate case CC_SET_GLOBAL_PATH:
12727c478bd9Sstevel@tonic-gate s = "CC_SET_GLOBAL_PATH"; break;
12737c478bd9Sstevel@tonic-gate case CC_GET_GLOBAL_PATH:
12747c478bd9Sstevel@tonic-gate s = "CC_GET_GLOBAL_PATH"; break;
12757c478bd9Sstevel@tonic-gate case CC_SET_PROCESS_PATH:
12767c478bd9Sstevel@tonic-gate s = "CC_SET_PROCESS_PATH"; break;
12777c478bd9Sstevel@tonic-gate case CC_GET_PROCESS_PATH:
12787c478bd9Sstevel@tonic-gate s = "CC_GET_PROCESS_PATH"; break;
12797c478bd9Sstevel@tonic-gate case CC_SET_GLOBAL_CONTENT:
12807c478bd9Sstevel@tonic-gate s = "CC_SET_GLOBAL_CONTENT"; break;
12817c478bd9Sstevel@tonic-gate case CC_GET_GLOBAL_CONTENT:
12827c478bd9Sstevel@tonic-gate s = "CC_GET_GLOBAL_CONTENT"; break;
12837c478bd9Sstevel@tonic-gate case CC_SET_PROCESS_CONTENT:
12847c478bd9Sstevel@tonic-gate s = "CC_SET_PROCESS_CONTENT"; break;
12857c478bd9Sstevel@tonic-gate case CC_GET_PROCESS_CONTENT:
12867c478bd9Sstevel@tonic-gate s = "CC_GET_PROCESS_CONTENT"; break;
12877c478bd9Sstevel@tonic-gate case CC_SET_DEFAULT_PATH:
12887c478bd9Sstevel@tonic-gate s = "CC_SET_DEFAULT_PATH"; break;
12897c478bd9Sstevel@tonic-gate case CC_GET_DEFAULT_PATH:
12907c478bd9Sstevel@tonic-gate s = "CC_GET_DEFAULT_PATH"; break;
12917c478bd9Sstevel@tonic-gate case CC_SET_DEFAULT_CONTENT:
12927c478bd9Sstevel@tonic-gate s = "CC_SET_DEFAULT_CONTENT"; break;
12937c478bd9Sstevel@tonic-gate case CC_GET_DEFAULT_CONTENT:
12947c478bd9Sstevel@tonic-gate s = "CC_GET_DEFAULT_CONTENT"; break;
12957c478bd9Sstevel@tonic-gate }
12967c478bd9Sstevel@tonic-gate }
12977c478bd9Sstevel@tonic-gate
12987c478bd9Sstevel@tonic-gate if (s == NULL)
12997c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
13007c478bd9Sstevel@tonic-gate else
13017c478bd9Sstevel@tonic-gate outstring(pri, s);
13027c478bd9Sstevel@tonic-gate }
13037c478bd9Sstevel@tonic-gate
13047c478bd9Sstevel@tonic-gate void
prt_cco(private_t * pri,int raw,long val)13057c478bd9Sstevel@tonic-gate prt_cco(private_t *pri, int raw, long val) /* print corectl() options */
13067c478bd9Sstevel@tonic-gate {
13077c478bd9Sstevel@tonic-gate char *s;
13087c478bd9Sstevel@tonic-gate
13097c478bd9Sstevel@tonic-gate if (val == 0)
13107c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
13117c478bd9Sstevel@tonic-gate else if (raw || (val & ~CC_OPTIONS))
13127c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
13137c478bd9Sstevel@tonic-gate else {
13147c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
13157c478bd9Sstevel@tonic-gate s = pri->code_buf;
13167c478bd9Sstevel@tonic-gate *s = '\0';
13177c478bd9Sstevel@tonic-gate if (val & CC_GLOBAL_PATH)
13187c478bd9Sstevel@tonic-gate (void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE);
13197c478bd9Sstevel@tonic-gate if (val & CC_PROCESS_PATH)
13207c478bd9Sstevel@tonic-gate (void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE);
13217c478bd9Sstevel@tonic-gate if (val & CC_GLOBAL_SETID)
13227c478bd9Sstevel@tonic-gate (void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE);
13237c478bd9Sstevel@tonic-gate if (val & CC_PROCESS_SETID)
13247c478bd9Sstevel@tonic-gate (void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE);
13257c478bd9Sstevel@tonic-gate if (val & CC_GLOBAL_LOG)
13267c478bd9Sstevel@tonic-gate (void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE);
13277c478bd9Sstevel@tonic-gate if (*s == '\0')
13287c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, val);
13297c478bd9Sstevel@tonic-gate else
13307c478bd9Sstevel@tonic-gate outstring(pri, ++s);
13317c478bd9Sstevel@tonic-gate #undef CBSIZE
13327c478bd9Sstevel@tonic-gate }
13337c478bd9Sstevel@tonic-gate }
13347c478bd9Sstevel@tonic-gate
13357c478bd9Sstevel@tonic-gate void
prt_ccc(private_t * pri,int raw,long val)13367c478bd9Sstevel@tonic-gate prt_ccc(private_t *pri, int raw, long val) /* print corectl() content */
13377c478bd9Sstevel@tonic-gate {
13387c478bd9Sstevel@tonic-gate core_content_t ccc;
13397c478bd9Sstevel@tonic-gate
13407c478bd9Sstevel@tonic-gate if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
13417c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
13427c478bd9Sstevel@tonic-gate else if (!raw && proc_content2str(ccc, pri->code_buf,
13437c478bd9Sstevel@tonic-gate sizeof (pri->code_buf)) >= 0)
13447c478bd9Sstevel@tonic-gate outstring(pri, pri->code_buf);
13457c478bd9Sstevel@tonic-gate else
13467c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, (long)ccc);
13477c478bd9Sstevel@tonic-gate }
13487c478bd9Sstevel@tonic-gate
13497c478bd9Sstevel@tonic-gate void
prt_rcc(private_t * pri,int raw,long val)13507c478bd9Sstevel@tonic-gate prt_rcc(private_t *pri, int raw, long val) /* print corectl() ret. cont. */
13517c478bd9Sstevel@tonic-gate {
13527c478bd9Sstevel@tonic-gate core_content_t ccc;
13537c478bd9Sstevel@tonic-gate
13547c478bd9Sstevel@tonic-gate if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
13557c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
13567c478bd9Sstevel@tonic-gate else if (!raw && proc_content2str(ccc, pri->code_buf,
13577c478bd9Sstevel@tonic-gate sizeof (pri->code_buf)) >= 0)
13587c478bd9Sstevel@tonic-gate outstring(pri, pri->code_buf);
13597c478bd9Sstevel@tonic-gate else
13607c478bd9Sstevel@tonic-gate prt_hhx(pri, 0, (long)ccc);
13617c478bd9Sstevel@tonic-gate }
13627c478bd9Sstevel@tonic-gate
13637c478bd9Sstevel@tonic-gate void
prt_cpc(private_t * pri,int raw,long val)13647c478bd9Sstevel@tonic-gate prt_cpc(private_t *pri, int raw, long val) /* print cpc() subcode */
13657c478bd9Sstevel@tonic-gate {
13667c478bd9Sstevel@tonic-gate const char *s = NULL;
13677c478bd9Sstevel@tonic-gate
13687c478bd9Sstevel@tonic-gate if (!raw) {
13697c478bd9Sstevel@tonic-gate switch (val) {
13707c478bd9Sstevel@tonic-gate case CPC_BIND: s = "CPC_BIND"; break;
13717c478bd9Sstevel@tonic-gate case CPC_SAMPLE: s = "CPC_SAMPLE"; break;
13727c478bd9Sstevel@tonic-gate case CPC_INVALIDATE: s = "CPC_INVALIDATE"; break;
13737c478bd9Sstevel@tonic-gate case CPC_RELE: s = "CPC_RELE"; break;
13747c478bd9Sstevel@tonic-gate case CPC_EVLIST_SIZE: s = "CPC_EVLIST_SIZE"; break;
13757c478bd9Sstevel@tonic-gate case CPC_LIST_EVENTS: s = "CPC_LIST_EVENTS"; break;
13767c478bd9Sstevel@tonic-gate case CPC_ATTRLIST_SIZE: s = "CPC_ATTRLIST_SIZE"; break;
13777c478bd9Sstevel@tonic-gate case CPC_LIST_ATTRS: s = "CPC_LIST_ATTRS"; break;
13787c478bd9Sstevel@tonic-gate case CPC_IMPL_NAME: s = "CPC_IMPL_NAME"; break;
13797c478bd9Sstevel@tonic-gate case CPC_CPUREF: s = "CPC_CPUREF"; break;
13807c478bd9Sstevel@tonic-gate case CPC_USR_EVENTS: s = "CPC_USR_EVENTS"; break;
13817c478bd9Sstevel@tonic-gate case CPC_SYS_EVENTS: s = "CPC_SYS_EVENTS"; break;
13827c478bd9Sstevel@tonic-gate case CPC_NPIC: s = "CPC_NPIC"; break;
13837c478bd9Sstevel@tonic-gate case CPC_CAPS: s = "CPC_CAPS"; break;
13847c478bd9Sstevel@tonic-gate case CPC_ENABLE: s = "CPC_ENABLE"; break;
13857c478bd9Sstevel@tonic-gate case CPC_DISABLE: s = "CPC_DISABLE"; break;
13867c478bd9Sstevel@tonic-gate }
13877c478bd9Sstevel@tonic-gate }
13887c478bd9Sstevel@tonic-gate
13897c478bd9Sstevel@tonic-gate if (s == NULL)
13907c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
13917c478bd9Sstevel@tonic-gate else
13927c478bd9Sstevel@tonic-gate outstring(pri, s);
13937c478bd9Sstevel@tonic-gate }
13947c478bd9Sstevel@tonic-gate
13957c478bd9Sstevel@tonic-gate void
outstring(private_t * pri,const char * s)13967c478bd9Sstevel@tonic-gate outstring(private_t *pri, const char *s)
13977c478bd9Sstevel@tonic-gate {
13987c478bd9Sstevel@tonic-gate int len = strlen(s);
13997c478bd9Sstevel@tonic-gate
14007c478bd9Sstevel@tonic-gate GROW(len);
14017c478bd9Sstevel@tonic-gate (void) strcpy(pri->sys_string + pri->sys_leng, s);
14027c478bd9Sstevel@tonic-gate pri->sys_leng += len;
14037c478bd9Sstevel@tonic-gate }
14047c478bd9Sstevel@tonic-gate
14057c478bd9Sstevel@tonic-gate void
grow(private_t * pri,int nbyte)14067c478bd9Sstevel@tonic-gate grow(private_t *pri, int nbyte) /* reallocate format buffer if necessary */
14077c478bd9Sstevel@tonic-gate {
14087c478bd9Sstevel@tonic-gate while (pri->sys_leng + nbyte >= pri->sys_ssize)
14097c478bd9Sstevel@tonic-gate pri->sys_string = my_realloc(pri->sys_string,
1410fac3008cSeschrock pri->sys_ssize *= 2, "format buffer");
14117c478bd9Sstevel@tonic-gate }
14127c478bd9Sstevel@tonic-gate
14137c478bd9Sstevel@tonic-gate void
prt_clc(private_t * pri,int raw,long val)14147c478bd9Sstevel@tonic-gate prt_clc(private_t *pri, int raw, long val)
14157c478bd9Sstevel@tonic-gate {
14167c478bd9Sstevel@tonic-gate const char *s = NULL;
14177c478bd9Sstevel@tonic-gate
14187c478bd9Sstevel@tonic-gate if (!raw) {
14197c478bd9Sstevel@tonic-gate switch (val) {
14207c478bd9Sstevel@tonic-gate case CL_INITIALIZE: s = "CL_INITIALIZE"; break;
14217c478bd9Sstevel@tonic-gate case CL_CONFIG: s = "CL_CONFIG"; break;
14227c478bd9Sstevel@tonic-gate }
14237c478bd9Sstevel@tonic-gate }
14247c478bd9Sstevel@tonic-gate
14257c478bd9Sstevel@tonic-gate if (s == NULL)
14267c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
14277c478bd9Sstevel@tonic-gate else
14287c478bd9Sstevel@tonic-gate outstring(pri, s);
14297c478bd9Sstevel@tonic-gate }
14307c478bd9Sstevel@tonic-gate
14317c478bd9Sstevel@tonic-gate void
prt_clf(private_t * pri,int raw,long val)14327c478bd9Sstevel@tonic-gate prt_clf(private_t *pri, int raw, long val)
14337c478bd9Sstevel@tonic-gate {
14347c478bd9Sstevel@tonic-gate const char *s = NULL;
14357c478bd9Sstevel@tonic-gate
14367c478bd9Sstevel@tonic-gate if (!raw) {
14377c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
14387c478bd9Sstevel@tonic-gate case CL_CONFIG:
14397c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) {
14407c478bd9Sstevel@tonic-gate case CL_NODEID:
14417c478bd9Sstevel@tonic-gate s = "CL_NODEID"; break;
14427c478bd9Sstevel@tonic-gate case CL_HIGHEST_NODEID:
14437c478bd9Sstevel@tonic-gate s = "CL_HIGHEST_NODEID"; break;
14447c478bd9Sstevel@tonic-gate }
14457c478bd9Sstevel@tonic-gate break;
14467c478bd9Sstevel@tonic-gate case CL_INITIALIZE:
14477c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) {
14487c478bd9Sstevel@tonic-gate case CL_GET_BOOTFLAG:
14497c478bd9Sstevel@tonic-gate s = "CL_GET_BOOTFLAG"; break;
14507c478bd9Sstevel@tonic-gate }
14517c478bd9Sstevel@tonic-gate break;
14527c478bd9Sstevel@tonic-gate }
14537c478bd9Sstevel@tonic-gate }
14547c478bd9Sstevel@tonic-gate
14557c478bd9Sstevel@tonic-gate if (s == NULL)
14567c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
14577c478bd9Sstevel@tonic-gate else
14587c478bd9Sstevel@tonic-gate outstring(pri, s);
14597c478bd9Sstevel@tonic-gate }
14607c478bd9Sstevel@tonic-gate
14617c478bd9Sstevel@tonic-gate void
prt_sqc(private_t * pri,int raw,long val)14627c478bd9Sstevel@tonic-gate prt_sqc(private_t *pri, int raw, long val) /* print sigqueue() si_code */
14637c478bd9Sstevel@tonic-gate {
14647c478bd9Sstevel@tonic-gate const char *s = NULL;
14657c478bd9Sstevel@tonic-gate
14667c478bd9Sstevel@tonic-gate if (!raw) {
14677c478bd9Sstevel@tonic-gate switch ((int)val) {
14687c478bd9Sstevel@tonic-gate case SI_QUEUE: s = "SI_QUEUE"; break;
14697c478bd9Sstevel@tonic-gate case SI_TIMER: s = "SI_TIMER"; break;
14707c478bd9Sstevel@tonic-gate case SI_ASYNCIO: s = "SI_ASYNCIO"; break;
14717c478bd9Sstevel@tonic-gate case SI_MESGQ: s = "SI_MESGQ"; break;
14727c478bd9Sstevel@tonic-gate }
14737c478bd9Sstevel@tonic-gate }
14747c478bd9Sstevel@tonic-gate
14757c478bd9Sstevel@tonic-gate if (s == NULL)
14767c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
14777c478bd9Sstevel@tonic-gate else
14787c478bd9Sstevel@tonic-gate outstring(pri, s);
14797c478bd9Sstevel@tonic-gate }
14807c478bd9Sstevel@tonic-gate
14817c478bd9Sstevel@tonic-gate /*
14827c478bd9Sstevel@tonic-gate * print priocntlsys() (key, value) pair key.
14837c478bd9Sstevel@tonic-gate */
14847c478bd9Sstevel@tonic-gate void
print_pck(private_t * pri,int raw,long val)14857c478bd9Sstevel@tonic-gate print_pck(private_t *pri, int raw, long val)
14867c478bd9Sstevel@tonic-gate {
14877c478bd9Sstevel@tonic-gate const char *s = NULL;
14887c478bd9Sstevel@tonic-gate char clname[PC_CLNMSZ];
14897c478bd9Sstevel@tonic-gate
14907c478bd9Sstevel@tonic-gate if ((pri->sys_args[2] != PC_GETXPARMS &&
14917c478bd9Sstevel@tonic-gate pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) {
14927c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
14937c478bd9Sstevel@tonic-gate return;
14947c478bd9Sstevel@tonic-gate }
14957c478bd9Sstevel@tonic-gate
149627aa4812SToomas Soome if (pri->sys_args[3] == 0) {
14977c478bd9Sstevel@tonic-gate if (val == PC_KY_CLNAME) {
14987c478bd9Sstevel@tonic-gate s = "PC_KY_CLNAME";
14997c478bd9Sstevel@tonic-gate outstring(pri, s);
15007c478bd9Sstevel@tonic-gate } else
15017c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
15027c478bd9Sstevel@tonic-gate return;
15037c478bd9Sstevel@tonic-gate }
15047c478bd9Sstevel@tonic-gate
15057c478bd9Sstevel@tonic-gate if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) {
15067c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
15077c478bd9Sstevel@tonic-gate return;
15087c478bd9Sstevel@tonic-gate }
15097c478bd9Sstevel@tonic-gate
15107c478bd9Sstevel@tonic-gate if (strcmp(clname, "TS") == 0) {
15117c478bd9Sstevel@tonic-gate switch (val) {
151227aa4812SToomas Soome case TS_KY_UPRILIM: s = "TS_KY_UPRILIM"; break;
15137c478bd9Sstevel@tonic-gate case TS_KY_UPRI: s = "TS_KY_UPRI"; break;
15147c478bd9Sstevel@tonic-gate default: break;
15157c478bd9Sstevel@tonic-gate }
15167c478bd9Sstevel@tonic-gate } else if (strcmp(clname, "IA") == 0) {
15177c478bd9Sstevel@tonic-gate switch (val) {
151827aa4812SToomas Soome case IA_KY_UPRILIM: s = "IA_KY_UPRILIM"; break;
15197c478bd9Sstevel@tonic-gate case IA_KY_UPRI: s = "IA_KY_UPRI"; break;
15207c478bd9Sstevel@tonic-gate case IA_KY_MODE: s = "IA_KY_MODE"; break;
15217c478bd9Sstevel@tonic-gate default: break;
15227c478bd9Sstevel@tonic-gate }
15237c478bd9Sstevel@tonic-gate } else if (strcmp(clname, "RT") == 0) {
15247c478bd9Sstevel@tonic-gate switch (val) {
152527aa4812SToomas Soome case RT_KY_PRI: s = "RT_KY_PRI"; break;
15267c478bd9Sstevel@tonic-gate case RT_KY_TQSECS: s = "RT_KY_TQSECS"; break;
15277c478bd9Sstevel@tonic-gate case RT_KY_TQNSECS: s = "RT_KY_TQNSECS"; break;
15287c478bd9Sstevel@tonic-gate case RT_KY_TQSIG: s = "RT_KY_TQSIG"; break;
15297c478bd9Sstevel@tonic-gate default: break;
15307c478bd9Sstevel@tonic-gate }
15317c478bd9Sstevel@tonic-gate } else if (strcmp(clname, "FSS") == 0) {
15327c478bd9Sstevel@tonic-gate switch (val) {
153327aa4812SToomas Soome case FSS_KY_UPRILIM: s = "FSS_KY_UPRILIM"; break;
15347c478bd9Sstevel@tonic-gate case FSS_KY_UPRI: s = "FSS_KY_UPRI"; break;
15357c478bd9Sstevel@tonic-gate default: break;
15367c478bd9Sstevel@tonic-gate }
15377c478bd9Sstevel@tonic-gate } else if (strcmp(clname, "FX") == 0) {
15387c478bd9Sstevel@tonic-gate switch (val) {
153927aa4812SToomas Soome case FX_KY_UPRILIM: s = "FX_KY_UPRILIM"; break;
15407c478bd9Sstevel@tonic-gate case FX_KY_UPRI: s = "FX_KY_UPRI"; break;
15417c478bd9Sstevel@tonic-gate case FX_KY_TQSECS: s = "FX_KY_TQSECS"; break;
15427c478bd9Sstevel@tonic-gate case FX_KY_TQNSECS: s = "FX_KY_TQNSECS"; break;
15437c478bd9Sstevel@tonic-gate default: break;
15447c478bd9Sstevel@tonic-gate }
15457c478bd9Sstevel@tonic-gate }
15467c478bd9Sstevel@tonic-gate
15477c478bd9Sstevel@tonic-gate if (s == NULL)
15487c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
15497c478bd9Sstevel@tonic-gate else
15507c478bd9Sstevel@tonic-gate outstring(pri, s);
15517c478bd9Sstevel@tonic-gate }
15527c478bd9Sstevel@tonic-gate
15537c478bd9Sstevel@tonic-gate /*
15547c478bd9Sstevel@tonic-gate * print priocntlsys() fourth argument.
15557c478bd9Sstevel@tonic-gate */
15567c478bd9Sstevel@tonic-gate /*ARGSUSED*/
15577c478bd9Sstevel@tonic-gate void
prt_pc4(private_t * pri,int raw,long val)15587c478bd9Sstevel@tonic-gate prt_pc4(private_t *pri, int raw, long val)
15597c478bd9Sstevel@tonic-gate {
15607c478bd9Sstevel@tonic-gate /* look at pricntlsys function */
15617c478bd9Sstevel@tonic-gate if ((pri->sys_args[2] != PC_GETXPARMS &&
15627c478bd9Sstevel@tonic-gate pri->sys_args[2] != PC_SETXPARMS))
15637c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
15647c478bd9Sstevel@tonic-gate else if (val)
15657c478bd9Sstevel@tonic-gate prt_stg(pri, 0, val);
15667c478bd9Sstevel@tonic-gate else
15677c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
15687c478bd9Sstevel@tonic-gate }
15697c478bd9Sstevel@tonic-gate
15707c478bd9Sstevel@tonic-gate /*
15717c478bd9Sstevel@tonic-gate * print priocntlsys() (key, value) pairs (5th argument).
15727c478bd9Sstevel@tonic-gate */
15737c478bd9Sstevel@tonic-gate /*ARGSUSED*/
15747c478bd9Sstevel@tonic-gate void
prt_pc5(private_t * pri,int raw,long val)15757c478bd9Sstevel@tonic-gate prt_pc5(private_t *pri, int raw, long val)
15767c478bd9Sstevel@tonic-gate {
15777c478bd9Sstevel@tonic-gate pc_vaparms_t prms;
15787c478bd9Sstevel@tonic-gate pc_vaparm_t *vpp = &prms.pc_parms[0];
15797c478bd9Sstevel@tonic-gate uint_t cnt;
15807c478bd9Sstevel@tonic-gate
15817c478bd9Sstevel@tonic-gate
15827c478bd9Sstevel@tonic-gate /* look at pricntlsys function */
15837c478bd9Sstevel@tonic-gate if ((pri->sys_args[2] != PC_GETXPARMS &&
15847c478bd9Sstevel@tonic-gate pri->sys_args[2] != PC_SETXPARMS) || val == 0) {
15857c478bd9Sstevel@tonic-gate prt_dec(pri, 0, 0);
15867c478bd9Sstevel@tonic-gate return;
15877c478bd9Sstevel@tonic-gate }
15887c478bd9Sstevel@tonic-gate
15897c478bd9Sstevel@tonic-gate if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) {
15907c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
15917c478bd9Sstevel@tonic-gate return;
15927c478bd9Sstevel@tonic-gate }
15937c478bd9Sstevel@tonic-gate
15947c478bd9Sstevel@tonic-gate if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT)
15957c478bd9Sstevel@tonic-gate return;
15967c478bd9Sstevel@tonic-gate
15977c478bd9Sstevel@tonic-gate for (; cnt--; vpp++) {
15987c478bd9Sstevel@tonic-gate print_pck(pri, 0, vpp->pc_key);
15997c478bd9Sstevel@tonic-gate outstring(pri, ", ");
16007c478bd9Sstevel@tonic-gate prt_hex(pri, 0, (long)vpp->pc_parm);
16017c478bd9Sstevel@tonic-gate outstring(pri, ", ");
16027c478bd9Sstevel@tonic-gate }
16037c478bd9Sstevel@tonic-gate
16047c478bd9Sstevel@tonic-gate prt_dec(pri, 0, PC_KY_NULL);
16057c478bd9Sstevel@tonic-gate }
16067c478bd9Sstevel@tonic-gate
1607d2a70789SRichard Lowe
1608d2a70789SRichard Lowe void
prt_psflags(private_t * pri,secflagset_t val)1609d2a70789SRichard Lowe prt_psflags(private_t *pri, secflagset_t val)
1610d2a70789SRichard Lowe {
16117f7cea96SToomas Soome size_t len;
16127f7cea96SToomas Soome char *ptr;
1613d2a70789SRichard Lowe char str[1024];
1614d2a70789SRichard Lowe
1615d2a70789SRichard Lowe if (val == 0) {
1616d2a70789SRichard Lowe outstring(pri, "0x0");
1617d2a70789SRichard Lowe return;
1618d2a70789SRichard Lowe }
1619d2a70789SRichard Lowe
1620d2a70789SRichard Lowe *str = '\0';
1621d2a70789SRichard Lowe if (secflag_isset(val, PROC_SEC_ASLR)) {
1622d2a70789SRichard Lowe (void) strlcat(str, "|PROC_SEC_ASLR", sizeof (str));
1623d2a70789SRichard Lowe secflag_clear(&val, PROC_SEC_ASLR);
1624d2a70789SRichard Lowe }
1625d2a70789SRichard Lowe if (secflag_isset(val, PROC_SEC_FORBIDNULLMAP)) {
1626d2a70789SRichard Lowe (void) strlcat(str, "|PROC_SEC_FORBIDNULLMAP",
1627d2a70789SRichard Lowe sizeof (str));
1628d2a70789SRichard Lowe secflag_clear(&val, PROC_SEC_FORBIDNULLMAP);
1629d2a70789SRichard Lowe }
1630d2a70789SRichard Lowe if (secflag_isset(val, PROC_SEC_NOEXECSTACK)) {
1631d2a70789SRichard Lowe (void) strlcat(str, "|PROC_SEC_NOEXECSTACK",
1632d2a70789SRichard Lowe sizeof (str));
1633d2a70789SRichard Lowe secflag_clear(&val, PROC_SEC_NOEXECSTACK);
1634d2a70789SRichard Lowe }
1635d2a70789SRichard Lowe
1636b377984aSJohn Levon if (val != 0) {
1637b377984aSJohn Levon len = strlen(str);
1638b377984aSJohn Levon ptr = str + len;
1639b377984aSJohn Levon (void) snprintf(ptr, sizeof (str) - len, "|%#x", val);
1640b377984aSJohn Levon }
1641b377984aSJohn Levon
1642d2a70789SRichard Lowe outstring(pri, str + 1);
1643d2a70789SRichard Lowe }
1644d2a70789SRichard Lowe
1645d2a70789SRichard Lowe /*
1646d2a70789SRichard Lowe * Print a psecflags(2) delta
1647d2a70789SRichard Lowe */
1648d2a70789SRichard Lowe void
prt_psdelta(private_t * pri,int raw,long value)1649d2a70789SRichard Lowe prt_psdelta(private_t *pri, int raw, long value)
1650d2a70789SRichard Lowe {
1651d2a70789SRichard Lowe secflagdelta_t psd;
1652d2a70789SRichard Lowe
1653d2a70789SRichard Lowe if ((raw != 0) ||
1654d2a70789SRichard Lowe (Pread(Proc, &psd, sizeof (psd), value) != sizeof (psd))) {
1655d2a70789SRichard Lowe prt_hex(pri, 0, value);
1656d2a70789SRichard Lowe return;
1657d2a70789SRichard Lowe }
1658d2a70789SRichard Lowe outstring(pri, "{ ");
1659d2a70789SRichard Lowe prt_psflags(pri, psd.psd_add);
1660d2a70789SRichard Lowe outstring(pri, ", ");
1661d2a70789SRichard Lowe prt_psflags(pri, psd.psd_rem);
1662d2a70789SRichard Lowe outstring(pri, ", ");
1663d2a70789SRichard Lowe prt_psflags(pri, psd.psd_assign);
1664d2a70789SRichard Lowe outstring(pri, ", ");
1665d2a70789SRichard Lowe outstring(pri, psd.psd_ass_active ? "B_TRUE" : "B_FALSE");
1666d2a70789SRichard Lowe outstring(pri, " }");
1667d2a70789SRichard Lowe }
1668d2a70789SRichard Lowe
1669d2a70789SRichard Lowe /*
1670d2a70789SRichard Lowe * Print a psecflagswhich_t
1671d2a70789SRichard Lowe */
1672d2a70789SRichard Lowe void
prt_psfw(private_t * pri,int raw,long value)1673d2a70789SRichard Lowe prt_psfw(private_t *pri, int raw, long value)
1674d2a70789SRichard Lowe {
1675d2a70789SRichard Lowe psecflagwhich_t which = (psecflagwhich_t)value;
1676d2a70789SRichard Lowe char *s;
1677d2a70789SRichard Lowe
1678d2a70789SRichard Lowe if (raw != 0) {
1679d2a70789SRichard Lowe prt_dec(pri, 0, value);
1680d2a70789SRichard Lowe return;
1681d2a70789SRichard Lowe }
1682d2a70789SRichard Lowe
1683d2a70789SRichard Lowe switch (which) {
1684d2a70789SRichard Lowe case PSF_EFFECTIVE:
1685d2a70789SRichard Lowe s = "PSF_EFFECTIVE";
1686d2a70789SRichard Lowe break;
1687d2a70789SRichard Lowe case PSF_INHERIT:
1688d2a70789SRichard Lowe s = "PSF_INHERIT";
1689d2a70789SRichard Lowe break;
1690d2a70789SRichard Lowe case PSF_LOWER:
1691d2a70789SRichard Lowe s = "PSF_LOWER";
1692d2a70789SRichard Lowe break;
1693d2a70789SRichard Lowe case PSF_UPPER:
1694d2a70789SRichard Lowe s = "PSF_UPPER";
1695d2a70789SRichard Lowe break;
1696d2a70789SRichard Lowe }
1697d2a70789SRichard Lowe
1698d2a70789SRichard Lowe if (s == NULL)
1699d2a70789SRichard Lowe prt_dec(pri, 0, value);
1700d2a70789SRichard Lowe else
1701d2a70789SRichard Lowe outstring(pri, s);
1702d2a70789SRichard Lowe }
1703d2a70789SRichard Lowe
17047c478bd9Sstevel@tonic-gate /*
17057c478bd9Sstevel@tonic-gate * Print processor set id, including logical expansion of "special" ids.
17067c478bd9Sstevel@tonic-gate */
17077c478bd9Sstevel@tonic-gate void
prt_pst(private_t * pri,int raw,long val)17087c478bd9Sstevel@tonic-gate prt_pst(private_t *pri, int raw, long val)
17097c478bd9Sstevel@tonic-gate {
17107c478bd9Sstevel@tonic-gate const char *s = NULL;
17117c478bd9Sstevel@tonic-gate
17127c478bd9Sstevel@tonic-gate if (!raw) {
17137c478bd9Sstevel@tonic-gate switch ((psetid_t)val) {
17147c478bd9Sstevel@tonic-gate case PS_NONE: s = "PS_NONE"; break;
17157c478bd9Sstevel@tonic-gate case PS_QUERY: s = "PS_QUERY"; break;
17167c478bd9Sstevel@tonic-gate case PS_MYID: s = "PS_MYID"; break;
17177c478bd9Sstevel@tonic-gate }
17187c478bd9Sstevel@tonic-gate }
17197c478bd9Sstevel@tonic-gate
17207c478bd9Sstevel@tonic-gate if (s == NULL)
17217c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
17227c478bd9Sstevel@tonic-gate else
17237c478bd9Sstevel@tonic-gate outstring(pri, s);
17247c478bd9Sstevel@tonic-gate }
17257c478bd9Sstevel@tonic-gate
17267c478bd9Sstevel@tonic-gate /*
17277c478bd9Sstevel@tonic-gate * Print meminfo() argument.
17287c478bd9Sstevel@tonic-gate */
17297c478bd9Sstevel@tonic-gate /*ARGSUSED*/
17307c478bd9Sstevel@tonic-gate void
prt_mif(private_t * pri,int raw,long val)17317c478bd9Sstevel@tonic-gate prt_mif(private_t *pri, int raw, long val)
17327c478bd9Sstevel@tonic-gate {
17337c478bd9Sstevel@tonic-gate struct meminfo minfo;
17347c478bd9Sstevel@tonic-gate
17357c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_ILP32) {
17367c478bd9Sstevel@tonic-gate struct meminfo32 minfo32;
17377c478bd9Sstevel@tonic-gate
17387c478bd9Sstevel@tonic-gate if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) !=
17397c478bd9Sstevel@tonic-gate sizeof (struct meminfo32)) {
17407c478bd9Sstevel@tonic-gate prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
17417c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17427c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
17437c478bd9Sstevel@tonic-gate return;
17447c478bd9Sstevel@tonic-gate }
17457c478bd9Sstevel@tonic-gate /*
17467c478bd9Sstevel@tonic-gate * arrange the arguments in the order that user calls with
17477c478bd9Sstevel@tonic-gate */
17487c478bd9Sstevel@tonic-gate prt_hex(pri, 0, minfo32.mi_inaddr);
17497c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17507c478bd9Sstevel@tonic-gate prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
17517c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17527c478bd9Sstevel@tonic-gate prt_hex(pri, 0, minfo32.mi_info_req);
17537c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17547c478bd9Sstevel@tonic-gate prt_dec(pri, 0, minfo32.mi_info_count);
17557c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17567c478bd9Sstevel@tonic-gate prt_hex(pri, 0, minfo32.mi_outdata);
17577c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17587c478bd9Sstevel@tonic-gate prt_hex(pri, 0, minfo32.mi_validity);
17597c478bd9Sstevel@tonic-gate return;
17607c478bd9Sstevel@tonic-gate }
17617c478bd9Sstevel@tonic-gate if (Pread(Proc, &minfo, sizeof (struct meminfo), val) !=
17627c478bd9Sstevel@tonic-gate sizeof (struct meminfo)) {
17637c478bd9Sstevel@tonic-gate prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
17647c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17657c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
17667c478bd9Sstevel@tonic-gate return;
17677c478bd9Sstevel@tonic-gate }
17687c478bd9Sstevel@tonic-gate /*
17697c478bd9Sstevel@tonic-gate * arrange the arguments in the order that user calls with
17707c478bd9Sstevel@tonic-gate */
17717c478bd9Sstevel@tonic-gate prt_hex(pri, 0, (long)minfo.mi_inaddr);
17727c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17737c478bd9Sstevel@tonic-gate prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */
17747c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17757c478bd9Sstevel@tonic-gate prt_hex(pri, 0, (long)minfo.mi_info_req);
17767c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17777c478bd9Sstevel@tonic-gate prt_dec(pri, 0, minfo.mi_info_count);
17787c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17797c478bd9Sstevel@tonic-gate prt_hex(pri, 0, (long)minfo.mi_outdata);
17807c478bd9Sstevel@tonic-gate outstring(pri, ", ");
17817c478bd9Sstevel@tonic-gate prt_hex(pri, 0, (long)minfo.mi_validity);
17827c478bd9Sstevel@tonic-gate }
17837c478bd9Sstevel@tonic-gate
17847c478bd9Sstevel@tonic-gate
17857c478bd9Sstevel@tonic-gate /*
17867c478bd9Sstevel@tonic-gate * Print so_socket() 1st argument.
17877c478bd9Sstevel@tonic-gate */
17887c478bd9Sstevel@tonic-gate /*ARGSUSED*/
17897c478bd9Sstevel@tonic-gate void
prt_pfm(private_t * pri,int raw,long val)17907c478bd9Sstevel@tonic-gate prt_pfm(private_t *pri, int raw, long val)
17917c478bd9Sstevel@tonic-gate {
17927c478bd9Sstevel@tonic-gate /* Protocol Families have same names as Address Families */
17937c478bd9Sstevel@tonic-gate if ((ulong_t)val < MAX_AFCODES) {
17947c478bd9Sstevel@tonic-gate outstring(pri, "PF_");
17957c478bd9Sstevel@tonic-gate outstring(pri, afcodes[val]);
17967c478bd9Sstevel@tonic-gate } else {
17977c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
17987c478bd9Sstevel@tonic-gate }
17997c478bd9Sstevel@tonic-gate }
18007c478bd9Sstevel@tonic-gate
18013e95bd4aSAnders Persson /*
18023e95bd4aSAnders Persson * Print sockconfig() subcode.
18033e95bd4aSAnders Persson */
18043e95bd4aSAnders Persson /*ARGSUSED*/
18053e95bd4aSAnders Persson void
prt_skc(private_t * pri,int raw,long val)18063e95bd4aSAnders Persson prt_skc(private_t *pri, int raw, long val)
18073e95bd4aSAnders Persson {
18083e95bd4aSAnders Persson const char *s = NULL;
18097c478bd9Sstevel@tonic-gate
18103e95bd4aSAnders Persson if (!raw) {
18113e95bd4aSAnders Persson switch (val) {
18123e95bd4aSAnders Persson case SOCKCONFIG_ADD_SOCK:
18133e95bd4aSAnders Persson s = "SOCKCONFIG_ADD_SOCK"; break;
18143e95bd4aSAnders Persson case SOCKCONFIG_REMOVE_SOCK:
18153e95bd4aSAnders Persson s = "SOCKCONFIG_REMOVE_SOCK"; break;
18163e95bd4aSAnders Persson case SOCKCONFIG_ADD_FILTER:
18173e95bd4aSAnders Persson s = "SOCKCONFIG_ADD_FILTER"; break;
18183e95bd4aSAnders Persson case SOCKCONFIG_REMOVE_FILTER:
18193e95bd4aSAnders Persson s = "SOCKCONFIG_REMOVE_FILTER"; break;
18203e95bd4aSAnders Persson }
18213e95bd4aSAnders Persson }
18223e95bd4aSAnders Persson if (s == NULL)
18233e95bd4aSAnders Persson prt_dec(pri, 0, val);
18243e95bd4aSAnders Persson else
18253e95bd4aSAnders Persson outstring(pri, s);
18263e95bd4aSAnders Persson }
18277c478bd9Sstevel@tonic-gate /*
18287c478bd9Sstevel@tonic-gate * Print so_socket() 2nd argument.
18297c478bd9Sstevel@tonic-gate */
18307c478bd9Sstevel@tonic-gate /*ARGSUSED*/
18317c478bd9Sstevel@tonic-gate void
prt_skt(private_t * pri,int raw,long val)18327c478bd9Sstevel@tonic-gate prt_skt(private_t *pri, int raw, long val)
18337c478bd9Sstevel@tonic-gate {
18347c478bd9Sstevel@tonic-gate const char *s;
1835187670a0STheo Schlossnagle long type = val & SOCK_TYPE_MASK;
18367c478bd9Sstevel@tonic-gate
1837187670a0STheo Schlossnagle if ((ulong_t)type <= MAX_SOCKTYPES &&
1838187670a0STheo Schlossnagle (s = socktype_codes[type]) != NULL) {
18397c478bd9Sstevel@tonic-gate outstring(pri, s);
1840187670a0STheo Schlossnagle if ((val & SOCK_CLOEXEC) != 0) {
1841187670a0STheo Schlossnagle outstring(pri, "|SOCK_CLOEXEC");
1842187670a0STheo Schlossnagle }
1843187670a0STheo Schlossnagle } else {
18447c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
1845187670a0STheo Schlossnagle }
18467c478bd9Sstevel@tonic-gate }
18477c478bd9Sstevel@tonic-gate
18487c478bd9Sstevel@tonic-gate
18497c478bd9Sstevel@tonic-gate /*
18507c478bd9Sstevel@tonic-gate * Print so_socket() 3rd argument.
18517c478bd9Sstevel@tonic-gate */
18527c478bd9Sstevel@tonic-gate /*ARGSUSED*/
18537c478bd9Sstevel@tonic-gate void
prt_skp(private_t * pri,int raw,long val)18547c478bd9Sstevel@tonic-gate prt_skp(private_t *pri, int raw, long val)
18557c478bd9Sstevel@tonic-gate {
18567c478bd9Sstevel@tonic-gate const char *s;
18577c478bd9Sstevel@tonic-gate
18587c478bd9Sstevel@tonic-gate /* cheating -- look at the protocol-family */
18597c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
18607c478bd9Sstevel@tonic-gate case PF_INET6:
18617c478bd9Sstevel@tonic-gate case PF_INET:
186215f90b02SGarrett D'Amore if ((s = ipprotos((int)val)) != NULL) {
186315f90b02SGarrett D'Amore outstring(pri, s);
18647c478bd9Sstevel@tonic-gate break;
186515f90b02SGarrett D'Amore }
186615f90b02SGarrett D'Amore /* FALLTHROUGH */
186715f90b02SGarrett D'Amore default:
186815f90b02SGarrett D'Amore prt_dec(pri, 0, val);
186915f90b02SGarrett D'Amore break;
18707c478bd9Sstevel@tonic-gate }
18717c478bd9Sstevel@tonic-gate }
18727c478bd9Sstevel@tonic-gate
18737c478bd9Sstevel@tonic-gate
18747c478bd9Sstevel@tonic-gate /*
18757c478bd9Sstevel@tonic-gate * Print so_socket() 5th argument.
18767c478bd9Sstevel@tonic-gate */
18777c478bd9Sstevel@tonic-gate /*ARGSUSED*/
18787c478bd9Sstevel@tonic-gate void
prt_skv(private_t * pri,int raw,long val)18797c478bd9Sstevel@tonic-gate prt_skv(private_t *pri, int raw, long val)
18807c478bd9Sstevel@tonic-gate {
18817c478bd9Sstevel@tonic-gate switch (val) {
18827c478bd9Sstevel@tonic-gate case SOV_STREAM: outstring(pri, "SOV_STREAM"); break;
18837c478bd9Sstevel@tonic-gate case SOV_DEFAULT: outstring(pri, "SOV_DEFAULT"); break;
18847c478bd9Sstevel@tonic-gate case SOV_SOCKSTREAM: outstring(pri, "SOV_SOCKSTREAM"); break;
18857c478bd9Sstevel@tonic-gate case SOV_SOCKBSD: outstring(pri, "SOV_SOCKBSD"); break;
18867c478bd9Sstevel@tonic-gate case SOV_XPG4_2: outstring(pri, "SOV_XPG4_2"); break;
18877c478bd9Sstevel@tonic-gate default: prt_dec(pri, 0, val); break;
18887c478bd9Sstevel@tonic-gate }
18897c478bd9Sstevel@tonic-gate }
18907c478bd9Sstevel@tonic-gate
18915dbfd19aSTheo Schlossnagle /*
18925dbfd19aSTheo Schlossnagle * Print accept4() flags argument.
18935dbfd19aSTheo Schlossnagle */
18945dbfd19aSTheo Schlossnagle void
prt_acf(private_t * pri,int raw,long val)18955dbfd19aSTheo Schlossnagle prt_acf(private_t *pri, int raw, long val)
18965dbfd19aSTheo Schlossnagle {
18975dbfd19aSTheo Schlossnagle int first = 1;
18985dbfd19aSTheo Schlossnagle if (raw || !val ||
18995dbfd19aSTheo Schlossnagle (val & ~(SOCK_CLOEXEC|SOCK_NDELAY|SOCK_NONBLOCK))) {
19005dbfd19aSTheo Schlossnagle prt_dex(pri, 0, val);
19015dbfd19aSTheo Schlossnagle return;
19025dbfd19aSTheo Schlossnagle }
19035dbfd19aSTheo Schlossnagle
19045dbfd19aSTheo Schlossnagle if (val & SOCK_CLOEXEC) {
19055dbfd19aSTheo Schlossnagle outstring(pri, "|SOCK_CLOEXEC" + first);
19065dbfd19aSTheo Schlossnagle first = 0;
19075dbfd19aSTheo Schlossnagle }
19085dbfd19aSTheo Schlossnagle if (val & SOCK_NDELAY) {
19095dbfd19aSTheo Schlossnagle outstring(pri, "|SOCK_NDELAY" + first);
19105dbfd19aSTheo Schlossnagle first = 0;
19115dbfd19aSTheo Schlossnagle }
19125dbfd19aSTheo Schlossnagle if (val & SOCK_NONBLOCK) {
19135dbfd19aSTheo Schlossnagle outstring(pri, "|SOCK_NONBLOCK" + first);
19145dbfd19aSTheo Schlossnagle }
19155dbfd19aSTheo Schlossnagle }
19165dbfd19aSTheo Schlossnagle
19177c478bd9Sstevel@tonic-gate
19187c478bd9Sstevel@tonic-gate /*
19197c478bd9Sstevel@tonic-gate * Print setsockopt()/getsockopt() 2nd argument.
19207c478bd9Sstevel@tonic-gate */
19217c478bd9Sstevel@tonic-gate /*ARGSUSED*/
19227c478bd9Sstevel@tonic-gate void
prt_sol(private_t * pri,int raw,long val)19237c478bd9Sstevel@tonic-gate prt_sol(private_t *pri, int raw, long val)
19247c478bd9Sstevel@tonic-gate {
19257c478bd9Sstevel@tonic-gate if (val == SOL_SOCKET) {
19267c478bd9Sstevel@tonic-gate outstring(pri, "SOL_SOCKET");
1927e11c3f44Smeem } else if (val == SOL_ROUTE) {
1928e11c3f44Smeem outstring(pri, "SOL_ROUTE");
19297c478bd9Sstevel@tonic-gate } else {
19307c478bd9Sstevel@tonic-gate const struct protoent *p;
19317c478bd9Sstevel@tonic-gate struct protoent res;
19327c478bd9Sstevel@tonic-gate char buf[NSS_BUFLEN_PROTOCOLS];
19337c478bd9Sstevel@tonic-gate
19347c478bd9Sstevel@tonic-gate if ((p = getprotobynumber_r(val, &res,
19357c478bd9Sstevel@tonic-gate (char *)buf, sizeof (buf))) != NULL)
19367c478bd9Sstevel@tonic-gate outstring(pri, p->p_name);
19377c478bd9Sstevel@tonic-gate else
19387c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
19397c478bd9Sstevel@tonic-gate }
19407c478bd9Sstevel@tonic-gate }
19417c478bd9Sstevel@tonic-gate
19427c478bd9Sstevel@tonic-gate
19437c478bd9Sstevel@tonic-gate const char *
sol_optname(private_t * pri,long val)19447c478bd9Sstevel@tonic-gate sol_optname(private_t *pri, long val)
19457c478bd9Sstevel@tonic-gate {
19467c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
19477c478bd9Sstevel@tonic-gate if (val >= SO_SNDBUF) {
19487c478bd9Sstevel@tonic-gate switch (val) {
19497c478bd9Sstevel@tonic-gate case SO_SNDBUF: return ("SO_SNDBUF");
19507c478bd9Sstevel@tonic-gate case SO_RCVBUF: return ("SO_RCVBUF");
19517c478bd9Sstevel@tonic-gate case SO_SNDLOWAT: return ("SO_SNDLOWAT");
19527c478bd9Sstevel@tonic-gate case SO_RCVLOWAT: return ("SO_RCVLOWAT");
19537c478bd9Sstevel@tonic-gate case SO_SNDTIMEO: return ("SO_SNDTIMEO");
19547c478bd9Sstevel@tonic-gate case SO_RCVTIMEO: return ("SO_RCVTIMEO");
19557c478bd9Sstevel@tonic-gate case SO_ERROR: return ("SO_ERROR");
19567c478bd9Sstevel@tonic-gate case SO_TYPE: return ("SO_TYPE");
19577c478bd9Sstevel@tonic-gate case SO_PROTOTYPE: return ("SO_PROTOTYPE");
19587b564b02SJarrett Lu case SO_ANON_MLP: return ("SO_ANON_MLP");
19597b564b02SJarrett Lu case SO_MAC_EXEMPT: return ("SO_MAC_EXEMPT");
19605d0bc3edSsommerfe case SO_ALLZONES: return ("SO_ALLZONES");
19615d3b8cb7SBill Sommerfeld case SO_MAC_IMPLICIT: return ("SO_MAC_IMPLICIT");
19621cb875aeSCathy Zhou case SO_VRRP: return ("SO_VRRP");
1963ae347574Skcpoon case SO_EXCLBIND: return ("SO_EXCLBIND");
196488cda078Skcpoon case SO_DOMAIN: return ("SO_DOMAIN");
19657c478bd9Sstevel@tonic-gate
19667c478bd9Sstevel@tonic-gate default: (void) snprintf(pri->code_buf, CBSIZE,
1967fac3008cSeschrock "0x%lx", val);
19687c478bd9Sstevel@tonic-gate return (pri->code_buf);
19697c478bd9Sstevel@tonic-gate }
19707c478bd9Sstevel@tonic-gate } else {
19717c478bd9Sstevel@tonic-gate char *s = pri->code_buf;
19727c478bd9Sstevel@tonic-gate size_t used = 1;
19737c478bd9Sstevel@tonic-gate long val2;
19747c478bd9Sstevel@tonic-gate
19757c478bd9Sstevel@tonic-gate *s = '\0';
19767c478bd9Sstevel@tonic-gate val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE|
19777c478bd9Sstevel@tonic-gate SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER|
19787c478bd9Sstevel@tonic-gate SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED);
19797c478bd9Sstevel@tonic-gate if (val2)
19807c478bd9Sstevel@tonic-gate used = snprintf(s, CBSIZE, "|0x%lx", val2);
19817c478bd9Sstevel@tonic-gate if (val & SO_DEBUG)
19827c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_DEBUG", CBSIZE);
19837c478bd9Sstevel@tonic-gate if (val & SO_ACCEPTCONN)
19847c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE);
19857c478bd9Sstevel@tonic-gate if (val & SO_REUSEADDR)
19867c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_REUSEADDR", CBSIZE);
19877c478bd9Sstevel@tonic-gate if (val & SO_KEEPALIVE)
19887c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_KEEPALIVE", CBSIZE);
19897c478bd9Sstevel@tonic-gate if (val & SO_DONTROUTE)
19907c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_DONTROUTE", CBSIZE);
19917c478bd9Sstevel@tonic-gate if (val & SO_BROADCAST)
19927c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_BROADCAST", CBSIZE);
19937c478bd9Sstevel@tonic-gate if (val & SO_USELOOPBACK)
19947c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_USELOOPBACK", CBSIZE);
19957c478bd9Sstevel@tonic-gate if (val & SO_LINGER)
19967c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_LINGER", CBSIZE);
19977c478bd9Sstevel@tonic-gate if (val & SO_OOBINLINE)
19987c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_OOBINLINE", CBSIZE);
19997c478bd9Sstevel@tonic-gate if (val & SO_DGRAM_ERRIND)
20007c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE);
20017c478bd9Sstevel@tonic-gate if (val & SO_RECVUCRED)
20027c478bd9Sstevel@tonic-gate used = strlcat(s, "|SO_RECVUCRED", CBSIZE);
20037c478bd9Sstevel@tonic-gate if (used >= CBSIZE || val == 0)
20047c478bd9Sstevel@tonic-gate (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
20057c478bd9Sstevel@tonic-gate return ((const char *)(s + 1));
20067c478bd9Sstevel@tonic-gate }
20077c478bd9Sstevel@tonic-gate #undef CBSIZE
20087c478bd9Sstevel@tonic-gate }
20097c478bd9Sstevel@tonic-gate
2010e11c3f44Smeem const char *
route_optname(private_t * pri,long val)2011e11c3f44Smeem route_optname(private_t *pri, long val)
2012e11c3f44Smeem {
2013e11c3f44Smeem switch (val) {
2014e11c3f44Smeem case RT_AWARE:
2015e11c3f44Smeem return ("RT_AWARE");
2016e11c3f44Smeem default:
2017e11c3f44Smeem (void) snprintf(pri->code_buf, sizeof (pri->code_buf),
2018e11c3f44Smeem "0x%lx", val);
2019e11c3f44Smeem return (pri->code_buf);
2020e11c3f44Smeem }
2021e11c3f44Smeem }
20227c478bd9Sstevel@tonic-gate
20237c478bd9Sstevel@tonic-gate const char *
tcp_optname(private_t * pri,long val)20247c478bd9Sstevel@tonic-gate tcp_optname(private_t *pri, long val)
20257c478bd9Sstevel@tonic-gate {
20267c478bd9Sstevel@tonic-gate switch (val) {
20277c478bd9Sstevel@tonic-gate case TCP_NODELAY: return ("TCP_NODELAY");
20287c478bd9Sstevel@tonic-gate case TCP_MAXSEG: return ("TCP_MAXSEG");
20297c478bd9Sstevel@tonic-gate case TCP_KEEPALIVE: return ("TCP_KEEPALIVE");
20307c478bd9Sstevel@tonic-gate case TCP_NOTIFY_THRESHOLD: return ("TCP_NOTIFY_THRESHOLD");
20317c478bd9Sstevel@tonic-gate case TCP_ABORT_THRESHOLD: return ("TCP_ABORT_THRESHOLD");
20327c478bd9Sstevel@tonic-gate case TCP_CONN_NOTIFY_THRESHOLD: return ("TCP_CONN_NOTIFY_THRESHOLD");
20337c478bd9Sstevel@tonic-gate case TCP_CONN_ABORT_THRESHOLD: return ("TCP_CONN_ABORT_THRESHOLD");
20347c478bd9Sstevel@tonic-gate case TCP_RECVDSTADDR: return ("TCP_RECVDSTADDR");
20357c478bd9Sstevel@tonic-gate case TCP_ANONPRIVBIND: return ("TCP_ANONPRIVBIND");
20367c478bd9Sstevel@tonic-gate case TCP_EXCLBIND: return ("TCP_EXCLBIND");
2037898479dbSkcpoon case TCP_INIT_CWND: return ("TCP_INIT_CWND");
2038898479dbSkcpoon case TCP_KEEPALIVE_THRESHOLD: return ("TCP_KEEPALIVE_THRESHOLD");
2039898479dbSkcpoon case TCP_KEEPALIVE_ABORT_THRESHOLD:
2040898479dbSkcpoon return ("TCP_KEEPALIVE_ABORT_THRESHOLD");
2041898479dbSkcpoon case TCP_CORK: return ("TCP_CORK");
2042707e74bcSKacheong Poon case TCP_RTO_INITIAL: return ("TCP_RTO_INITIAL");
2043707e74bcSKacheong Poon case TCP_RTO_MIN: return ("TCP_RTO_MIN");
2044707e74bcSKacheong Poon case TCP_RTO_MAX: return ("TCP_RTO_MAX");
2045707e74bcSKacheong Poon case TCP_LINGER2: return ("TCP_LINGER2");
2046020c6b3eSMohamed A. Khalfella case TCP_KEEPIDLE: return ("TCP_KEEPIDLE");
2047020c6b3eSMohamed A. Khalfella case TCP_KEEPCNT: return ("TCP_KEEPCNT");
2048020c6b3eSMohamed A. Khalfella case TCP_KEEPINTVL: return ("TCP_KEEPINTVL");
2049d4994511SCody Peter Mello case TCP_CONGESTION: return ("TCP_CONGESTION");
20507c478bd9Sstevel@tonic-gate
20517c478bd9Sstevel@tonic-gate default: (void) snprintf(pri->code_buf,
20527c478bd9Sstevel@tonic-gate sizeof (pri->code_buf),
20537c478bd9Sstevel@tonic-gate "0x%lx", val);
20547c478bd9Sstevel@tonic-gate return (pri->code_buf);
20557c478bd9Sstevel@tonic-gate }
20567c478bd9Sstevel@tonic-gate }
20577c478bd9Sstevel@tonic-gate
20587c478bd9Sstevel@tonic-gate
20597c478bd9Sstevel@tonic-gate const char *
sctp_optname(private_t * pri,long val)20607c478bd9Sstevel@tonic-gate sctp_optname(private_t *pri, long val)
20617c478bd9Sstevel@tonic-gate {
20627c478bd9Sstevel@tonic-gate switch (val) {
20637c478bd9Sstevel@tonic-gate case SCTP_RTOINFO: return ("SCTP_RTOINFO");
20647c478bd9Sstevel@tonic-gate case SCTP_ASSOCINFO: return ("SCTP_ASSOCINFO");
20657c478bd9Sstevel@tonic-gate case SCTP_INITMSG: return ("SCTP_INITMSG");
20667c478bd9Sstevel@tonic-gate case SCTP_NODELAY: return ("SCTP_NODELAY");
20677c478bd9Sstevel@tonic-gate case SCTP_AUTOCLOSE: return ("SCTP_AUTOCLOSE");
20687c478bd9Sstevel@tonic-gate case SCTP_SET_PEER_PRIMARY_ADDR:
20697c478bd9Sstevel@tonic-gate return ("SCTP_SET_PEER_PRIMARY_ADDR");
20707c478bd9Sstevel@tonic-gate case SCTP_PRIMARY_ADDR: return ("SCTP_PRIMARY_ADDR");
2071558fbd03Skcpoon case SCTP_ADAPTATION_LAYER: return ("SCTP_ADAPTATION_LAYER");
20727c478bd9Sstevel@tonic-gate case SCTP_DISABLE_FRAGMENTS: return ("SCTP_DISABLE_FRAGMENTS");
20737c478bd9Sstevel@tonic-gate case SCTP_PEER_ADDR_PARAMS: return ("SCTP_PEER_ADDR_PARAMS");
20747c478bd9Sstevel@tonic-gate case SCTP_DEFAULT_SEND_PARAM: return ("SCTP_DEFAULT_SEND_PARAM");
20757c478bd9Sstevel@tonic-gate case SCTP_EVENTS: return ("SCTP_EVENTS");
20767c478bd9Sstevel@tonic-gate case SCTP_I_WANT_MAPPED_V4_ADDR:
20777c478bd9Sstevel@tonic-gate return ("SCTP_I_WANT_MAPPED_V4_ADDR");
20787c478bd9Sstevel@tonic-gate case SCTP_MAXSEG: return ("SCTP_MAXSEG");
20797c478bd9Sstevel@tonic-gate case SCTP_STATUS: return ("SCTP_STATUS");
20807c478bd9Sstevel@tonic-gate case SCTP_GET_PEER_ADDR_INFO: return ("SCTP_GET_PEER_ADDR_INFO");
20817c478bd9Sstevel@tonic-gate
20827c478bd9Sstevel@tonic-gate case SCTP_ADD_ADDR: return ("SCTP_ADD_ADDR");
20837c478bd9Sstevel@tonic-gate case SCTP_REM_ADDR: return ("SCTP_REM_ADDR");
20847c478bd9Sstevel@tonic-gate
20857c478bd9Sstevel@tonic-gate default: (void) snprintf(pri->code_buf,
20867c478bd9Sstevel@tonic-gate sizeof (pri->code_buf),
20877c478bd9Sstevel@tonic-gate "0x%lx", val);
20887c478bd9Sstevel@tonic-gate return (pri->code_buf);
20897c478bd9Sstevel@tonic-gate }
20907c478bd9Sstevel@tonic-gate }
20917c478bd9Sstevel@tonic-gate
20927c478bd9Sstevel@tonic-gate
20937c478bd9Sstevel@tonic-gate const char *
udp_optname(private_t * pri,long val)20947c478bd9Sstevel@tonic-gate udp_optname(private_t *pri, long val)
20957c478bd9Sstevel@tonic-gate {
2096898479dbSkcpoon switch (val) {
2097898479dbSkcpoon case UDP_CHECKSUM: return ("UDP_CHECKSUM");
2098898479dbSkcpoon case UDP_ANONPRIVBIND: return ("UDP_ANONPRIVBIND");
2099898479dbSkcpoon case UDP_EXCLBIND: return ("UDP_EXCLBIND");
2100898479dbSkcpoon case UDP_RCVHDR: return ("UDP_RCVHDR");
2101437220cdSdanmcd case UDP_NAT_T_ENDPOINT: return ("UDP_NAT_T_ENDPOINT");
21023e8b6b84SRobert Mustacchi case UDP_SRCPORT_HASH: return ("UDP_SRCPORT_HASH");
21037c478bd9Sstevel@tonic-gate
2104898479dbSkcpoon default: (void) snprintf(pri->code_buf,
2105898479dbSkcpoon sizeof (pri->code_buf), "0x%lx",
2106898479dbSkcpoon val);
2107898479dbSkcpoon return (pri->code_buf);
2108898479dbSkcpoon }
21097c478bd9Sstevel@tonic-gate }
21107c478bd9Sstevel@tonic-gate
21117c478bd9Sstevel@tonic-gate
21125fcf5f87SRobert Mustacchi const char *
ip_optname(private_t * pri,long val)21135fcf5f87SRobert Mustacchi ip_optname(private_t *pri, long val)
21145fcf5f87SRobert Mustacchi {
21155fcf5f87SRobert Mustacchi switch (val) {
21165fcf5f87SRobert Mustacchi case IP_OPTIONS: return ("IP_OPTIONS");
21175fcf5f87SRobert Mustacchi case IP_HDRINCL: return ("IP_HDRINCL");
21185fcf5f87SRobert Mustacchi case IP_TOS: return ("IP_TOS");
21195fcf5f87SRobert Mustacchi case IP_TTL: return ("IP_TTL");
21205fcf5f87SRobert Mustacchi case IP_RECVOPTS: return ("IP_RECVOPTS");
21215fcf5f87SRobert Mustacchi case IP_RECVRETOPTS: return ("IP_RECVRETOPTS");
21225fcf5f87SRobert Mustacchi case IP_RECVDSTADDR: return ("IP_RECVDSTADDR");
21235fcf5f87SRobert Mustacchi case IP_RETOPTS: return ("IP_RETOPTS");
21245fcf5f87SRobert Mustacchi case IP_RECVIF: return ("IP_RECVIF");
21255fcf5f87SRobert Mustacchi case IP_RECVSLLA: return ("IP_RECVSLLA");
21265fcf5f87SRobert Mustacchi case IP_RECVTTL: return ("IP_RECVTTL");
21275fcf5f87SRobert Mustacchi case IP_RECVTOS: return ("IP_RECVTOS");
21285fcf5f87SRobert Mustacchi case IP_MULTICAST_IF: return ("IP_MULTICAST_IF");
21295fcf5f87SRobert Mustacchi case IP_MULTICAST_TTL: return ("IP_MULTICAST_TTL");
21305fcf5f87SRobert Mustacchi case IP_MULTICAST_LOOP: return ("IP_MULTICAST_LOOP");
21315fcf5f87SRobert Mustacchi case IP_ADD_MEMBERSHIP: return ("IP_ADD_MEMBERSHIP");
21325fcf5f87SRobert Mustacchi case IP_DROP_MEMBERSHIP: return ("IP_DROP_MEMBERSHIP");
21335fcf5f87SRobert Mustacchi case IP_BLOCK_SOURCE: return ("IP_BLOCK_SOURCE");
21345fcf5f87SRobert Mustacchi case IP_UNBLOCK_SOURCE: return ("IP_UNBLOCK_SOURCE");
21355fcf5f87SRobert Mustacchi case IP_ADD_SOURCE_MEMBERSHIP: return ("IP_ADD_SOURCE_MEMBERSHIP");
21365fcf5f87SRobert Mustacchi case IP_DROP_SOURCE_MEMBERSHIP: return ("IP_DROP_SOURCE_MEMBERSHIP");
21375fcf5f87SRobert Mustacchi case IP_NEXTHOP: return ("IP_NEXTHOP");
21385fcf5f87SRobert Mustacchi /* IP_PKTINFO and IP_RECVPKTINFO share the same code */
21395fcf5f87SRobert Mustacchi case IP_PKTINFO: return ("IP_PKTINFO/IP_RECVPKTINFO");
21405fcf5f87SRobert Mustacchi case IP_DONTFRAG: return ("IP_DONTFRAG");
21415fcf5f87SRobert Mustacchi case IP_SEC_OPT: return ("IP_SEC_OPT");
21425fcf5f87SRobert Mustacchi case MCAST_JOIN_GROUP: return ("MCAST_JOIN_GROUP");
21435fcf5f87SRobert Mustacchi case MCAST_LEAVE_GROUP: return ("MCAST_LEAVE_GROUP");
21445fcf5f87SRobert Mustacchi case MCAST_BLOCK_SOURCE: return ("MCAST_BLOCK_SOURCE");
21455fcf5f87SRobert Mustacchi case MCAST_UNBLOCK_SOURCE: return ("MCAST_UNBLOCK_SOURCE");
21465fcf5f87SRobert Mustacchi case MCAST_JOIN_SOURCE_GROUP: return ("MCAST_JOIN_SOURCE_GROUP");
21475fcf5f87SRobert Mustacchi case MCAST_LEAVE_SOURCE_GROUP: return ("MCAST_LEAVE_SOURCE_GROUP");
21485fcf5f87SRobert Mustacchi case MRT_INIT: return ("MRT_INIT");
21495fcf5f87SRobert Mustacchi case MRT_DONE: return ("MRT_DONE");
21505fcf5f87SRobert Mustacchi case MRT_ADD_VIF: return ("MRT_ADD_VIF");
21515fcf5f87SRobert Mustacchi case MRT_DEL_VIF: return ("MRT_DEL_VIF");
21525fcf5f87SRobert Mustacchi case MRT_ADD_MFC: return ("MRT_ADD_MFC");
21535fcf5f87SRobert Mustacchi case MRT_DEL_MFC: return ("MRT_DEL_MFC");
21545fcf5f87SRobert Mustacchi case MRT_VERSION: return ("MRT_VERSION");
21555fcf5f87SRobert Mustacchi case MRT_ASSERT: return ("MRT_ASSERT");
21565fcf5f87SRobert Mustacchi case IP_BOUND_IF: return ("IP_BOUND_IF");
21575fcf5f87SRobert Mustacchi case IP_UNSPEC_SRC: return ("IP_UNSPEC_SRC");
21585fcf5f87SRobert Mustacchi case IP_BROADCAST_TTL: return ("IP_BROADCAST_TTL");
21595fcf5f87SRobert Mustacchi case IP_DHCPINIT_IF: return ("IP_DHCPINIT_IF");
21605fcf5f87SRobert Mustacchi case IP_REUSEADDR: return ("IP_REUSEADDR");
21615fcf5f87SRobert Mustacchi case IP_DONTROUTE: return ("IP_DONTROUTE");
21625fcf5f87SRobert Mustacchi case IP_BROADCAST: return ("IP_BROADCAST");
21635fcf5f87SRobert Mustacchi
21645fcf5f87SRobert Mustacchi default: (void) snprintf(pri->code_buf,
21655fcf5f87SRobert Mustacchi sizeof (pri->code_buf), "0x%lx",
21665fcf5f87SRobert Mustacchi val);
21675fcf5f87SRobert Mustacchi return (pri->code_buf);
21685fcf5f87SRobert Mustacchi }
21695fcf5f87SRobert Mustacchi }
21705fcf5f87SRobert Mustacchi
21715fcf5f87SRobert Mustacchi const char *
ipv6_optname(private_t * pri,long val)21725fcf5f87SRobert Mustacchi ipv6_optname(private_t *pri, long val)
21735fcf5f87SRobert Mustacchi {
21745fcf5f87SRobert Mustacchi switch (val) {
21755fcf5f87SRobert Mustacchi case IPV6_UNICAST_HOPS: return ("IPV6_UNICAST_HOPS");
21765fcf5f87SRobert Mustacchi case IPV6_MULTICAST_IF: return ("IPV6_MULTICAST_IF");
21775fcf5f87SRobert Mustacchi case IPV6_MULTICAST_HOPS: return ("IPV6_MULTICAST_HOPS");
21785fcf5f87SRobert Mustacchi case IPV6_MULTICAST_LOOP: return ("IPV6_MULTICAST_LOOP");
21795fcf5f87SRobert Mustacchi case IPV6_JOIN_GROUP: return ("IPV6_JOIN_GROUP");
21805fcf5f87SRobert Mustacchi case IPV6_LEAVE_GROUP: return ("IPV6_LEAVE_GROUP");
21815fcf5f87SRobert Mustacchi case IPV6_PKTINFO: return ("IPV6_PKTINFO");
21825fcf5f87SRobert Mustacchi case IPV6_HOPLIMIT: return ("IPV6_HOPLIMIT");
21835fcf5f87SRobert Mustacchi case IPV6_NEXTHOP: return ("IPV6_NEXTHOP");
21845fcf5f87SRobert Mustacchi case IPV6_HOPOPTS: return ("IPV6_HOPOPTS");
21855fcf5f87SRobert Mustacchi case IPV6_DSTOPTS: return ("IPV6_DSTOPTS");
21865fcf5f87SRobert Mustacchi case IPV6_RTHDR: return ("IPV6_RTHDR");
21875fcf5f87SRobert Mustacchi case IPV6_RTHDRDSTOPTS: return ("IPV6_RTHDRDSTOPTS");
21885fcf5f87SRobert Mustacchi case IPV6_RECVPKTINFO: return ("IPV6_RECVPKTINFO");
21895fcf5f87SRobert Mustacchi case IPV6_RECVHOPLIMIT: return ("IPV6_RECVHOPLIMIT");
21905fcf5f87SRobert Mustacchi case IPV6_RECVHOPOPTS: return ("IPV6_RECVHOPOPTS");
21915fcf5f87SRobert Mustacchi case _OLD_IPV6_RECVDSTOPTS: return ("_OLD_IPV6_RECVDSTOPTS");
21925fcf5f87SRobert Mustacchi case IPV6_RECVRTHDR: return ("IPV6_RECVRTHDR");
21935fcf5f87SRobert Mustacchi case IPV6_RECVRTHDRDSTOPTS: return ("IPV6_RECVRTHDRDSTOPTS");
21945fcf5f87SRobert Mustacchi case IPV6_CHECKSUM: return ("IPV6_CHECKSUM");
21955fcf5f87SRobert Mustacchi case IPV6_RECVTCLASS: return ("IPV6_RECVTCLASS");
21965fcf5f87SRobert Mustacchi case IPV6_USE_MIN_MTU: return ("IPV6_USE_MIN_MTU");
21975fcf5f87SRobert Mustacchi case IPV6_DONTFRAG: return ("IPV6_DONTFRAG");
21985fcf5f87SRobert Mustacchi case IPV6_SEC_OPT: return ("IPV6_SEC_OPT");
21995fcf5f87SRobert Mustacchi case IPV6_SRC_PREFERENCES: return ("IPV6_SRC_PREFERENCES");
22005fcf5f87SRobert Mustacchi case IPV6_RECVPATHMTU: return ("IPV6_RECVPATHMTU");
22015fcf5f87SRobert Mustacchi case IPV6_PATHMTU: return ("IPV6_PATHMTU");
22025fcf5f87SRobert Mustacchi case IPV6_TCLASS: return ("IPV6_TCLASS");
22035fcf5f87SRobert Mustacchi case IPV6_V6ONLY: return ("IPV6_V6ONLY");
22045fcf5f87SRobert Mustacchi case IPV6_RECVDSTOPTS: return ("IPV6_RECVDSTOPTS");
22055fcf5f87SRobert Mustacchi case MCAST_JOIN_GROUP: return ("MCAST_JOIN_GROUP");
22065fcf5f87SRobert Mustacchi case MCAST_LEAVE_GROUP: return ("MCAST_LEAVE_GROUP");
22075fcf5f87SRobert Mustacchi case MCAST_BLOCK_SOURCE: return ("MCAST_BLOCK_SOURCE");
22085fcf5f87SRobert Mustacchi case MCAST_UNBLOCK_SOURCE: return ("MCAST_UNBLOCK_SOURCE");
22095fcf5f87SRobert Mustacchi case MCAST_JOIN_SOURCE_GROUP: return ("MCAST_JOIN_SOURCE_GROUP");
22105fcf5f87SRobert Mustacchi case MCAST_LEAVE_SOURCE_GROUP: return ("MCAST_LEAVE_SOURCE_GROUP");
22115fcf5f87SRobert Mustacchi
22125fcf5f87SRobert Mustacchi default: (void) snprintf(pri->code_buf,
22135fcf5f87SRobert Mustacchi sizeof (pri->code_buf), "0x%lx",
22145fcf5f87SRobert Mustacchi val);
22155fcf5f87SRobert Mustacchi return (pri->code_buf);
22165fcf5f87SRobert Mustacchi }
22175fcf5f87SRobert Mustacchi }
22185fcf5f87SRobert Mustacchi
22195fcf5f87SRobert Mustacchi
22205fcf5f87SRobert Mustacchi const char *
icmpv6_optname(private_t * pri,long val)22215fcf5f87SRobert Mustacchi icmpv6_optname(private_t *pri, long val)
22225fcf5f87SRobert Mustacchi {
22235fcf5f87SRobert Mustacchi switch (val) {
22245fcf5f87SRobert Mustacchi case ICMP6_FILTER: return ("ICMP6_FILTER");
22255fcf5f87SRobert Mustacchi default: (void) snprintf(pri->code_buf,
22265fcf5f87SRobert Mustacchi sizeof (pri->code_buf), "0x%lx",
22275fcf5f87SRobert Mustacchi val);
22285fcf5f87SRobert Mustacchi return (pri->code_buf);
22295fcf5f87SRobert Mustacchi }
22305fcf5f87SRobert Mustacchi }
22315fcf5f87SRobert Mustacchi
22325fcf5f87SRobert Mustacchi
22337c478bd9Sstevel@tonic-gate /*
22347c478bd9Sstevel@tonic-gate * Print setsockopt()/getsockopt() 3rd argument.
22357c478bd9Sstevel@tonic-gate */
22367c478bd9Sstevel@tonic-gate /*ARGSUSED*/
22377c478bd9Sstevel@tonic-gate void
prt_son(private_t * pri,int raw,long val)22387c478bd9Sstevel@tonic-gate prt_son(private_t *pri, int raw, long val)
22397c478bd9Sstevel@tonic-gate {
22407c478bd9Sstevel@tonic-gate /* cheating -- look at the level */
22417c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) {
22427c478bd9Sstevel@tonic-gate case SOL_SOCKET: outstring(pri, sol_optname(pri, val));
22437c478bd9Sstevel@tonic-gate break;
2244e11c3f44Smeem case SOL_ROUTE: outstring(pri, route_optname(pri, val));
2245e11c3f44Smeem break;
22465fcf5f87SRobert Mustacchi case IPPROTO_IP: outstring(pri, ip_optname(pri, val));
22475fcf5f87SRobert Mustacchi break;
22485fcf5f87SRobert Mustacchi case IPPROTO_IPV6: outstring(pri, ipv6_optname(pri, val));
22495fcf5f87SRobert Mustacchi break;
22505fcf5f87SRobert Mustacchi case IPPROTO_ICMPV6: outstring(pri, icmpv6_optname(pri, val));
22515fcf5f87SRobert Mustacchi break;
22527c478bd9Sstevel@tonic-gate case IPPROTO_TCP: outstring(pri, tcp_optname(pri, val));
22537c478bd9Sstevel@tonic-gate break;
22547c478bd9Sstevel@tonic-gate case IPPROTO_UDP: outstring(pri, udp_optname(pri, val));
22557c478bd9Sstevel@tonic-gate break;
22567c478bd9Sstevel@tonic-gate case IPPROTO_SCTP: outstring(pri, sctp_optname(pri, val));
22577c478bd9Sstevel@tonic-gate break;
22587c478bd9Sstevel@tonic-gate default: prt_dec(pri, 0, val);
22597c478bd9Sstevel@tonic-gate break;
22607c478bd9Sstevel@tonic-gate }
22617c478bd9Sstevel@tonic-gate }
22627c478bd9Sstevel@tonic-gate
22637c478bd9Sstevel@tonic-gate
22647c478bd9Sstevel@tonic-gate /*
22657c478bd9Sstevel@tonic-gate * Print utrap type
22667c478bd9Sstevel@tonic-gate */
22677c478bd9Sstevel@tonic-gate /*ARGSUSED*/
22687c478bd9Sstevel@tonic-gate void
prt_utt(private_t * pri,int raw,long val)22697c478bd9Sstevel@tonic-gate prt_utt(private_t *pri, int raw, long val)
22707c478bd9Sstevel@tonic-gate {
22717c478bd9Sstevel@tonic-gate const char *s = NULL;
22727c478bd9Sstevel@tonic-gate
22737c478bd9Sstevel@tonic-gate #ifdef __sparc
22747c478bd9Sstevel@tonic-gate if (!raw) {
22757c478bd9Sstevel@tonic-gate switch (val) {
22767c478bd9Sstevel@tonic-gate case UT_INSTRUCTION_DISABLED:
22777c478bd9Sstevel@tonic-gate s = "UT_INSTRUCTION_DISABLED"; break;
22787c478bd9Sstevel@tonic-gate case UT_INSTRUCTION_ERROR:
22797c478bd9Sstevel@tonic-gate s = "UT_INSTRUCTION_ERROR"; break;
22807c478bd9Sstevel@tonic-gate case UT_INSTRUCTION_PROTECTION:
22817c478bd9Sstevel@tonic-gate s = "UT_INSTRUCTION_PROTECTION"; break;
22827c478bd9Sstevel@tonic-gate case UT_ILLTRAP_INSTRUCTION:
22837c478bd9Sstevel@tonic-gate s = "UT_ILLTRAP_INSTRUCTION"; break;
22847c478bd9Sstevel@tonic-gate case UT_ILLEGAL_INSTRUCTION:
22857c478bd9Sstevel@tonic-gate s = "UT_ILLEGAL_INSTRUCTION"; break;
22867c478bd9Sstevel@tonic-gate case UT_PRIVILEGED_OPCODE:
22877c478bd9Sstevel@tonic-gate s = "UT_PRIVILEGED_OPCODE"; break;
22887c478bd9Sstevel@tonic-gate case UT_FP_DISABLED:
22897c478bd9Sstevel@tonic-gate s = "UT_FP_DISABLED"; break;
22907c478bd9Sstevel@tonic-gate case UT_FP_EXCEPTION_IEEE_754:
22917c478bd9Sstevel@tonic-gate s = "UT_FP_EXCEPTION_IEEE_754"; break;
22927c478bd9Sstevel@tonic-gate case UT_FP_EXCEPTION_OTHER:
22937c478bd9Sstevel@tonic-gate s = "UT_FP_EXCEPTION_OTHER"; break;
22947c478bd9Sstevel@tonic-gate case UT_TAG_OVERFLOW:
22957c478bd9Sstevel@tonic-gate s = "UT_TAG_OVERFLOW"; break;
22967c478bd9Sstevel@tonic-gate case UT_DIVISION_BY_ZERO:
22977c478bd9Sstevel@tonic-gate s = "UT_DIVISION_BY_ZERO"; break;
22987c478bd9Sstevel@tonic-gate case UT_DATA_EXCEPTION:
22997c478bd9Sstevel@tonic-gate s = "UT_DATA_EXCEPTION"; break;
23007c478bd9Sstevel@tonic-gate case UT_DATA_ERROR:
23017c478bd9Sstevel@tonic-gate s = "UT_DATA_ERROR"; break;
23027c478bd9Sstevel@tonic-gate case UT_DATA_PROTECTION:
23037c478bd9Sstevel@tonic-gate s = "UT_DATA_PROTECTION"; break;
23047c478bd9Sstevel@tonic-gate case UT_MEM_ADDRESS_NOT_ALIGNED:
23057c478bd9Sstevel@tonic-gate s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break;
23067c478bd9Sstevel@tonic-gate case UT_PRIVILEGED_ACTION:
23077c478bd9Sstevel@tonic-gate s = "UT_PRIVILEGED_ACTION"; break;
23087c478bd9Sstevel@tonic-gate case UT_ASYNC_DATA_ERROR:
23097c478bd9Sstevel@tonic-gate s = "UT_ASYNC_DATA_ERROR"; break;
23107c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_16:
23117c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_16"; break;
23127c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_17:
23137c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_17"; break;
23147c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_18:
23157c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_18"; break;
23167c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_19:
23177c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_19"; break;
23187c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_20:
23197c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_20"; break;
23207c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_21:
23217c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_21"; break;
23227c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_22:
23237c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_22"; break;
23247c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_23:
23257c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_23"; break;
23267c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_24:
23277c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_24"; break;
23287c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_25:
23297c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_25"; break;
23307c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_26:
23317c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_26"; break;
23327c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_27:
23337c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_27"; break;
23347c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_28:
23357c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_28"; break;
23367c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_29:
23377c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_29"; break;
23387c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_30:
23397c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_30"; break;
23407c478bd9Sstevel@tonic-gate case UT_TRAP_INSTRUCTION_31:
23417c478bd9Sstevel@tonic-gate s = "UT_TRAP_INSTRUCTION_31"; break;
23427c478bd9Sstevel@tonic-gate }
23437c478bd9Sstevel@tonic-gate }
23447c478bd9Sstevel@tonic-gate #endif /* __sparc */
23457c478bd9Sstevel@tonic-gate
23467c478bd9Sstevel@tonic-gate if (s == NULL)
23477c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
23487c478bd9Sstevel@tonic-gate else
23497c478bd9Sstevel@tonic-gate outstring(pri, s);
23507c478bd9Sstevel@tonic-gate }
23517c478bd9Sstevel@tonic-gate
23527c478bd9Sstevel@tonic-gate
23537c478bd9Sstevel@tonic-gate /*
23547c478bd9Sstevel@tonic-gate * Print utrap handler
23557c478bd9Sstevel@tonic-gate */
23567c478bd9Sstevel@tonic-gate void
prt_uth(private_t * pri,int raw,long val)23577c478bd9Sstevel@tonic-gate prt_uth(private_t *pri, int raw, long val)
23587c478bd9Sstevel@tonic-gate {
23597c478bd9Sstevel@tonic-gate const char *s = NULL;
23607c478bd9Sstevel@tonic-gate
23617c478bd9Sstevel@tonic-gate if (!raw) {
23627c478bd9Sstevel@tonic-gate switch (val) {
23637c478bd9Sstevel@tonic-gate case (long)UTH_NOCHANGE: s = "UTH_NOCHANGE"; break;
23647c478bd9Sstevel@tonic-gate }
23657c478bd9Sstevel@tonic-gate }
23667c478bd9Sstevel@tonic-gate
23677c478bd9Sstevel@tonic-gate if (s == NULL)
23687c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
23697c478bd9Sstevel@tonic-gate else
23707c478bd9Sstevel@tonic-gate outstring(pri, s);
23717c478bd9Sstevel@tonic-gate }
23727c478bd9Sstevel@tonic-gate
23737c478bd9Sstevel@tonic-gate const char *
access_flags(private_t * pri,long arg)23747c478bd9Sstevel@tonic-gate access_flags(private_t *pri, long arg)
23757c478bd9Sstevel@tonic-gate {
23767c478bd9Sstevel@tonic-gate #define E_OK 010
23777c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
23787c478bd9Sstevel@tonic-gate
23797c478bd9Sstevel@tonic-gate if (arg & ~(R_OK|W_OK|X_OK|E_OK))
23807c478bd9Sstevel@tonic-gate return (NULL);
23817c478bd9Sstevel@tonic-gate
23827c478bd9Sstevel@tonic-gate /* NB: F_OK == 0 */
23837c478bd9Sstevel@tonic-gate if (arg == F_OK)
23847c478bd9Sstevel@tonic-gate return ("F_OK");
23857c478bd9Sstevel@tonic-gate if (arg == E_OK)
23867c478bd9Sstevel@tonic-gate return ("F_OK|E_OK");
23877c478bd9Sstevel@tonic-gate
23887c478bd9Sstevel@tonic-gate *str = '\0';
23897c478bd9Sstevel@tonic-gate if (arg & R_OK)
23907c478bd9Sstevel@tonic-gate (void) strlcat(str, "|R_OK", sizeof (pri->code_buf));
23917c478bd9Sstevel@tonic-gate if (arg & W_OK)
23927c478bd9Sstevel@tonic-gate (void) strlcat(str, "|W_OK", sizeof (pri->code_buf));
23937c478bd9Sstevel@tonic-gate if (arg & X_OK)
23947c478bd9Sstevel@tonic-gate (void) strlcat(str, "|X_OK", sizeof (pri->code_buf));
23957c478bd9Sstevel@tonic-gate if (arg & E_OK)
23967c478bd9Sstevel@tonic-gate (void) strlcat(str, "|E_OK", sizeof (pri->code_buf));
23977c478bd9Sstevel@tonic-gate return ((const char *)(str + 1));
23987c478bd9Sstevel@tonic-gate #undef E_OK
23997c478bd9Sstevel@tonic-gate }
24007c478bd9Sstevel@tonic-gate
24017c478bd9Sstevel@tonic-gate /*
24027c478bd9Sstevel@tonic-gate * Print access() flags.
24037c478bd9Sstevel@tonic-gate */
24047c478bd9Sstevel@tonic-gate void
prt_acc(private_t * pri,int raw,long val)24057c478bd9Sstevel@tonic-gate prt_acc(private_t *pri, int raw, long val)
24067c478bd9Sstevel@tonic-gate {
24077c478bd9Sstevel@tonic-gate const char *s = raw? NULL : access_flags(pri, val);
24087c478bd9Sstevel@tonic-gate
24097c478bd9Sstevel@tonic-gate if (s == NULL)
24107c478bd9Sstevel@tonic-gate prt_dex(pri, 0, val);
24117c478bd9Sstevel@tonic-gate else
24127c478bd9Sstevel@tonic-gate outstring(pri, s);
24137c478bd9Sstevel@tonic-gate }
24147c478bd9Sstevel@tonic-gate
24157c478bd9Sstevel@tonic-gate /*
24167c478bd9Sstevel@tonic-gate * Print shutdown() "how" (2nd) argument
24177c478bd9Sstevel@tonic-gate */
24187c478bd9Sstevel@tonic-gate void
prt_sht(private_t * pri,int raw,long val)24197c478bd9Sstevel@tonic-gate prt_sht(private_t *pri, int raw, long val)
24207c478bd9Sstevel@tonic-gate {
24217c478bd9Sstevel@tonic-gate if (raw) {
24227c478bd9Sstevel@tonic-gate prt_dex(pri, 0, val);
24237c478bd9Sstevel@tonic-gate return;
24247c478bd9Sstevel@tonic-gate }
24257c478bd9Sstevel@tonic-gate switch (val) {
24267c478bd9Sstevel@tonic-gate case SHUT_RD: outstring(pri, "SHUT_RD"); break;
24277c478bd9Sstevel@tonic-gate case SHUT_WR: outstring(pri, "SHUT_WR"); break;
24287c478bd9Sstevel@tonic-gate case SHUT_RDWR: outstring(pri, "SHUT_RDWR"); break;
24297c478bd9Sstevel@tonic-gate default: prt_dec(pri, 0, val); break;
24307c478bd9Sstevel@tonic-gate }
24317c478bd9Sstevel@tonic-gate }
24327c478bd9Sstevel@tonic-gate
24337c478bd9Sstevel@tonic-gate /*
24347c478bd9Sstevel@tonic-gate * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg)
24357c478bd9Sstevel@tonic-gate */
24367c478bd9Sstevel@tonic-gate static struct fcntl_flags {
24377c478bd9Sstevel@tonic-gate long val;
24387c478bd9Sstevel@tonic-gate const char *name;
24397c478bd9Sstevel@tonic-gate } fcntl_flags[] = {
24407c478bd9Sstevel@tonic-gate #define FC_FL(flag) { (long)flag, "|" # flag }
24417c478bd9Sstevel@tonic-gate FC_FL(FREVOKED),
24427c478bd9Sstevel@tonic-gate FC_FL(FREAD),
24437c478bd9Sstevel@tonic-gate FC_FL(FWRITE),
24447c478bd9Sstevel@tonic-gate FC_FL(FNDELAY),
24457c478bd9Sstevel@tonic-gate FC_FL(FAPPEND),
24467c478bd9Sstevel@tonic-gate FC_FL(FSYNC),
24477c478bd9Sstevel@tonic-gate FC_FL(FDSYNC),
24487c478bd9Sstevel@tonic-gate FC_FL(FRSYNC),
24497c478bd9Sstevel@tonic-gate FC_FL(FOFFMAX),
24507c478bd9Sstevel@tonic-gate FC_FL(FNONBLOCK),
24517c478bd9Sstevel@tonic-gate FC_FL(FCREAT),
24527c478bd9Sstevel@tonic-gate FC_FL(FTRUNC),
24537c478bd9Sstevel@tonic-gate FC_FL(FEXCL),
24547c478bd9Sstevel@tonic-gate FC_FL(FNOCTTY),
24557c478bd9Sstevel@tonic-gate FC_FL(FXATTR),
24567c478bd9Sstevel@tonic-gate FC_FL(FASYNC),
24577c478bd9Sstevel@tonic-gate FC_FL(FNODSYNC)
24587c478bd9Sstevel@tonic-gate #undef FC_FL
24597c478bd9Sstevel@tonic-gate };
24607c478bd9Sstevel@tonic-gate
24617c478bd9Sstevel@tonic-gate void
prt_ffg(private_t * pri,int raw,long val)24627c478bd9Sstevel@tonic-gate prt_ffg(private_t *pri, int raw, long val)
24637c478bd9Sstevel@tonic-gate {
24647c478bd9Sstevel@tonic-gate #define CBSIZE sizeof (pri->code_buf)
24657c478bd9Sstevel@tonic-gate char *s = pri->code_buf;
24667c478bd9Sstevel@tonic-gate size_t used = 1;
24677c478bd9Sstevel@tonic-gate struct fcntl_flags *fp;
24687c478bd9Sstevel@tonic-gate
24697c478bd9Sstevel@tonic-gate if (raw) {
24707c478bd9Sstevel@tonic-gate (void) snprintf(s, CBSIZE, "0x%lx", val);
24717c478bd9Sstevel@tonic-gate outstring(pri, s);
24727c478bd9Sstevel@tonic-gate return;
24737c478bd9Sstevel@tonic-gate }
24747c478bd9Sstevel@tonic-gate if (val == 0) {
24757c478bd9Sstevel@tonic-gate outstring(pri, "(no flags)");
24767c478bd9Sstevel@tonic-gate return;
24777c478bd9Sstevel@tonic-gate }
24787c478bd9Sstevel@tonic-gate
24797c478bd9Sstevel@tonic-gate *s = '\0';
24807c478bd9Sstevel@tonic-gate for (fp = fcntl_flags;
24817c478bd9Sstevel@tonic-gate fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) {
24827c478bd9Sstevel@tonic-gate if (val & fp->val) {
24837c478bd9Sstevel@tonic-gate used = strlcat(s, fp->name, CBSIZE);
24847c478bd9Sstevel@tonic-gate val &= ~fp->val;
24857c478bd9Sstevel@tonic-gate }
24867c478bd9Sstevel@tonic-gate }
24877c478bd9Sstevel@tonic-gate
24887c478bd9Sstevel@tonic-gate if (val != 0 && used <= CBSIZE)
24897c478bd9Sstevel@tonic-gate used += snprintf(s + used, CBSIZE - used, "|0x%lx", val);
24907c478bd9Sstevel@tonic-gate
24917c478bd9Sstevel@tonic-gate if (used >= CBSIZE)
24927c478bd9Sstevel@tonic-gate (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
24937c478bd9Sstevel@tonic-gate outstring(pri, s + 1);
24947c478bd9Sstevel@tonic-gate #undef CBSIZE
24957c478bd9Sstevel@tonic-gate }
24967c478bd9Sstevel@tonic-gate
24977c478bd9Sstevel@tonic-gate void
prt_prs(private_t * pri,int raw,long val)24987c478bd9Sstevel@tonic-gate prt_prs(private_t *pri, int raw, long val)
24997c478bd9Sstevel@tonic-gate {
25007c478bd9Sstevel@tonic-gate static size_t setsize;
25017c478bd9Sstevel@tonic-gate priv_set_t *set = priv_allocset();
25027c478bd9Sstevel@tonic-gate
25037c478bd9Sstevel@tonic-gate if (setsize == 0) {
25047c478bd9Sstevel@tonic-gate const priv_impl_info_t *info = getprivimplinfo();
25057c478bd9Sstevel@tonic-gate if (info != NULL)
25067c478bd9Sstevel@tonic-gate setsize = info->priv_setsize * sizeof (priv_chunk_t);
25077c478bd9Sstevel@tonic-gate }
25087c478bd9Sstevel@tonic-gate
25097c478bd9Sstevel@tonic-gate if (setsize != 0 && !raw && set != NULL &&
25107c478bd9Sstevel@tonic-gate Pread(Proc, set, setsize, val) == setsize) {
25117c478bd9Sstevel@tonic-gate int i;
25127c478bd9Sstevel@tonic-gate
25137c478bd9Sstevel@tonic-gate outstring(pri, "{");
25147c478bd9Sstevel@tonic-gate for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) {
25157c478bd9Sstevel@tonic-gate char buf[9]; /* 8 hex digits + '\0' */
25167c478bd9Sstevel@tonic-gate (void) snprintf(buf, sizeof (buf), "%08x",
25177c478bd9Sstevel@tonic-gate ((priv_chunk_t *)set)[i]);
25187c478bd9Sstevel@tonic-gate outstring(pri, buf);
25197c478bd9Sstevel@tonic-gate }
25207c478bd9Sstevel@tonic-gate
25217c478bd9Sstevel@tonic-gate outstring(pri, "}");
25227c478bd9Sstevel@tonic-gate } else {
25237c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
25247c478bd9Sstevel@tonic-gate }
25257c478bd9Sstevel@tonic-gate
25267c478bd9Sstevel@tonic-gate if (set != NULL)
25277c478bd9Sstevel@tonic-gate priv_freeset(set);
25287c478bd9Sstevel@tonic-gate }
25297c478bd9Sstevel@tonic-gate
25307c478bd9Sstevel@tonic-gate /*
25317c478bd9Sstevel@tonic-gate * Print privilege set operation.
25327c478bd9Sstevel@tonic-gate */
25337c478bd9Sstevel@tonic-gate void
prt_pro(private_t * pri,int raw,long val)25347c478bd9Sstevel@tonic-gate prt_pro(private_t *pri, int raw, long val)
25357c478bd9Sstevel@tonic-gate {
25367c478bd9Sstevel@tonic-gate const char *s = NULL;
25377c478bd9Sstevel@tonic-gate
25387c478bd9Sstevel@tonic-gate if (!raw) {
25397c478bd9Sstevel@tonic-gate switch ((priv_op_t)val) {
25407c478bd9Sstevel@tonic-gate case PRIV_ON: s = "PRIV_ON"; break;
25417c478bd9Sstevel@tonic-gate case PRIV_OFF: s = "PRIV_OFF"; break;
25427c478bd9Sstevel@tonic-gate case PRIV_SET: s = "PRIV_SET"; break;
25437c478bd9Sstevel@tonic-gate }
25447c478bd9Sstevel@tonic-gate }
25457c478bd9Sstevel@tonic-gate
25467c478bd9Sstevel@tonic-gate if (s == NULL)
25477c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
25487c478bd9Sstevel@tonic-gate else
25497c478bd9Sstevel@tonic-gate outstring(pri, s);
25507c478bd9Sstevel@tonic-gate }
25517c478bd9Sstevel@tonic-gate
25527c478bd9Sstevel@tonic-gate /*
25537c478bd9Sstevel@tonic-gate * Print privilege set name
25547c478bd9Sstevel@tonic-gate */
25557c478bd9Sstevel@tonic-gate void
prt_prn(private_t * pri,int raw,long val)25567c478bd9Sstevel@tonic-gate prt_prn(private_t *pri, int raw, long val)
25577c478bd9Sstevel@tonic-gate {
25587c478bd9Sstevel@tonic-gate const char *s = NULL;
25597c478bd9Sstevel@tonic-gate
25607c478bd9Sstevel@tonic-gate if (!raw)
25617c478bd9Sstevel@tonic-gate s = priv_getsetbynum((int)val);
25627c478bd9Sstevel@tonic-gate
25637c478bd9Sstevel@tonic-gate if (s == NULL)
25647c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
25657c478bd9Sstevel@tonic-gate else {
25667c478bd9Sstevel@tonic-gate char *dup = strdup(s);
25677c478bd9Sstevel@tonic-gate char *q;
25687c478bd9Sstevel@tonic-gate
25697c478bd9Sstevel@tonic-gate /* Do the best we can in this case */
25707c478bd9Sstevel@tonic-gate if (dup == NULL) {
25717c478bd9Sstevel@tonic-gate outstring(pri, s);
25727c478bd9Sstevel@tonic-gate return;
25737c478bd9Sstevel@tonic-gate }
25747c478bd9Sstevel@tonic-gate
25757c478bd9Sstevel@tonic-gate outstring(pri, "PRIV_");
25767c478bd9Sstevel@tonic-gate
25777c478bd9Sstevel@tonic-gate q = dup;
25787c478bd9Sstevel@tonic-gate
25797c478bd9Sstevel@tonic-gate while (*q != '\0') {
25807c478bd9Sstevel@tonic-gate *q = toupper(*q);
25817c478bd9Sstevel@tonic-gate q++;
25827c478bd9Sstevel@tonic-gate }
25837c478bd9Sstevel@tonic-gate outstring(pri, dup);
25847c478bd9Sstevel@tonic-gate free(dup);
25857c478bd9Sstevel@tonic-gate }
25867c478bd9Sstevel@tonic-gate }
25877c478bd9Sstevel@tonic-gate
25887c478bd9Sstevel@tonic-gate /*
25897c478bd9Sstevel@tonic-gate * Print process flag names.
25907c478bd9Sstevel@tonic-gate */
25917c478bd9Sstevel@tonic-gate void
prt_pfl(private_t * pri,int raw,long val)25927c478bd9Sstevel@tonic-gate prt_pfl(private_t *pri, int raw, long val)
25937c478bd9Sstevel@tonic-gate {
25947c478bd9Sstevel@tonic-gate const char *s = NULL;
25957c478bd9Sstevel@tonic-gate
25967c478bd9Sstevel@tonic-gate if (!raw) {
25977c478bd9Sstevel@tonic-gate switch ((int)val) {
25987c478bd9Sstevel@tonic-gate case PRIV_DEBUG: s = "PRIV_DEBUG"; break;
25997c478bd9Sstevel@tonic-gate case PRIV_AWARE: s = "PRIV_AWARE"; break;
2600ddf7fe95Scasper case PRIV_XPOLICY: s = "PRIV_XPOLICY"; break;
2601982b4ad2SCasper H.S. Dik case PRIV_AWARE_RESET: s = "PRIV_AWARE_RESET"; break;
2602134a1f4eSCasper H.S. Dik case PRIV_PFEXEC: s = "PRIV_PFEXEC"; break;
2603ddf7fe95Scasper case NET_MAC_AWARE: s = "NET_MAC_AWARE"; break;
2604ddf7fe95Scasper case NET_MAC_AWARE_INHERIT:
2605ddf7fe95Scasper s = "NET_MAC_AWARE_INHERIT";
2606ddf7fe95Scasper break;
26077c478bd9Sstevel@tonic-gate }
26087c478bd9Sstevel@tonic-gate }
26097c478bd9Sstevel@tonic-gate
26107c478bd9Sstevel@tonic-gate if (s == NULL)
26117c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
26127c478bd9Sstevel@tonic-gate else
26137c478bd9Sstevel@tonic-gate outstring(pri, s);
26147c478bd9Sstevel@tonic-gate }
26157c478bd9Sstevel@tonic-gate
26167c478bd9Sstevel@tonic-gate /*
26177c478bd9Sstevel@tonic-gate * Print lgrp_affinity_{get,set}() arguments.
26187c478bd9Sstevel@tonic-gate */
26197c478bd9Sstevel@tonic-gate /*ARGSUSED*/
26207c478bd9Sstevel@tonic-gate void
prt_laf(private_t * pri,int raw,long val)26217c478bd9Sstevel@tonic-gate prt_laf(private_t *pri, int raw, long val)
26227c478bd9Sstevel@tonic-gate {
26237c478bd9Sstevel@tonic-gate lgrp_affinity_args_t laff;
26247c478bd9Sstevel@tonic-gate
26257c478bd9Sstevel@tonic-gate if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) !=
2626fac3008cSeschrock sizeof (lgrp_affinity_args_t)) {
26277c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
26287c478bd9Sstevel@tonic-gate return;
26297c478bd9Sstevel@tonic-gate }
26307c478bd9Sstevel@tonic-gate /*
26317c478bd9Sstevel@tonic-gate * arrange the arguments in the order that user calls with
26327c478bd9Sstevel@tonic-gate */
26337c478bd9Sstevel@tonic-gate prt_dec(pri, 0, laff.idtype);
26347c478bd9Sstevel@tonic-gate outstring(pri, ", ");
26357c478bd9Sstevel@tonic-gate prt_dec(pri, 0, laff.id);
26367c478bd9Sstevel@tonic-gate outstring(pri, ", ");
26377c478bd9Sstevel@tonic-gate prt_dec(pri, 0, laff.lgrp);
26387c478bd9Sstevel@tonic-gate outstring(pri, ", ");
26397c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET)
26407c478bd9Sstevel@tonic-gate prt_dec(pri, 0, laff.aff);
26417c478bd9Sstevel@tonic-gate }
26427c478bd9Sstevel@tonic-gate
26437c478bd9Sstevel@tonic-gate /*
26447c478bd9Sstevel@tonic-gate * Print a key_t as IPC_PRIVATE if it is 0.
26457c478bd9Sstevel@tonic-gate */
26467c478bd9Sstevel@tonic-gate void
prt_key(private_t * pri,int raw,long val)26477c478bd9Sstevel@tonic-gate prt_key(private_t *pri, int raw, long val)
26487c478bd9Sstevel@tonic-gate {
26497c478bd9Sstevel@tonic-gate if (!raw && val == 0)
26507c478bd9Sstevel@tonic-gate outstring(pri, "IPC_PRIVATE");
26517c478bd9Sstevel@tonic-gate else
26527c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
26537c478bd9Sstevel@tonic-gate }
26547c478bd9Sstevel@tonic-gate
26557c478bd9Sstevel@tonic-gate
26567c478bd9Sstevel@tonic-gate /*
26577c478bd9Sstevel@tonic-gate * Print zone_getattr() attribute types.
26587c478bd9Sstevel@tonic-gate */
26597c478bd9Sstevel@tonic-gate void
prt_zga(private_t * pri,int raw,long val)26607c478bd9Sstevel@tonic-gate prt_zga(private_t *pri, int raw, long val)
26617c478bd9Sstevel@tonic-gate {
26627c478bd9Sstevel@tonic-gate const char *s = NULL;
26637c478bd9Sstevel@tonic-gate
26647c478bd9Sstevel@tonic-gate if (!raw) {
26657c478bd9Sstevel@tonic-gate switch ((int)val) {
26667c478bd9Sstevel@tonic-gate case ZONE_ATTR_NAME: s = "ZONE_ATTR_NAME"; break;
26677c478bd9Sstevel@tonic-gate case ZONE_ATTR_ROOT: s = "ZONE_ATTR_ROOT"; break;
26687c478bd9Sstevel@tonic-gate case ZONE_ATTR_STATUS: s = "ZONE_ATTR_STATUS"; break;
26697c478bd9Sstevel@tonic-gate case ZONE_ATTR_PRIVSET: s = "ZONE_ATTR_PRIVSET"; break;
26707c478bd9Sstevel@tonic-gate case ZONE_ATTR_UNIQID: s = "ZONE_ATTR_UNIQID"; break;
26717c478bd9Sstevel@tonic-gate case ZONE_ATTR_POOLID: s = "ZONE_ATTR_POOLID"; break;
26727c478bd9Sstevel@tonic-gate case ZONE_ATTR_INITPID: s = "ZONE_ATTR_INITPID"; break;
267345916cd2Sjpk case ZONE_ATTR_SLBL: s = "ZONE_ATTR_SLBL"; break;
26743f2f09c1Sdp case ZONE_ATTR_INITNAME: s = "ZONE_ATTR_INITNAME"; break;
26753f2f09c1Sdp case ZONE_ATTR_BOOTARGS: s = "ZONE_ATTR_BOOTARGS"; break;
2676bafa7067Snn case ZONE_ATTR_BRAND: s = "ZONE_ATTR_BRAND"; break;
2677f4b3ec61Sdh case ZONE_ATTR_FLAGS: s = "ZONE_ATTR_FLAGS"; break;
26780209230bSgjelinek case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break;
26797c478bd9Sstevel@tonic-gate }
26807c478bd9Sstevel@tonic-gate }
26817c478bd9Sstevel@tonic-gate
26827c478bd9Sstevel@tonic-gate if (s == NULL)
26837c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
26847c478bd9Sstevel@tonic-gate else
26857c478bd9Sstevel@tonic-gate outstring(pri, s);
26867c478bd9Sstevel@tonic-gate }
26877c478bd9Sstevel@tonic-gate
26887c478bd9Sstevel@tonic-gate /*
26897c478bd9Sstevel@tonic-gate * Print a file descriptor as AT_FDCWD if necessary
26907c478bd9Sstevel@tonic-gate */
26917c478bd9Sstevel@tonic-gate void
prt_atc(private_t * pri,int raw,long val)26927c478bd9Sstevel@tonic-gate prt_atc(private_t *pri, int raw, long val)
26937c478bd9Sstevel@tonic-gate {
26948fd04b83SRoger A. Faulkner if ((int)val == AT_FDCWD) {
26958fd04b83SRoger A. Faulkner if (raw)
26968fd04b83SRoger A. Faulkner prt_hex(pri, 0, (uint_t)AT_FDCWD);
26978fd04b83SRoger A. Faulkner else
26988fd04b83SRoger A. Faulkner outstring(pri, "AT_FDCWD");
26998fd04b83SRoger A. Faulkner } else {
27007c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
27018fd04b83SRoger A. Faulkner }
27027c478bd9Sstevel@tonic-gate }
27037c478bd9Sstevel@tonic-gate
270445916cd2Sjpk /*
270545916cd2Sjpk * Print Trusted Networking database operation codes (labelsys; tn*)
270645916cd2Sjpk */
270745916cd2Sjpk static void
prt_tnd(private_t * pri,int raw,long val)270845916cd2Sjpk prt_tnd(private_t *pri, int raw, long val)
270945916cd2Sjpk {
271045916cd2Sjpk const char *s = NULL;
271145916cd2Sjpk
271245916cd2Sjpk if (!raw) {
271345916cd2Sjpk switch ((tsol_dbops_t)val) {
271445916cd2Sjpk case TNDB_NOOP: s = "TNDB_NOOP"; break;
271545916cd2Sjpk case TNDB_LOAD: s = "TNDB_LOAD"; break;
271645916cd2Sjpk case TNDB_DELETE: s = "TNDB_DELETE"; break;
271745916cd2Sjpk case TNDB_FLUSH: s = "TNDB_FLUSH"; break;
271845916cd2Sjpk case TNDB_GET: s = "TNDB_GET"; break;
271945916cd2Sjpk }
272045916cd2Sjpk }
272145916cd2Sjpk
272245916cd2Sjpk if (s == NULL)
272345916cd2Sjpk prt_dec(pri, 0, val);
272445916cd2Sjpk else
272545916cd2Sjpk outstring(pri, s);
272645916cd2Sjpk }
272745916cd2Sjpk
27287c478bd9Sstevel@tonic-gate /*
27297c478bd9Sstevel@tonic-gate * Print LIO_XX flags
27307c478bd9Sstevel@tonic-gate */
27317c478bd9Sstevel@tonic-gate void
prt_lio(private_t * pri,int raw,long val)27327c478bd9Sstevel@tonic-gate prt_lio(private_t *pri, int raw, long val)
27337c478bd9Sstevel@tonic-gate {
27347c478bd9Sstevel@tonic-gate if (raw)
27357c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
27367c478bd9Sstevel@tonic-gate else if (val == LIO_WAIT)
27377c478bd9Sstevel@tonic-gate outstring(pri, "LIO_WAIT");
27387c478bd9Sstevel@tonic-gate else if (val == LIO_NOWAIT)
27397c478bd9Sstevel@tonic-gate outstring(pri, "LIO_NOWAIT");
27407c478bd9Sstevel@tonic-gate else
27417c478bd9Sstevel@tonic-gate prt_dec(pri, 0, val);
27427c478bd9Sstevel@tonic-gate }
27437c478bd9Sstevel@tonic-gate
27447c478bd9Sstevel@tonic-gate const char *
door_flags(private_t * pri,long val)27457c478bd9Sstevel@tonic-gate door_flags(private_t *pri, long val)
27467c478bd9Sstevel@tonic-gate {
27477c478bd9Sstevel@tonic-gate door_attr_t attr = (door_attr_t)val;
27487c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
27497c478bd9Sstevel@tonic-gate
27507c478bd9Sstevel@tonic-gate *str = '\0';
27517c478bd9Sstevel@tonic-gate #define PROCESS_FLAG(flg) \
27527c478bd9Sstevel@tonic-gate if (attr & flg) { \
27537c478bd9Sstevel@tonic-gate (void) strlcat(str, "|" #flg, sizeof (pri->code_buf)); \
27547c478bd9Sstevel@tonic-gate attr &= ~flg; \
27557c478bd9Sstevel@tonic-gate }
27567c478bd9Sstevel@tonic-gate
27577c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_UNREF);
27587c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_UNREF_MULTI);
27597c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_PRIVATE);
27607c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_REFUSE_DESC);
27617c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_NO_CANCEL);
27627c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_LOCAL);
27637c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_REVOKED);
27647c478bd9Sstevel@tonic-gate PROCESS_FLAG(DOOR_IS_UNREF);
27657c478bd9Sstevel@tonic-gate #undef PROCESS_FLAG
27667c478bd9Sstevel@tonic-gate
27677c478bd9Sstevel@tonic-gate if (attr != 0 || *str == '\0') {
27687c478bd9Sstevel@tonic-gate size_t len = strlen(str);
27697c478bd9Sstevel@tonic-gate (void) snprintf(str + len, sizeof (pri->code_buf) - len,
27707c478bd9Sstevel@tonic-gate "|0x%X", attr);
27717c478bd9Sstevel@tonic-gate }
27727c478bd9Sstevel@tonic-gate
27737c478bd9Sstevel@tonic-gate return (str + 1);
27747c478bd9Sstevel@tonic-gate }
27757c478bd9Sstevel@tonic-gate
27767c478bd9Sstevel@tonic-gate /*
27777c478bd9Sstevel@tonic-gate * Print door_create() flags
27787c478bd9Sstevel@tonic-gate */
27797c478bd9Sstevel@tonic-gate void
prt_dfl(private_t * pri,int raw,long val)27807c478bd9Sstevel@tonic-gate prt_dfl(private_t *pri, int raw, long val)
27817c478bd9Sstevel@tonic-gate {
27827c478bd9Sstevel@tonic-gate if (raw)
27837c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
27847c478bd9Sstevel@tonic-gate else
27857c478bd9Sstevel@tonic-gate outstring(pri, door_flags(pri, val));
27867c478bd9Sstevel@tonic-gate }
27877c478bd9Sstevel@tonic-gate
27887c478bd9Sstevel@tonic-gate /*
27897c478bd9Sstevel@tonic-gate * Print door_*param() param argument
27907c478bd9Sstevel@tonic-gate */
27917c478bd9Sstevel@tonic-gate void
prt_dpm(private_t * pri,int raw,long val)27927c478bd9Sstevel@tonic-gate prt_dpm(private_t *pri, int raw, long val)
27937c478bd9Sstevel@tonic-gate {
27947c478bd9Sstevel@tonic-gate if (raw)
27957c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
27967c478bd9Sstevel@tonic-gate else if (val == DOOR_PARAM_DESC_MAX)
27977c478bd9Sstevel@tonic-gate outstring(pri, "DOOR_PARAM_DESC_MAX");
27987c478bd9Sstevel@tonic-gate else if (val == DOOR_PARAM_DATA_MIN)
27997c478bd9Sstevel@tonic-gate outstring(pri, "DOOR_PARAM_DATA_MIN");
28007c478bd9Sstevel@tonic-gate else if (val == DOOR_PARAM_DATA_MAX)
28017c478bd9Sstevel@tonic-gate outstring(pri, "DOOR_PARAM_DATA_MAX");
28027c478bd9Sstevel@tonic-gate else
28037c478bd9Sstevel@tonic-gate prt_hex(pri, 0, val);
28047c478bd9Sstevel@tonic-gate }
28057c478bd9Sstevel@tonic-gate
2806aa4a4f3bSnf /*
2807aa4a4f3bSnf * Print rctlsys subcodes
2808aa4a4f3bSnf */
2809aa4a4f3bSnf void
prt_rsc(private_t * pri,int raw,long val)2810aa4a4f3bSnf prt_rsc(private_t *pri, int raw, long val) /* print utssys code */
2811aa4a4f3bSnf {
2812aa4a4f3bSnf const char *s = raw? NULL : rctlsyscode(val);
2813aa4a4f3bSnf
2814aa4a4f3bSnf if (s == NULL)
2815aa4a4f3bSnf prt_dec(pri, 0, val);
2816aa4a4f3bSnf else
2817aa4a4f3bSnf outstring(pri, s);
2818aa4a4f3bSnf }
2819aa4a4f3bSnf
2820aa4a4f3bSnf /*
2821aa4a4f3bSnf * Print getrctl flags
2822aa4a4f3bSnf */
2823aa4a4f3bSnf void
prt_rgf(private_t * pri,int raw,long val)2824aa4a4f3bSnf prt_rgf(private_t *pri, int raw, long val)
2825aa4a4f3bSnf {
2826aa4a4f3bSnf long action = val & (~RCTLSYS_ACTION_MASK);
2827aa4a4f3bSnf
2828aa4a4f3bSnf if (raw)
2829aa4a4f3bSnf prt_hex(pri, 0, val);
2830aa4a4f3bSnf else if (action == RCTL_FIRST)
2831aa4a4f3bSnf outstring(pri, "RCTL_FIRST");
2832aa4a4f3bSnf else if (action == RCTL_NEXT)
2833aa4a4f3bSnf outstring(pri, "RCTL_NEXT");
2834aa4a4f3bSnf else if (action == RCTL_USAGE)
2835aa4a4f3bSnf outstring(pri, "RCTL_USAGE");
2836aa4a4f3bSnf else
2837aa4a4f3bSnf prt_hex(pri, 0, val);
2838aa4a4f3bSnf }
2839aa4a4f3bSnf
2840aa4a4f3bSnf /*
2841aa4a4f3bSnf * Print setrctl flags
2842aa4a4f3bSnf */
2843aa4a4f3bSnf void
prt_rsf(private_t * pri,int raw,long val)2844aa4a4f3bSnf prt_rsf(private_t *pri, int raw, long val)
2845aa4a4f3bSnf {
2846aa4a4f3bSnf long action = val & (~RCTLSYS_ACTION_MASK);
2847aa4a4f3bSnf long pval = val & RCTL_LOCAL_ACTION_MASK;
2848aa4a4f3bSnf char *s = pri->code_buf;
2849aa4a4f3bSnf
2850aa4a4f3bSnf if (raw) {
2851aa4a4f3bSnf prt_hex(pri, 0, val);
2852aa4a4f3bSnf return;
2853aa4a4f3bSnf } else if (action == RCTL_INSERT)
2854aa4a4f3bSnf (void) strcpy(s, "RCTL_INSERT");
2855aa4a4f3bSnf else if (action == RCTL_DELETE)
2856aa4a4f3bSnf (void) strcpy(s, "RCTL_DELETE");
2857aa4a4f3bSnf else if (action == RCTL_REPLACE)
2858aa4a4f3bSnf (void) strcpy(s, "RCTL_REPLACE");
2859aa4a4f3bSnf else {
2860aa4a4f3bSnf prt_hex(pri, 0, val);
2861aa4a4f3bSnf return;
2862aa4a4f3bSnf }
2863aa4a4f3bSnf
2864aa4a4f3bSnf if (pval & RCTL_USE_RECIPIENT_PID) {
2865aa4a4f3bSnf pval ^= RCTL_USE_RECIPIENT_PID;
2866aa4a4f3bSnf (void) strlcat(s, "|RCTL_USE_RECIPIENT_PID",
2867aa4a4f3bSnf sizeof (pri->code_buf));
2868aa4a4f3bSnf }
2869aa4a4f3bSnf
2870aa4a4f3bSnf if ((pval & RCTLSYS_ACTION_MASK) != 0)
2871aa4a4f3bSnf prt_hex(pri, 0, val);
2872aa4a4f3bSnf else if (*s != '\0')
2873aa4a4f3bSnf outstring(pri, s);
2874aa4a4f3bSnf else
2875aa4a4f3bSnf prt_hex(pri, 0, val);
2876aa4a4f3bSnf }
2877aa4a4f3bSnf
2878aa4a4f3bSnf /*
2879aa4a4f3bSnf * Print rctlctl flags
2880aa4a4f3bSnf */
2881aa4a4f3bSnf void
prt_rcf(private_t * pri,int raw,long val)2882aa4a4f3bSnf prt_rcf(private_t *pri, int raw, long val)
2883aa4a4f3bSnf {
2884aa4a4f3bSnf long action = val & (~RCTLSYS_ACTION_MASK);
2885aa4a4f3bSnf
2886aa4a4f3bSnf if (raw)
2887aa4a4f3bSnf prt_hex(pri, 0, val);
2888aa4a4f3bSnf else if (action == RCTLCTL_GET)
2889aa4a4f3bSnf outstring(pri, "RCTLCTL_GET");
2890aa4a4f3bSnf else if (action == RCTLCTL_SET)
2891aa4a4f3bSnf outstring(pri, "RCTLCTL_SET");
2892aa4a4f3bSnf else
2893aa4a4f3bSnf prt_hex(pri, 0, val);
2894aa4a4f3bSnf }
2895aa4a4f3bSnf
2896532877c4Srd /*
2897532877c4Srd * Print setprojrctl flags
2898532877c4Srd */
2899532877c4Srd void
prt_spf(private_t * pri,int raw,long val)2900532877c4Srd prt_spf(private_t *pri, int raw, long val)
2901532877c4Srd {
2902532877c4Srd long action = val & TASK_PROJ_MASK;
2903532877c4Srd
2904532877c4Srd if (!raw && (action == TASK_PROJ_PURGE))
2905532877c4Srd outstring(pri, "TASK_PROJ_PURGE");
2906532877c4Srd else
2907532877c4Srd prt_hex(pri, 0, val);
2908532877c4Srd }
2909532877c4Srd
2910657b1f3dSraf /*
2911657b1f3dSraf * Print forkx() flags
2912657b1f3dSraf */
2913657b1f3dSraf void
prt_fxf(private_t * pri,int raw,long val)2914657b1f3dSraf prt_fxf(private_t *pri, int raw, long val)
2915657b1f3dSraf {
2916657b1f3dSraf char *str;
2917657b1f3dSraf
2918657b1f3dSraf if (val == 0)
2919657b1f3dSraf outstring(pri, "0");
2920657b1f3dSraf else if (raw || (val & ~(FORK_NOSIGCHLD | FORK_WAITPID)))
2921657b1f3dSraf prt_hhx(pri, 0, val);
2922657b1f3dSraf else {
2923657b1f3dSraf str = pri->code_buf;
2924657b1f3dSraf *str = '\0';
2925657b1f3dSraf if (val & FORK_NOSIGCHLD)
2926657b1f3dSraf (void) strlcat(str, "|FORK_NOSIGCHLD",
2927657b1f3dSraf sizeof (pri->code_buf));
2928657b1f3dSraf if (val & FORK_WAITPID)
2929657b1f3dSraf (void) strlcat(str, "|FORK_WAITPID",
2930657b1f3dSraf sizeof (pri->code_buf));
2931657b1f3dSraf outstring(pri, str + 1);
2932657b1f3dSraf }
2933657b1f3dSraf }
2934aa4a4f3bSnf
29353b862e9aSRoger A. Faulkner /*
2936794f0adbSRoger A. Faulkner * Print faccessat() flag
2937794f0adbSRoger A. Faulkner */
2938794f0adbSRoger A. Faulkner void
prt_fat(private_t * pri,int raw,long val)2939794f0adbSRoger A. Faulkner prt_fat(private_t *pri, int raw, long val)
2940794f0adbSRoger A. Faulkner {
2941794f0adbSRoger A. Faulkner if (val == 0)
2942794f0adbSRoger A. Faulkner outstring(pri, "0");
2943794f0adbSRoger A. Faulkner else if (!raw && val == AT_EACCESS)
2944794f0adbSRoger A. Faulkner outstring(pri, "AT_EACCESS");
2945794f0adbSRoger A. Faulkner else
2946794f0adbSRoger A. Faulkner prt_hex(pri, 0, val);
2947794f0adbSRoger A. Faulkner }
2948794f0adbSRoger A. Faulkner
2949794f0adbSRoger A. Faulkner /*
2950794f0adbSRoger A. Faulkner * Print unlinkat() flag
2951794f0adbSRoger A. Faulkner */
2952794f0adbSRoger A. Faulkner void
prt_uat(private_t * pri,int raw,long val)2953794f0adbSRoger A. Faulkner prt_uat(private_t *pri, int raw, long val)
2954794f0adbSRoger A. Faulkner {
2955794f0adbSRoger A. Faulkner if (val == 0)
2956794f0adbSRoger A. Faulkner outstring(pri, "0");
2957794f0adbSRoger A. Faulkner else if (!raw && val == AT_REMOVEDIR)
2958794f0adbSRoger A. Faulkner outstring(pri, "AT_REMOVEDIR");
2959794f0adbSRoger A. Faulkner else
2960794f0adbSRoger A. Faulkner prt_hex(pri, 0, val);
2961794f0adbSRoger A. Faulkner }
2962794f0adbSRoger A. Faulkner
2963794f0adbSRoger A. Faulkner /*
2964794f0adbSRoger A. Faulkner * Print AT_SYMLINK_NOFOLLOW / AT_SYMLINK_FOLLOW flag
29653b862e9aSRoger A. Faulkner */
29663b862e9aSRoger A. Faulkner void
prt_snf(private_t * pri,int raw,long val)2967794f0adbSRoger A. Faulkner prt_snf(private_t *pri, int raw, long val)
29683b862e9aSRoger A. Faulkner {
29693b862e9aSRoger A. Faulkner if (val == 0)
29703b862e9aSRoger A. Faulkner outstring(pri, "0");
29713b862e9aSRoger A. Faulkner else if (!raw && val == AT_SYMLINK_NOFOLLOW)
29723b862e9aSRoger A. Faulkner outstring(pri, "AT_SYMLINK_NOFOLLOW");
2973794f0adbSRoger A. Faulkner else if (!raw && val == AT_SYMLINK_FOLLOW)
2974794f0adbSRoger A. Faulkner outstring(pri, "AT_SYMLINK_FOLLOW");
29753b862e9aSRoger A. Faulkner else
29763b862e9aSRoger A. Faulkner prt_hex(pri, 0, val);
29773b862e9aSRoger A. Faulkner }
29783b862e9aSRoger A. Faulkner
29799d12795fSRobert Mustacchi void
prt_grf(private_t * pri,int raw,long val)29809d12795fSRobert Mustacchi prt_grf(private_t *pri, int raw, long val)
29819d12795fSRobert Mustacchi {
29829d12795fSRobert Mustacchi int first = 1;
29839d12795fSRobert Mustacchi
29849d12795fSRobert Mustacchi if (raw != 0 || val == 0 ||
29859d12795fSRobert Mustacchi (val & ~(GRND_NONBLOCK | GRND_RANDOM)) != 0) {
29869d12795fSRobert Mustacchi outstring(pri, "0");
29879d12795fSRobert Mustacchi return;
29889d12795fSRobert Mustacchi }
29899d12795fSRobert Mustacchi
29909d12795fSRobert Mustacchi if (val & GRND_NONBLOCK) {
29919d12795fSRobert Mustacchi outstring(pri, "|GRND_NONBLOCK" + first);
29929d12795fSRobert Mustacchi first = 0;
29939d12795fSRobert Mustacchi }
29949d12795fSRobert Mustacchi if (val & GRND_RANDOM) {
29959d12795fSRobert Mustacchi outstring(pri, "|GRND_RANDOM" + first);
29969d12795fSRobert Mustacchi first = 0;
29979d12795fSRobert Mustacchi }
29989d12795fSRobert Mustacchi }
29999d12795fSRobert Mustacchi
3000*2b395c3cSAndy Fiddaman void
prt_exc(private_t * pri,int raw,long val)3001*2b395c3cSAndy Fiddaman prt_exc(private_t *pri, int raw, long val)
3002*2b395c3cSAndy Fiddaman {
3003*2b395c3cSAndy Fiddaman #define CBSIZE sizeof (pri->code_buf)
3004*2b395c3cSAndy Fiddaman char *str = pri->code_buf;
3005*2b395c3cSAndy Fiddaman size_t used = 0;
3006*2b395c3cSAndy Fiddaman
3007*2b395c3cSAndy Fiddaman if (raw) {
3008*2b395c3cSAndy Fiddaman prt_hex(pri, 0, val);
3009*2b395c3cSAndy Fiddaman return;
3010*2b395c3cSAndy Fiddaman }
3011*2b395c3cSAndy Fiddaman if (val == 0) {
3012*2b395c3cSAndy Fiddaman outstring(pri, "0");
3013*2b395c3cSAndy Fiddaman return;
3014*2b395c3cSAndy Fiddaman }
3015*2b395c3cSAndy Fiddaman
3016*2b395c3cSAndy Fiddaman *str = '\0';
3017*2b395c3cSAndy Fiddaman if (val & EXEC_DESCRIPTOR) {
3018*2b395c3cSAndy Fiddaman used = strlcat(str, "|EXEC_DESCRIPTOR", CBSIZE);
3019*2b395c3cSAndy Fiddaman val &= ~EXEC_DESCRIPTOR;
3020*2b395c3cSAndy Fiddaman }
3021*2b395c3cSAndy Fiddaman
3022*2b395c3cSAndy Fiddaman if (val != 0 && used <= CBSIZE)
3023*2b395c3cSAndy Fiddaman used += snprintf(str + used, CBSIZE - used, "|0x%lx", val);
3024*2b395c3cSAndy Fiddaman
3025*2b395c3cSAndy Fiddaman if (used >= CBSIZE)
3026*2b395c3cSAndy Fiddaman (void) snprintf(str + 1, CBSIZE - 1, "0x%lx", val);
3027*2b395c3cSAndy Fiddaman
3028*2b395c3cSAndy Fiddaman outstring(pri, str + 1);
3029*2b395c3cSAndy Fiddaman #undef CBSIZE
3030*2b395c3cSAndy Fiddaman }
3031*2b395c3cSAndy Fiddaman
30327c478bd9Sstevel@tonic-gate /*
30337c478bd9Sstevel@tonic-gate * Array of pointers to print functions, one for each format.
30347c478bd9Sstevel@tonic-gate */
30357c478bd9Sstevel@tonic-gate void (* const Print[])() = {
30367c478bd9Sstevel@tonic-gate prt_nov, /* NOV -- no value */
30377c478bd9Sstevel@tonic-gate prt_dec, /* DEC -- print value in decimal */
30387c478bd9Sstevel@tonic-gate prt_oct, /* OCT -- print value in octal */
30397c478bd9Sstevel@tonic-gate prt_hex, /* HEX -- print value in hexadecimal */
30407c478bd9Sstevel@tonic-gate prt_dex, /* DEX -- print value in hexadecimal if big enough */
30417c478bd9Sstevel@tonic-gate prt_stg, /* STG -- print value as string */
30427c478bd9Sstevel@tonic-gate prt_ioc, /* IOC -- print ioctl code */
30437c478bd9Sstevel@tonic-gate prt_fcn, /* FCN -- print fcntl code */
30447c478bd9Sstevel@tonic-gate prt_s86, /* S86 -- print sysi86 code */
30457c478bd9Sstevel@tonic-gate prt_uts, /* UTS -- print utssys code */
30467c478bd9Sstevel@tonic-gate prt_opn, /* OPN -- print open code */
30477c478bd9Sstevel@tonic-gate prt_sig, /* SIG -- print signal name plus flags */
3048794f0adbSRoger A. Faulkner prt_uat, /* UAT -- print unlinkat() flag */
30497c478bd9Sstevel@tonic-gate prt_msc, /* MSC -- print msgsys command */
30507c478bd9Sstevel@tonic-gate prt_msf, /* MSF -- print msgsys flags */
30517c478bd9Sstevel@tonic-gate prt_smc, /* SMC -- print semsys command */
30527c478bd9Sstevel@tonic-gate prt_sef, /* SEF -- print semsys flags */
30537c478bd9Sstevel@tonic-gate prt_shc, /* SHC -- print shmsys command */
30547c478bd9Sstevel@tonic-gate prt_shf, /* SHF -- print shmsys flags */
3055794f0adbSRoger A. Faulkner prt_fat, /* FAT -- print faccessat( flag */
30567c478bd9Sstevel@tonic-gate prt_sfs, /* SFS -- print sysfs code */
30577c478bd9Sstevel@tonic-gate prt_rst, /* RST -- print string returned by syscall */
30587c478bd9Sstevel@tonic-gate prt_smf, /* SMF -- print streams message flags */
30597c478bd9Sstevel@tonic-gate prt_ioa, /* IOA -- print ioctl argument */
30605dbfd19aSTheo Schlossnagle prt_pip, /* PIP -- print pipe flags */
30617c478bd9Sstevel@tonic-gate prt_mtf, /* MTF -- print mount flags */
30627c478bd9Sstevel@tonic-gate prt_mft, /* MFT -- print mount file system type */
30637c478bd9Sstevel@tonic-gate prt_iob, /* IOB -- print contents of I/O buffer */
30647c478bd9Sstevel@tonic-gate prt_hhx, /* HHX -- print value in hexadecimal (half size) */
30657c478bd9Sstevel@tonic-gate prt_wop, /* WOP -- print waitsys() options */
30667c478bd9Sstevel@tonic-gate prt_spm, /* SPM -- print sigprocmask argument */
30677c478bd9Sstevel@tonic-gate prt_rlk, /* RLK -- print readlink buffer */
30687c478bd9Sstevel@tonic-gate prt_mpr, /* MPR -- print mmap()/mprotect() flags */
30697c478bd9Sstevel@tonic-gate prt_mty, /* MTY -- print mmap() mapping type flags */
30707c478bd9Sstevel@tonic-gate prt_mcf, /* MCF -- print memcntl() function */
30717c478bd9Sstevel@tonic-gate prt_mc4, /* MC4 -- print memcntl() (fourth) argument */
30727c478bd9Sstevel@tonic-gate prt_mc5, /* MC5 -- print memcntl() (fifth) argument */
30737c478bd9Sstevel@tonic-gate prt_mad, /* MAD -- print madvise() argument */
30747c478bd9Sstevel@tonic-gate prt_ulm, /* ULM -- print ulimit() argument */
30757c478bd9Sstevel@tonic-gate prt_rlm, /* RLM -- print get/setrlimit() argument */
30767c478bd9Sstevel@tonic-gate prt_cnf, /* CNF -- print sysconfig() argument */
30777c478bd9Sstevel@tonic-gate prt_inf, /* INF -- print sysinfo() argument */
30787c478bd9Sstevel@tonic-gate prt_ptc, /* PTC -- print pathconf/fpathconf() argument */
30797c478bd9Sstevel@tonic-gate prt_fui, /* FUI -- print fusers() input argument */
30807c478bd9Sstevel@tonic-gate prt_idt, /* IDT -- print idtype_t, waitid() argument */
30817c478bd9Sstevel@tonic-gate prt_lwf, /* LWF -- print lwp_create() flags */
30827c478bd9Sstevel@tonic-gate prt_itm, /* ITM -- print [get|set]itimer() arg */
30837c478bd9Sstevel@tonic-gate prt_llo, /* LLO -- print long long offset arg */
30847c478bd9Sstevel@tonic-gate prt_mod, /* MOD -- print modctl() subcode */
30857c478bd9Sstevel@tonic-gate prt_whn, /* WHN -- print lseek() whence arguiment */
30867c478bd9Sstevel@tonic-gate prt_acl, /* ACL -- print acl() code */
30877c478bd9Sstevel@tonic-gate prt_aio, /* AIO -- print kaio() code */
30887c478bd9Sstevel@tonic-gate prt_aud, /* AUD -- print auditsys() code */
30897c478bd9Sstevel@tonic-gate prt_uns, /* DEC -- print value in unsigned decimal */
30907c478bd9Sstevel@tonic-gate prt_clc, /* CLC -- print cladm command argument */
30917c478bd9Sstevel@tonic-gate prt_clf, /* CLF -- print cladm flag argument */
30927c478bd9Sstevel@tonic-gate prt_cor, /* COR -- print corectl() subcode */
30937c478bd9Sstevel@tonic-gate prt_cco, /* CCO -- print corectl() options */
30947c478bd9Sstevel@tonic-gate prt_ccc, /* CCC -- print corectl() content */
30957c478bd9Sstevel@tonic-gate prt_rcc, /* RCC -- print corectl() returned content */
30967c478bd9Sstevel@tonic-gate prt_cpc, /* CPC -- print cpc() subcode */
30977c478bd9Sstevel@tonic-gate prt_sqc, /* SQC -- print sigqueue() si_code argument */
30987c478bd9Sstevel@tonic-gate prt_pc4, /* PC4 -- print priocntlsys() (fourth) argument */
30997c478bd9Sstevel@tonic-gate prt_pc5, /* PC5 -- print priocntlsys() (key, value) pairs */
31007c478bd9Sstevel@tonic-gate prt_pst, /* PST -- print processor set id */
31017c478bd9Sstevel@tonic-gate prt_mif, /* MIF -- print meminfo() arguments */
31027c478bd9Sstevel@tonic-gate prt_pfm, /* PFM -- print so_socket() proto-family (1st) arg */
31037c478bd9Sstevel@tonic-gate prt_skt, /* SKT -- print so_socket() socket-type (2nd) arg */
31047c478bd9Sstevel@tonic-gate prt_skp, /* SKP -- print so_socket() protocol (3rd) arg */
31057c478bd9Sstevel@tonic-gate prt_skv, /* SKV -- print socket version arg */
31067c478bd9Sstevel@tonic-gate prt_sol, /* SOL -- print [sg]etsockopt() level (2nd) arg */
31077c478bd9Sstevel@tonic-gate prt_son, /* SON -- print [sg]etsockopt() opt-name (3rd) arg */
31087c478bd9Sstevel@tonic-gate prt_utt, /* UTT -- print utrap type */
31097c478bd9Sstevel@tonic-gate prt_uth, /* UTH -- print utrap handler */
31107c478bd9Sstevel@tonic-gate prt_acc, /* ACC -- print access() flags */
31117c478bd9Sstevel@tonic-gate prt_sht, /* SHT -- print shutdown() how (2nd) argument */
31127c478bd9Sstevel@tonic-gate prt_ffg, /* FFG -- print fcntl() flags (3rd) argument */
31137c478bd9Sstevel@tonic-gate prt_prs, /* PRS -- print privilege set */
31147c478bd9Sstevel@tonic-gate prt_pro, /* PRO -- print privilege set operation */
31157c478bd9Sstevel@tonic-gate prt_prn, /* PRN -- print privilege set name */
31167c478bd9Sstevel@tonic-gate prt_pfl, /* PFL -- print privilege/process flag name */
31177c478bd9Sstevel@tonic-gate prt_laf, /* LAF -- print lgrp_affinity arguments */
31187c478bd9Sstevel@tonic-gate prt_key, /* KEY -- print key_t 0 as IPC_PRIVATE */
31197c478bd9Sstevel@tonic-gate prt_zga, /* ZGA -- print zone_getattr attribute types */
31207c478bd9Sstevel@tonic-gate prt_atc, /* ATC -- print AT_FDCWD or file descriptor */
31217c478bd9Sstevel@tonic-gate prt_lio, /* LIO -- print LIO_XX flags */
31227c478bd9Sstevel@tonic-gate prt_dfl, /* DFL -- print door_create() flags */
31237c478bd9Sstevel@tonic-gate prt_dpm, /* DPM -- print DOOR_PARAM_XX flags */
312445916cd2Sjpk prt_tnd, /* TND -- print trusted network data base opcode */
3125aa4a4f3bSnf prt_rsc, /* RSC -- print rctlsys() subcodes */
3126aa4a4f3bSnf prt_rgf, /* RGF -- print getrctl() flags */
3127aa4a4f3bSnf prt_rsf, /* RSF -- print setrctl() flags */
3128aa4a4f3bSnf prt_rcf, /* RCF -- print rctlsys_ctl() flags */
3129657b1f3dSraf prt_fxf, /* FXF -- print forkx() flags */
3130532877c4Srd prt_spf, /* SPF -- print rctlsys_projset() flags */
3131f48205beScasper prt_un1, /* UN1 -- as prt_uns except for -1 */
3132bcddb677SAli Bahrami prt_mob, /* MOB -- print mmapobj() flags */
3133794f0adbSRoger A. Faulkner prt_snf, /* SNF -- print AT_SYMLINK_[NO]FOLLOW flag */
31343e95bd4aSAnders Persson prt_skc, /* SKC -- print sockconfig() subcode */
31355dbfd19aSTheo Schlossnagle prt_acf, /* ACF -- print accept4 flags */
31365dbfd19aSTheo Schlossnagle prt_pfd, /* PFD -- print pipe fds */
31379d12795fSRobert Mustacchi prt_grf, /* GRF -- print getrandom flags */
3138d2a70789SRichard Lowe prt_psdelta, /* PSDLT -- print psecflags(2) delta */
3139d2a70789SRichard Lowe prt_psfw, /* PSFW -- print psecflags(2) set */
3140*2b395c3cSAndy Fiddaman prt_exc, /* EXC -- print execvex() flags */
31417c478bd9Sstevel@tonic-gate prt_dec, /* HID -- hidden argument, make this the last one */
31427c478bd9Sstevel@tonic-gate };
3143