summaryrefslogtreecommitdiff
path: root/usr/src/man/man3c_db/td_thr_get_info.3c_db
blob: eb178def2c81d9f3366c9cfc74a4bb3d8b900360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
'\" te
.\"  All Rights Reserved  Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH TD_THR_GET_INFO 3C_DB "June 20, 2021"
.SH NAME
td_thr_get_info \- get thread information in libc_db library of interfaces
.SH SYNOPSIS
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lc_db [ \fIlibrary\fR... ]
#include <proc_service.h>
#include <thread_db.h>

\fBtd_err_e\fR \fBtd_thr_get_info\fR(\fBconst td_thrhandle_t *\fR\fIth_p\fR, \fBtd_thrinfo_t *\fR\fIti_p\fR);
.fi

.SH DESCRIPTION
The \fBtd_thr_get_info()\fR function fills in the \fBtd_thrinfo_t\fR structure
*\fIti_p\fR with values for the thread identified by \fIth_p\fR.
.sp
.LP
The \fBtd_thrinfo_t\fR structure contains the following fields:
.sp
.in +2
.nf
typedef struct td_thrinfo_t {
  td_thragen_tx    *ti_ta_p           /* internal process handle */
  unsigned         ti_user_flags;     /* value of flags parameter */
  thread_t         ti_tid;            /* thread identifier */
  char             *ti_tls;           /* pointer to thread-local storage*/
  paddr            ti_startfunc;      /* address of function at which thread
                                         execution began*/
  paddr            ti_stkbase;        /* base of thread's stack area*/
  int              ti_stksize;        /* size in bytes of thread's allocated
                                         stack region*/
  paddr            ti_ro_area;        /* address of ulwp_t structure*/
  int              ti_ro_size         /* size of the ulwp_t structure in
                                         bytes */
  td_thr_state_e   ti_state           /* state of the thread */
  uchar_t          ti_db_suspended    /* non-zero if thread suspended by
                                         td_thr_dbsuspend*/
  td_thr_type_e    ti_type            /* type of the thread*/
  int              ti_pc              /* value of thread's program counter*/
  int              ti_sp              /* value of thread's stack counter*/
  short            ti_flags           /* set of special flags used by
                                         libc*/
  int              ti_pri             /* priority of thread returned by
                                         thr_getprio(3C)*/
  lwpid_t          ti_lid             /* id of light weight process (LWP)
                                         executing this thread*/
  sigset_t         ti_sigmask         /* thread's signal mask.  See
                                         thr_sigsetmask(3C)*/
  u_char           ti_traceme         /* non-zero if event tracing is on*/
  u_char_t         ti_preemptflag     /* non-zero if thread preempted when
                                         last active*/
  u_char_t         ti_pirecflag      /* non-zero if thread runs priority
                                        beside regular */
  sigset_t         ti_pending        /* set of signals pending for this
                                        thread*/
  td_thr_events_t  ti_events         /* bitmap of events enabled for this
                                        thread*/
} ;
.fi
.in -2

.sp
.LP
The \fBti_ta_p\fR member is the internal process handle identifying the process
of which the thread is a member.
.sp
.LP
The \fBti_user_flags\fR member is the value of the flags parameter passed to
\fBthr_create\fR(3C) when the thread was created.
.sp
.LP
The \fBti_tid\fR member is the thread identifier for the thread returned by
\fBthr_create\fR(3C).
.sp
.LP
The \fBti_tls\fR member is the thread's pointer to thread-local storage.
.sp
.LP
The \fBti_startfunc\fR member is the address of the function at which thread
execution began, as specified when the thread was created with
\fBthr_create\fR(3C).
.sp
.LP
The \fBti_stkbase\fR member is the base of the thread's stack area.
.sp
.LP
The \fBti_stksize\fR member is the size in bytes of the thread's allocated
stack region.
.sp
.LP
The \fBti_ro_area\fR member is the address of the \fBulwp_t\fR structure for
this thread.  Since accessing the \fBulwp_t\fR structure directly violates the
encapsulation provided by \fBlibc_db\fR, this member should generally not be
used.  However, it might be useful as a prototype for extensions.
.sp
.LP
The \fBti_state\fR member is the state of the thread.  The \fBtd_thr_state_e\fR
enumeration type can contain the following values:
.sp
.ne 2
.na
\fB\fBTD_THR_ANY_STATE\fR \fR
.ad
.RS 26n
This value is never returned by \fBtd_thr_get_info()\fR but is used as a
wildcard to select threads in \fBtd_ta_thr_iter()\fR.
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_UNKNOWN\fR \fR
.ad
.RS 26n
The \fBlibc_db\fR library cannot determine the state of the thread.
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_STOPPED\fR \fR
.ad
.RS 26n
The thread has been stopped by a call to \fBthr_suspend\fR(3C).
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_RUN\fR \fR
.ad
.RS 26n
The thread is runnable, but it is not currently assigned to an \fBLWP\fR.
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_ACTIVE\fR \fR
.ad
.RS 26n
The thread is currently executing on an \fBLWP\fR.
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_ZOMBIE\fR \fR
.ad
.RS 26n
The thread has exited, but it has not yet been deallocated by a call to
\fBthr_join\fR(3C).
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_SLEEP\fR \fR
.ad
.RS 26n
The thread is not currently runnable.
.RE

.sp
.ne 2
.na
\fB\fBTD_THR_STOPPED_ASLEEP\fR \fR
.ad
.RS 26n
The thread is both blocked by \fBTD_THR_SLEEP\fR and stopped by a call to
\fBtd_thr_dbsuspend\fR(3C_DB).
.RE

.sp
.LP
The \fBti_db_suspended\fR member is non-zero if and only if this thread is
currently suspended because the controlling process has called
\fBtd_thr_dbsuspend\fR on it.
.sp
.LP
The \fBti_type\fR member is a type of thread.  It is either \fBTD_THR_USER\fR
for a user thread (one created by the application), or \fBTD_THR_SYSTEM\fR for
one created by \fBlibc\fR.
.sp
.LP
The \fBti_pc\fR member is the value of the thread's program counter, provided
that the thread's \fBti_state\fR value is \fBTD_THR_SLEEP\fR,
\fBTD_THR_STOPPED\fR, or \fBTD_THR_STOPPED_ASLEEP\fR. Otherwise, the value of
this member is undefined.
.sp
.LP
The \fBti_sp\fR member is the value of the thread's stack pointer, provided
that the thread's \fBti_state\fR value is \fBTD_THR_SLEEP\fR,
\fBTD_THR_STOPPED\fR, or \fBTD_THR_STOPPED_ASLEEP\fR. Otherwise, the value of
this member is undefined.
.sp
.LP
The \fBti_flags\fR member is a set of special flags used by \fBlibc\fR,
currently of use only to those debugging \fBlibc\fR.
.sp
.LP
The \fBti_pri\fR member is the thread's priority as it would be returned by
\fBthr_getprio\fR(3C).
.sp
.LP
The \fBti_lid\fR member is the ID of the \fBLWP\fR executing this thread, or
the ID of the \fBLWP\fR that last executed this thread, if this thread is not
currently assigned to an \fBLWP\fR.
.sp
.LP
The \fBti_sigmask\fR member is this thread's signal mask. See
\fBthr_sigsetmask\fR(3C).
.sp
.LP
The \fBti_traceme\fR member is non-zero if and only if event tracing for this
thread is on.
.sp
.LP
The \fBti_preemptflag\fR member is non-zero if and only if the thread was
preempted the last time it was active.
.sp
.LP
The \fBti_pirecflag\fR member is non-zero if and only if due to priority
inheritance the thread is currently running at a priority other than its
regular priority.
.sp
.LP
The \fBti_events\fR member is the bitmap of events enabled for this thread.
.SH RETURN VALUES
.ne 2
.na
\fB\fBTD_OK\fR\fR
.ad
.RS 12n
The call completed successfully.
.RE

.sp
.ne 2
.na
\fB\fBTD_BADTH\fR\fR
.ad
.RS 12n
An invalid thread handle was passed in.
.RE

.sp
.ne 2
.na
\fB\fBTD_DBERR\fR\fR
.ad
.RS 12n
A call to one of the imported interface routines failed.
.RE

.sp
.ne 2
.na
\fB\fBTD_ERR\fR\fR
.ad
.RS 12n
The call did not complete successfully.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	Safe
.TE

.SH SEE ALSO
\fBlibc_db\fR(3LIB), \fBtd_ta_thr_iter\fR(3C_DB),
\fBtd_thr_dbsuspend\fR(3C_DB), \fBthr_create\fR(3C),
.BR thr_getprio (3C),
.BR thr_join (3C),
.BR thr_sigsetmask (3C),
.BR thr_suspend (3C),
.BR attributes (7),
.BR threads (7)