4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2017 Joyent, Inc.
25 * Copyright (c) 2013 by Delphix. All rights reserved.
26 */
27
28 #include <mdb/mdb_param.h>
29 #include <mdb/mdb_modapi.h>
30 #include <mdb/mdb_ks.h>
31 #include <mdb/mdb_ctf.h>
32
33 #include <sys/types.h>
34 #include <sys/thread.h>
35 #include <sys/session.h>
36 #include <sys/user.h>
37 #include <sys/proc.h>
38 #include <sys/var.h>
39 #include <sys/t_lock.h>
40 #include <sys/callo.h>
41 #include <sys/priocntl.h>
42 #include <sys/class.h>
43 #include <sys/regset.h>
44 #include <sys/stack.h>
147 static int
148 ps_threadprint(uintptr_t addr, const void *data, void *private)
149 {
150 const kthread_t *t = (const kthread_t *)data;
151 uint_t prt_flags = *((uint_t *)private);
152
153 static const mdb_bitmask_t t_state_bits[] = {
154 { "TS_FREE", UINT_MAX, TS_FREE },
155 { "TS_SLEEP", TS_SLEEP, TS_SLEEP },
156 { "TS_RUN", TS_RUN, TS_RUN },
157 { "TS_ONPROC", TS_ONPROC, TS_ONPROC },
158 { "TS_ZOMB", TS_ZOMB, TS_ZOMB },
159 { "TS_STOPPED", TS_STOPPED, TS_STOPPED },
160 { "TS_WAIT", TS_WAIT, TS_WAIT },
161 { NULL, 0, 0 }
162 };
163
164 if (prt_flags & PS_PRTTHREADS)
165 mdb_printf("\tT %?a <%b>\n", addr, t->t_state, t_state_bits);
166
167 if (prt_flags & PS_PRTLWPS)
168 mdb_printf("\tL %?a ID: %u\n", t->t_lwp, t->t_tid);
169
170 return (WALK_NEXT);
171 }
172
173 typedef struct mdb_pflags_proc {
174 struct pid *p_pidp;
175 ushort_t p_pidflag;
176 uint_t p_proc_flag;
177 uint_t p_flag;
178 } mdb_pflags_proc_t;
179
180 static int
181 pflags(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
182 {
183 mdb_pflags_proc_t pr;
184 struct pid pid;
185
186 static const mdb_bitmask_t p_flag_bits[] = {
187 { "SSYS", SSYS, SSYS },
188 { "SEXITING", SEXITING, SEXITING },
189 { "SITBUSY", SITBUSY, SITBUSY },
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2018, Joyent, Inc.
25 * Copyright (c) 2013 by Delphix. All rights reserved.
26 */
27
28 #include <mdb/mdb_param.h>
29 #include <mdb/mdb_modapi.h>
30 #include <mdb/mdb_ks.h>
31 #include <mdb/mdb_ctf.h>
32
33 #include <sys/types.h>
34 #include <sys/thread.h>
35 #include <sys/session.h>
36 #include <sys/user.h>
37 #include <sys/proc.h>
38 #include <sys/var.h>
39 #include <sys/t_lock.h>
40 #include <sys/callo.h>
41 #include <sys/priocntl.h>
42 #include <sys/class.h>
43 #include <sys/regset.h>
44 #include <sys/stack.h>
147 static int
148 ps_threadprint(uintptr_t addr, const void *data, void *private)
149 {
150 const kthread_t *t = (const kthread_t *)data;
151 uint_t prt_flags = *((uint_t *)private);
152
153 static const mdb_bitmask_t t_state_bits[] = {
154 { "TS_FREE", UINT_MAX, TS_FREE },
155 { "TS_SLEEP", TS_SLEEP, TS_SLEEP },
156 { "TS_RUN", TS_RUN, TS_RUN },
157 { "TS_ONPROC", TS_ONPROC, TS_ONPROC },
158 { "TS_ZOMB", TS_ZOMB, TS_ZOMB },
159 { "TS_STOPPED", TS_STOPPED, TS_STOPPED },
160 { "TS_WAIT", TS_WAIT, TS_WAIT },
161 { NULL, 0, 0 }
162 };
163
164 if (prt_flags & PS_PRTTHREADS)
165 mdb_printf("\tT %?a <%b>\n", addr, t->t_state, t_state_bits);
166
167 if (prt_flags & PS_PRTLWPS) {
168 char desc[128] = "";
169
170 (void) thread_getdesc(addr, B_FALSE, desc, sizeof (desc));
171
172 mdb_printf("\tL %?a ID: %s\n", t->t_lwp, desc);
173 }
174
175 return (WALK_NEXT);
176 }
177
178 typedef struct mdb_pflags_proc {
179 struct pid *p_pidp;
180 ushort_t p_pidflag;
181 uint_t p_proc_flag;
182 uint_t p_flag;
183 } mdb_pflags_proc_t;
184
185 static int
186 pflags(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
187 {
188 mdb_pflags_proc_t pr;
189 struct pid pid;
190
191 static const mdb_bitmask_t p_flag_bits[] = {
192 { "SSYS", SSYS, SSYS },
193 { "SEXITING", SEXITING, SEXITING },
194 { "SITBUSY", SITBUSY, SITBUSY },
|