Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ td_thr_get_info(3T) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

libthread(3T)

libthread_db(3T)

td_ta_thr_iter(3T)

td_thr_dbsuspend(3T)

thr_create(3T)

thr_getprio(3T)

thr_join(3T)

thr_sigsetmask(3T)

thr_suspend(3T)

libthread(4)

libthread_db(4)

attributes(5)

td_thr_get_info(3T)

NAME

td_thr_get_info − get thread information in libthread_db library of interfaces

SYNOPSIS

cc [ flag ... ] file ... /lib/libthread_db.so.1 [ library ... ]

#include <proc_service.h>
#include <thread_db.h>

td_err_e td_thr_get_info(const td_thrhandle_t ∗th_p,

td_thrinfo_t ∗ti_p);

DESCRIPTION

The td_thr_get_info() routine fills in the td_thrinfo_t structure ∗ti_p with values for the thread identified by th_p.

The td_thrinfo_t structure contains the following fields:

typedef struct td_thrinfo_t {
td_thragen_t∗ti_ta_p/∗ internal process handle ∗/
unsignedti_user_flags;/∗ value of flags parameter ∗/
thread_tti_tid;/∗ thread identifier ∗/
char∗ti_tls;/∗ pointer to thread-local storage∗/
paddrti_startfunc;/∗ address of function at which thread execution began∗/
paddrti_stkbase;/∗ base of thread’s stack area∗/
intti_stksize;/∗ size in bytes of thread’s allocated stack region∗/
paddrti_ro_area;/∗ address of uthread_t structure∗/
intti_ro_size/∗ size of the uthread_t structure in bytes ∗/
td_thr_state_eti_state /∗ state of the thread ∗/
uchar_tti_db_suspended/∗ non-zero if thread suspended by td_thr_dbsuspend∗/
td_thr_type_eti_type/∗ type of the thread∗/
intti_pc/∗ value of thread’s program counter∗/
intti_sp/∗ value of thread’s stack counter∗/
shortti_flags/∗ set of special flags used by libthread∗/
intti_pri/∗ priority of thread returned by thr_getprio(3T)∗/
lwpid_tti_lid/∗ id of light weight process (LWP) executing this thread∗/
sigset_tti_sigmask/∗ thread’s signal mask.  See thr_sigsetmask(3T)∗/
u_charti_traceme/∗ non-zero if event tracing is on∗/
u_char_tti_preemptflag/∗ non-zero if thread preempted when last active∗/
u_char_tti_pirecflag/∗ non-zero if thread runs priority beside regular ∗/
sigset_tti_pending/∗ set of signals pending for this thread∗/
td_thr_events_tti_events /∗ bitmap of events enabled for this thread∗/
};

td_thragent_t ∗ti_ta_p is the internal process handle identifying the process of which the thread is a member. 

unsigned ti_user_flags is the value of the flags parameter passed to thr_create(3T) when the thread was created. 

thread_t ti_tid is the thread identifier for the thread returned by libthread when created with thr_create(3T). 

char ∗ti_tls is the thread’s pointer to thread-local storage. 

psaddr_t ti_startfunc is the address of the function at which thread execution began, as specified when the thread was created with thr_create(3T). 

psaddr_t ti_stkbase is the base of the thread’s stack area. 

int ti_stksize is the size in bytes of the thread’s allocated stack region. 

psaddr_t ti_ro_area is the address of the libthread-internal uthread_t structure for this thread.  Since accessing the uthread_t structure directly violates the encapsulation provided by libthread_db, this field should generally not be used.  However, it may be useful as a prototype for extensions. 

td_thr_state_e ti_state is the state in which the thread is.  The td_thr_state_e enumeration type may contain the following values:

TD_THR_ANY_STATE Never returned by td_thr_get_info.  TD_THR_ANY_STATE is used as a wildcard to select threads in td_ta_thr_iter(). 

TD_THR_UNKNOWN libthread_db cannot determine the state of the thread. 

TD_THR_STOPPED The thread has been stopped by a call to thr_suspend(3T). 

TD_THR_RUN The thread is runnable, but it is not currently assigned to a LWP. 

TD_THR_ACTIVE The thread is currently executing on a LWP. 

TD_THR_ZOMBIE The thread has exited, but it has not yet been deallocated by a call to thr_join(3T). 

TD_THR_SLEEP The thread is not currently runnable. 

TD_THR_STOPPED_ASLEEP
The thread is both blocked by TD_THR_SLEEP, and stopped by a call to td_thr_dbsuspend(3T). 

uchar_t ti_db_suspended is non-zero if and only if this thread is currently suspended because the controlling process has called td_thr_dbsuspend on it. 

td_thr_type_e ti_type is a type of thread.  It will be either TD_THR_USER for a user thread (one created by the application), or TD_THR_SYSTEM for one created by libthread. 

int ti_pc is the value of the thread’s program counter, provided that the thread’s ti_state value is TD_THR_SLEEP, TD_THR_STOPPED , or TD_THR_STOPPED_ASLEEP. Otherwise, the value of this field is undefined. 

int ti_sp is the value of the thread’s stack pointer, provided that the thread’s ti_state value is TD_THR_SLEEP, TD_THR_STOPPED , or TD_THR_STOPPED_ASLEEP. Otherwise, the value of this field is undefined. 

short ti_flags is a set of special flags used by libthread, currently of use only to those debugging libthread. 

int ti_pri is the thread’s priority, as it would be returned by thr_getprio(3T). 

lwpid_t ti_lid is the ID of the LWP executing this thread, or the ID of the LWP that last executed this thread, if this thread is not currently assigned to a LWP. 

sigset_t ti_sigmask is this thread’s signal mask. See thr_sigsetmask(3T). 

u_char ti_traceme is non-zero if and only if event tracing for this thread is on. 

uchar_t ti_preemptflag is non-zero if and only if the thread was preempted the last time it was active. 

uchar_t ti_pirecflag is non-zero if and only if due to priority inheritance the thread is currently running at a priority other than its regular priority. 

td_thr_events_t ti_events is the bitmap of events enabled for this thread. 

RETURN VALUES

TD_OK The call completed successfully. 

TD_BADTH An invalid thread handle was passed in. 

TD_DBERR A call to one of the imported interface routines failed. 

TD_ERR The call did not complete successfully. 

ATTRIBUTES

See attributes(5) for description of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level Safe

SEE ALSO

libthread(3T), libthread_db(3T), td_ta_thr_iter(3T), td_thr_dbsuspend(3T), thr_create(3T), thr_getprio(3T), thr_join(3T), thr_sigsetmask(3T), thr_suspend(3T), libthread(4), libthread_db(4), attributes(5)

SunOS 5.6  —  Last change: 6 Jan 1997

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026