Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Threads Library Functionstd_thr_get_info(3THR)


NAME

 td_thr_get_info - get thread information in libthread_db library of interfaces

SYNOPSIS

 
cc [ flag ... ] file ... -lthread_db [ 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() function 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_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 uthread_t structure*/
  int              ti_ro_size         /* size of the uthread_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 
                                         libthread*/
  int              ti_pri             /* priority of thread returned by 
                                         thr_getprio(3T)*/
  lwpid_t          ti_lid             /* id of light weight process (LWP) 
                                         executing this thread*/
  sigset_t         ti_sigmask         /* thread's signal mask.  See 
                                         thr_sigsetmask(3T)*/
  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*/
} ;

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(3THR) when the thread was created.

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

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(3THR).

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(3THR).
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(3THR).
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(3THR).

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(3THR).

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(3THR).

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 TYPEATTRIBUTE VALUE
MT-LevelSafe

SEE ALSO

 

libthread(3LIB), libthread_db(3LIB), libthread_db(3THR), td_ta_thr_iter(3THR), td_thr_dbsuspend(3THR), thr_create(3THR), thr_getprio(3THR), thr_join(3THR), thr_sigsetmask(3THR), thr_suspend(3THR), threads(3THR), attributes(5)


SunOS 5.9Go To TopLast Changed 20 Oct 1998

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.