4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
37 #include <sys/types.h>
44 * Function prototypes for static routines in this module.
46 const char *idop_enum(private_t
*, idop_t
);
49 show_procset(private_t
*pri
, long offset
)
52 procset_t
*psp
= &procset
;
54 if (Pread(Proc
, psp
, sizeof (*psp
), offset
) == sizeof (*psp
)) {
55 (void) printf("%s\top=%s",
56 pri
->pname
, idop_enum(pri
, psp
->p_op
));
57 (void) printf(" ltyp=%s lid=%ld",
58 idtype_enum(pri
, psp
->p_lidtype
), (long)psp
->p_lid
);
59 (void) printf(" rtyp=%s rid=%ld\n",
60 idtype_enum(pri
, psp
->p_ridtype
), (long)psp
->p_rid
);
65 idop_enum(private_t
*pri
, idop_t arg
)
70 case POP_DIFF
: str
= "POP_DIFF"; break;
71 case POP_AND
: str
= "POP_AND"; break;
72 case POP_OR
: str
= "POP_OR"; break;
73 case POP_XOR
: str
= "POP_XOR"; break;
75 (void) sprintf(pri
->code_buf
, "%d", arg
);
76 str
= (const char *)pri
->code_buf
;
84 idtype_enum(private_t
*pri
, long arg
)
89 case P_PID
: str
= "P_PID"; break;
90 case P_PPID
: str
= "P_PPID"; break;
91 case P_PGID
: str
= "P_PGID"; break;
92 case P_SID
: str
= "P_SID"; break;
93 case P_CID
: str
= "P_CID"; break;
94 case P_UID
: str
= "P_UID"; break;
95 case P_GID
: str
= "P_GID"; break;
96 case P_ALL
: str
= "P_ALL"; break;
97 case P_LWPID
: str
= "P_LWPID"; break;
98 case P_TASKID
: str
= "P_TASKID"; break;
99 case P_PROJID
: str
= "P_PROJID"; break;
100 case P_ZONEID
: str
= "P_ZONEID"; break;
101 case P_CTID
: str
= "P_CTID"; break;
103 (void) sprintf(pri
->code_buf
, "%ld", arg
);
104 str
= (const char *)pri
->code_buf
;
112 woptions(private_t
*pri
, int arg
)
114 char *str
= pri
->code_buf
;
119 ~(WEXITED
|WTRAPPED
|WSTOPPED
|WCONTINUED
|WNOHANG
|WNOWAIT
))
124 (void) strcat(str
, "|WEXITED");
126 (void) strcat(str
, "|WTRAPPED");
128 (void) strcat(str
, "|WSTOPPED");
129 if (arg
& WCONTINUED
)
130 (void) strcat(str
, "|WCONTINUED");
132 (void) strcat(str
, "|WNOHANG");
134 (void) strcat(str
, "|WNOWAIT");
136 return ((const char *)(str
+1));