2 .\" All Rights Reserved Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH TD_TA_SYNC_ITER 3C_DB "Jun 19, 2001"
8 td_ta_sync_iter, td_ta_thr_iter, td_ta_tsd_iter \- iterator functions on
9 process handles from libc_db
13 cc [ \fIflag\fR... ] \fIfile\fR... -lc_db [ \fIlibrary\fR... ]
14 #include <proc_service.h>
15 #include <thread_db.h>
17 \fBtypedef int\fR \fBtd_sync_iter_f\fR(\fBconst td_synchandle_t *\fR\fIsh_p\fR, \fBvoid *\fR\fIcbdata_p\fR);
22 \fBtypedef int\fR \fBtd_thr_iter_f\fR(\fBconst td_thrhandle_t *\fR\fIth_p\fR, \fBvoid *\fR\fIcbdata_p\fR);
27 \fBtypedef int\fR \fBtd_key_iter_f\fR(\fBthread_key_t\fR \fIkey\fR, \fBvoid (*\fR\fIdestructor\fR)(), \fBvoid *\fR\fIcbdata_p\fR);
32 \fBtd_err_e\fR \fBtd_ta_sync_iter\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBtd_sync_iter_f *\fR\fIcb\fR,
33 \fBvoid *\fR\fIcbdata_p\fR);
38 \fBtd_err_e\fR \fBtd_ta_thr_iter\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBtd_thr_iter_f *\fR\fIcb\fR,
39 \fBvoid *\fR\fIcbdata_p\fR, \fBtd_thr_state_e\fR \fIstate\fR, \fBint\fR \fIti_pri\fR, \fBsigset_t *\fR\fIti_sigmask_p\fR,
40 \fBunsigned\fR \fIti_user_flags\fR);
45 \fBtd_err_e\fR \fBtd_ta_tsd_iter\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBtd_key_iter_f *\fR\fIcb\fR,
46 \fBvoid *\fR\fIcbdata_p\fR);
52 The \fBtd_ta_sync_iter()\fR, \fBtd_ta_thr_iter()\fR, and \fBtd_ta_tsd_iter()\fR
53 functions are iterator functions that when given a target process handle as an
54 argument, return sets of handles for objects associated with the target
55 process. The method is to call back a client-provided function once for each
56 associated object, passing back a handle as well as the client-provided pointer
57 \fIcb_data_p\fR. This enables a client to easily build a linked list of the
58 associated objects. If the client-provided function returns non-zero, the
59 iteration terminates, even if there are members remaining in the set of
63 The \fBtd_ta_sync_iter()\fR function returns handles of synchronization objects
64 (mutexes, readers-writer locks, semaphores, and condition variables) associated
65 with a process. Some synchronization objects might not be known to
66 \fBlibc_db\fR and will not be returned. If the process has initialized the
67 synchronization object (by calling \fBmutex_init\fR(3C), for example) or a
68 thread in the process has called a synchronization primitive
69 (\fBmutex_lock()\fR, for example) using this object after
70 \fBtd_ta_new\fR(3C_DB) was called to attach to the process and
71 \fBtd_ta_sync_tracking_enable()\fR was called to enable synchronization object
72 tracking, then a handle for the synchronization object will be passed to the
73 callback function. See \fBtd_sync_get_info\fR(3C_DB) for operations that can be
74 performed on synchronization object handles.
77 The \fBtd_ta_thr_iter()\fR function returns handles for threads that are part
78 of the target process. For \fBtd_ta_thr_iter()\fR, the caller specifies
79 several criteria to select a subset of threads for which the callback function
80 should be called. Any of these selection criteria may be wild-carded. If all
81 of them are wild-carded, then handles for all threads in the process will be
85 The selection parameters and corresponding wild-card values are:
89 \fB\fBstate (TD_THR_ANY_STATE\fR):\fR
93 Select only threads whose state matches \fBstate\fR. See
94 \fBtd_thr_get_info\fR(3C_DB) for a list of thread states.
100 \fB\fBti_pri (TD_THR_LOWEST_PRIORITY\fR):\fR
104 Select only threads for which the priority is at least \fBti_pri\fR.
110 \fB\fBti_sigmask_p (TD_SIGNO_MASK\fR):\fR
114 Select only threads whose signal mask exactly matches *\fIti_sigmask_p\fR.
120 \fB\fBti_user_flags (TD_THR_ANY_USER_FLAGS\fR):\fR
124 Select only threads whose user flags (specified at thread creation time)
125 exactly match \fIti_user_flags\fR.
130 The \fBtd_ta_tsd_iter()\fR function returns the thread-specific data keys in
131 use by the current process. Thread-specific data for a particular thread and
132 key can be obtained by calling \fBtd_thr_tsd\fR(3C_DB).
140 The call completed successfully.
149 An invalid process handle was passed.
158 A call to one of the imported interface routines failed.
167 The call did not complete successfully.
173 See \fBattributes\fR(5) for description of the following attributes:
181 ATTRIBUTE TYPE ATTRIBUTE VALUE
189 \fBlibc_db\fR(3LIB), \fBmutex_init\fR(3C), \fBtd_sync_get_info\fR(3C_DB),
190 \fBtd_thr_get_info\fR(3C_DB), \fBtd_thr_tsd\fR(3C_DB), \fBattributes\fR(5)