xref: /titanic_51/usr/src/head/thread_db.h (revision 95c76875f497cd4252dee634bfc7ae38fa845505)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*95c76875Sraf  * Common Development and Distribution License (the "License").
6*95c76875Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*95c76875Sraf 
227c478bd9Sstevel@tonic-gate /*
23*95c76875Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _THREAD_DB_H
287c478bd9Sstevel@tonic-gate #define	_THREAD_DB_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  *  Description:
357c478bd9Sstevel@tonic-gate  *	Types, global variables, and function definitions for users
367c478bd9Sstevel@tonic-gate  *	of libc_db (formerly libthread_db).
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <sys/lwp.h>
427c478bd9Sstevel@tonic-gate #include <sys/procfs_isa.h>
437c478bd9Sstevel@tonic-gate #include <thread.h>
447c478bd9Sstevel@tonic-gate #include <proc_service.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef __cplusplus
477c478bd9Sstevel@tonic-gate extern "C" {
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #define		TD_THR_ANY_USER_FLAGS	0xffffffff
51*95c76875Sraf #define		TD_THR_LOWEST_PRIORITY	-128
527c478bd9Sstevel@tonic-gate #define		TD_SIGNO_MASK 0
537c478bd9Sstevel@tonic-gate #define		TD_EVENTSIZE 2
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * Opaque handle types.
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* Client's handle for a process */
607c478bd9Sstevel@tonic-gate struct ps_prochandle;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /* libthread's handle for a process */
637c478bd9Sstevel@tonic-gate typedef struct td_thragent td_thragent_t;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /* The thread handle. */
667c478bd9Sstevel@tonic-gate typedef struct td_thrhandle {
677c478bd9Sstevel@tonic-gate 	td_thragent_t	*th_ta_p;
687c478bd9Sstevel@tonic-gate 	psaddr_t	th_unique;
697c478bd9Sstevel@tonic-gate } td_thrhandle_t;
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /* The handle for a synchronization object. */
727c478bd9Sstevel@tonic-gate typedef struct td_synchandle {
737c478bd9Sstevel@tonic-gate 	td_thragent_t	*sh_ta_p;
747c478bd9Sstevel@tonic-gate 	psaddr_t	sh_unique;
757c478bd9Sstevel@tonic-gate } td_synchandle_t;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /* ------------------------------------------------------------------ */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * The libc_db event facility.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate #define	BT_UISHIFT	5 /* log base 2 of BT_NBIPUI, to extract word index */
837c478bd9Sstevel@tonic-gate #define	BT_NBIPUI	(1 << BT_UISHIFT)	/* n bits per uint */
847c478bd9Sstevel@tonic-gate #define	BT_UIMASK	(BT_NBIPUI - 1)		/* to extract bit index */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /* Bitmask of enabled events. */
877c478bd9Sstevel@tonic-gate typedef struct td_thr_events {
887c478bd9Sstevel@tonic-gate 	uint_t	event_bits[TD_EVENTSIZE];
897c478bd9Sstevel@tonic-gate } td_thr_events_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /* Event set manipulation macros. */
927c478bd9Sstevel@tonic-gate #define	__td_eventmask(n)	((unsigned int)1 << (((n) - 1)	\
937c478bd9Sstevel@tonic-gate 				    & (BT_NBIPUI - 1)))
947c478bd9Sstevel@tonic-gate #define	__td_eventword(n)	(((unsigned int)((n) - 1))>>5)
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #define	td_event_emptyset(setp)				\
977c478bd9Sstevel@tonic-gate 	{								\
987c478bd9Sstevel@tonic-gate 		int _i_; 						\
997c478bd9Sstevel@tonic-gate 		_i_ = TD_EVENTSIZE;					\
1007c478bd9Sstevel@tonic-gate 		while (_i_) (setp)->event_bits[--_i_] = 0;	\
1017c478bd9Sstevel@tonic-gate 	}
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #define	td_event_fillset(setp)				\
1047c478bd9Sstevel@tonic-gate 	{								\
1057c478bd9Sstevel@tonic-gate 		int _i_;						\
1067c478bd9Sstevel@tonic-gate 		_i_ = TD_EVENTSIZE;					\
1077c478bd9Sstevel@tonic-gate 		while (_i_) (setp)->event_bits[--_i_] =	\
1087c478bd9Sstevel@tonic-gate 			0xffffffff;				\
1097c478bd9Sstevel@tonic-gate 	}
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #define	td_event_addset(setp, n)			\
1127c478bd9Sstevel@tonic-gate 	(((setp)->event_bits[__td_eventword(n)]) |= __td_eventmask(n))
1137c478bd9Sstevel@tonic-gate #define	td_event_delset(setp, n)			\
1147c478bd9Sstevel@tonic-gate 	(((setp)->event_bits[__td_eventword(n)]) &= ~__td_eventmask(n))
1157c478bd9Sstevel@tonic-gate #define	td_eventismember(setp, n)		\
1167c478bd9Sstevel@tonic-gate 	(__td_eventmask(n) & ((setp)->event_bits[__td_eventword(n)]))
1177c478bd9Sstevel@tonic-gate #define	td_eventisempty(setp)			\
1187c478bd9Sstevel@tonic-gate 	(!((setp)->event_bits[0]) && !((setp)->event_bits[1]))
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate typedef enum {
1217c478bd9Sstevel@tonic-gate 	TD_ALL_EVENTS,	/* pseudo-event number */
1227c478bd9Sstevel@tonic-gate 	TD_EVENT_NONE = TD_ALL_EVENTS,	/* depends on context */
1237c478bd9Sstevel@tonic-gate 	TD_READY,
1247c478bd9Sstevel@tonic-gate 	TD_SLEEP,
1257c478bd9Sstevel@tonic-gate 	TD_SWITCHTO,
1267c478bd9Sstevel@tonic-gate 	TD_SWITCHFROM,
1277c478bd9Sstevel@tonic-gate 	TD_LOCK_TRY,
1287c478bd9Sstevel@tonic-gate 	TD_CATCHSIG,
1297c478bd9Sstevel@tonic-gate 	TD_IDLE,
1307c478bd9Sstevel@tonic-gate 	TD_CREATE,
1317c478bd9Sstevel@tonic-gate 	TD_DEATH,
1327c478bd9Sstevel@tonic-gate 	TD_PREEMPT,
1337c478bd9Sstevel@tonic-gate 	TD_PRI_INHERIT,
1347c478bd9Sstevel@tonic-gate 	TD_REAP,
1357c478bd9Sstevel@tonic-gate 	TD_CONCURRENCY,
1367c478bd9Sstevel@tonic-gate 	TD_TIMEOUT,
1377c478bd9Sstevel@tonic-gate 	TD_MIN_EVENT_NUM = TD_READY,
1387c478bd9Sstevel@tonic-gate 	TD_MAX_EVENT_NUM = TD_TIMEOUT,
1397c478bd9Sstevel@tonic-gate 	TD_EVENTS_ENABLE = 31		/* Event reporting enabled */
1407c478bd9Sstevel@tonic-gate } td_event_e;
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate /*
1437c478bd9Sstevel@tonic-gate  *   Ways that an event type can be reported.
1447c478bd9Sstevel@tonic-gate  */
1457c478bd9Sstevel@tonic-gate typedef enum {
1467c478bd9Sstevel@tonic-gate 	NOTIFY_BPT,
1477c478bd9Sstevel@tonic-gate 				/*
1487c478bd9Sstevel@tonic-gate 				 * bpt to be inserted at u.bptaddr by
1497c478bd9Sstevel@tonic-gate 				 * debugger
1507c478bd9Sstevel@tonic-gate 				 */
1517c478bd9Sstevel@tonic-gate 	NOTIFY_AUTOBPT,		/* bpt inserted at u.bptaddr by application */
1527c478bd9Sstevel@tonic-gate 	NOTIFY_SYSCALL		/* syscall u.syscallno will be invoked */
1537c478bd9Sstevel@tonic-gate } td_notify_e;
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate /*
1567c478bd9Sstevel@tonic-gate  * How an event type is reported.
1577c478bd9Sstevel@tonic-gate  */
1587c478bd9Sstevel@tonic-gate typedef struct td_notify {
1597c478bd9Sstevel@tonic-gate 	td_notify_e	type;
1607c478bd9Sstevel@tonic-gate 	union {
1617c478bd9Sstevel@tonic-gate 		psaddr_t	bptaddr;
1627c478bd9Sstevel@tonic-gate 		int		syscallno;
1637c478bd9Sstevel@tonic-gate 	} u;
1647c478bd9Sstevel@tonic-gate } td_notify_t;
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate /*
1677c478bd9Sstevel@tonic-gate  * An event message.
1687c478bd9Sstevel@tonic-gate  */
1697c478bd9Sstevel@tonic-gate typedef struct td_event_msg {
1707c478bd9Sstevel@tonic-gate 	td_event_e event;		/* Event type being reported */
1717c478bd9Sstevel@tonic-gate 	const td_thrhandle_t *th_p;	/* Thread reporting the event */
1727c478bd9Sstevel@tonic-gate 	union {				/* Type-dependent event data */
1737c478bd9Sstevel@tonic-gate 		td_synchandle_t *sh;	/* historical rubbish; ignore */
1747c478bd9Sstevel@tonic-gate 		uintptr_t	data;	/* valid, depending on event type */
1757c478bd9Sstevel@tonic-gate 	} msg;
1767c478bd9Sstevel@tonic-gate } td_event_msg_t;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /* --------------------------------------------------------------------- */
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * Thread information structure as returned by td_thr_get_info(), and
1827c478bd9Sstevel@tonic-gate  * related types.
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /*
1867c478bd9Sstevel@tonic-gate  * Possible thread states.  TD_THR_ANY_STATE is a pseudo-state used
1877c478bd9Sstevel@tonic-gate  * to select threads regardless of state in td_ta_thr_iter().
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate typedef enum {
1907c478bd9Sstevel@tonic-gate 	TD_THR_ANY_STATE,
1917c478bd9Sstevel@tonic-gate 	TD_THR_UNKNOWN,
1927c478bd9Sstevel@tonic-gate 	TD_THR_STOPPED,
1937c478bd9Sstevel@tonic-gate 	TD_THR_RUN,
1947c478bd9Sstevel@tonic-gate 	TD_THR_ACTIVE,
1957c478bd9Sstevel@tonic-gate 	TD_THR_ZOMBIE,
1967c478bd9Sstevel@tonic-gate 	TD_THR_SLEEP,
1977c478bd9Sstevel@tonic-gate 	TD_THR_STOPPED_ASLEEP
1987c478bd9Sstevel@tonic-gate } td_thr_state_e;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate /*
2017c478bd9Sstevel@tonic-gate  * Thread type: user or system.
2027c478bd9Sstevel@tonic-gate  * As of Solaris 9, all threads are type TD_THR_USER.
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate typedef enum {
2057c478bd9Sstevel@tonic-gate 	TD_THR_ANY_TYPE,	/* not used */
2067c478bd9Sstevel@tonic-gate 	TD_THR_USER,
2077c478bd9Sstevel@tonic-gate 	TD_THR_SYSTEM
2087c478bd9Sstevel@tonic-gate } td_thr_type_e;
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate typedef struct td_thrinfo {
2117c478bd9Sstevel@tonic-gate 	td_thragent_t	*ti_ta_p;	/* process handle */
2127c478bd9Sstevel@tonic-gate 	unsigned	ti_user_flags;	/* flags passed to thr_create() */
2137c478bd9Sstevel@tonic-gate 	thread_t	ti_tid;		/* tid returned by thr_create() */
2147c478bd9Sstevel@tonic-gate 	void		*ti_exitval;	/* thread exit value (TD_THR_ZOMBIE) */
2157c478bd9Sstevel@tonic-gate 	psaddr_t	ti_startfunc;	/* startfunc passed to thr_create() */
2167c478bd9Sstevel@tonic-gate 	psaddr_t	ti_stkbase;	/* base of thread's stack */
2177c478bd9Sstevel@tonic-gate 	long		ti_stksize;	/* size of thread's stack */
2187c478bd9Sstevel@tonic-gate 	psaddr_t	ti_ro_area;	/* address of uthread_t struct */
2197c478bd9Sstevel@tonic-gate 	int		ti_ro_size;	/* size of uthread_t struct */
2207c478bd9Sstevel@tonic-gate 	td_thr_state_e	ti_state;	/* thread state */
2217c478bd9Sstevel@tonic-gate 	uchar_t		ti_db_suspended; /* boolean:  suspended by debugger? */
2227c478bd9Sstevel@tonic-gate 	td_thr_type_e	ti_type;	/* thread type */
2237c478bd9Sstevel@tonic-gate 	intptr_t	ti_pc;		/* resume PC when sleeping */
2247c478bd9Sstevel@tonic-gate 	intptr_t	ti_sp;		/* resume SP when sleeping */
2257c478bd9Sstevel@tonic-gate 	short		ti_flags;	/* flags used by libthread */
2267c478bd9Sstevel@tonic-gate 	int		ti_pri;		/* thread priority */
2277c478bd9Sstevel@tonic-gate 	lwpid_t		ti_lid;		/* last LWP assigned to this thread */
2287c478bd9Sstevel@tonic-gate 	sigset_t	ti_sigmask;	/* signal mask */
2297c478bd9Sstevel@tonic-gate 	uchar_t		ti_traceme;	/* event reporting enabled? */
2307c478bd9Sstevel@tonic-gate 	uchar_t		ti_preemptflag;	/* was thread preemppted? */
2317c478bd9Sstevel@tonic-gate 	uchar_t		ti_pirecflag;	/* priority inheritance happened */
2327c478bd9Sstevel@tonic-gate 	sigset_t	ti_pending;	/* set of pending signals */
2337c478bd9Sstevel@tonic-gate 	td_thr_events_t ti_events;	/* set of enabled events */
2347c478bd9Sstevel@tonic-gate } td_thrinfo_t;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate #define	ti_tls	ti_exitval	/* for source compatibility */
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate typedef struct td_ta_stats {
2397c478bd9Sstevel@tonic-gate 	int	nthreads;	/* total number of threads in use */
2407c478bd9Sstevel@tonic-gate 	int	r_concurrency;	/* requested concurrency level */
2417c478bd9Sstevel@tonic-gate 	int	nrunnable_num;	/* numerator, avg. runnable threads */
2427c478bd9Sstevel@tonic-gate 	int	nrunnable_den;	/* denominator, avg. runnable threads */
2437c478bd9Sstevel@tonic-gate 	int	a_concurrency_num; /* numerator, achieved concurrency level */
2447c478bd9Sstevel@tonic-gate 	int	a_concurrency_den; /* denominator,  concurrency level */
2457c478bd9Sstevel@tonic-gate 	int	nlwps_num;	/* numerator, average number of LWP's in use */
2467c478bd9Sstevel@tonic-gate 	int	nlwps_den;	/* denom., average number of LWP's in use */
2477c478bd9Sstevel@tonic-gate 	int	nidle_num;	/* numerator, avg. number of idling LWP's */
2487c478bd9Sstevel@tonic-gate 	int	nidle_den;	/* denom., avg. number of idling LWP's */
2497c478bd9Sstevel@tonic-gate } td_ta_stats_t;
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate /*
2527c478bd9Sstevel@tonic-gate  * Iterator callback function declarations.
2537c478bd9Sstevel@tonic-gate  */
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate /* Callback function for td_ta_tsd_iter(). */
2567c478bd9Sstevel@tonic-gate typedef int	td_key_iter_f(thread_key_t, void (*destructor)(), void *);
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate /* Callback function for td_ta_thr_iter(). */
2597c478bd9Sstevel@tonic-gate typedef int	td_thr_iter_f(const td_thrhandle_t *, void *);
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /* Callback function for td_ta_sync_iter(). */
2627c478bd9Sstevel@tonic-gate typedef int	td_sync_iter_f(const td_synchandle_t *, void *);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate /* -------------------------------------------------------------------- */
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate /*
2677c478bd9Sstevel@tonic-gate  * Synchronization Objects
2687c478bd9Sstevel@tonic-gate  */
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate /* Enumeration of synchronization object types. */
2717c478bd9Sstevel@tonic-gate typedef enum td_sync_type_e {
2727c478bd9Sstevel@tonic-gate 	TD_SYNC_UNKNOWN,	/* Sync. variable of unknown type  */
2737c478bd9Sstevel@tonic-gate 	TD_SYNC_COND,		/* Condition variable  */
2747c478bd9Sstevel@tonic-gate 	TD_SYNC_MUTEX,		/* Mutex lock  */
2757c478bd9Sstevel@tonic-gate 	TD_SYNC_SEMA,		/* Semaphore  */
2767c478bd9Sstevel@tonic-gate 	TD_SYNC_RWLOCK		/* Reader/Writer lock  */
2777c478bd9Sstevel@tonic-gate } td_sync_type_e;
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate #define	TD_SV_MAX_FLAGS 4
2807c478bd9Sstevel@tonic-gate typedef uint8_t td_sync_flags_t;
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate /*
2837c478bd9Sstevel@tonic-gate  * Synchronization object information structure filled in by td_sync_get_info()
2847c478bd9Sstevel@tonic-gate  */
2857c478bd9Sstevel@tonic-gate typedef struct td_syncinfo {
2867c478bd9Sstevel@tonic-gate 	td_thragent_t	*si_ta_p;	/* process handle */
2877c478bd9Sstevel@tonic-gate 	psaddr_t	si_sv_addr;	/* address of sync. object */
2887c478bd9Sstevel@tonic-gate 	td_sync_type_e	si_type;	/* object type */
2897c478bd9Sstevel@tonic-gate 	uint32_t	si_shared_type;	/* process-shared or process-private */
2907c478bd9Sstevel@tonic-gate 	td_sync_flags_t	si_flags[TD_SV_MAX_FLAGS];	/* flags (?) */
2917c478bd9Sstevel@tonic-gate 	pid_t		si_ownerpid;	/* owner's process-id (USYNC_PROCESS) */
2927c478bd9Sstevel@tonic-gate 	union _si_un_state {
2937c478bd9Sstevel@tonic-gate 		int	sem_count;	/* semaphore count */
2947c478bd9Sstevel@tonic-gate 		int	nreaders;	/* number of readers, -1 if writer */
2957c478bd9Sstevel@tonic-gate 		int	mutex_locked;	/* non-zero iff locked */
2967c478bd9Sstevel@tonic-gate 	} si_state;
2977c478bd9Sstevel@tonic-gate 	int		si_size;	/* size in bytes of synch variable */
2987c478bd9Sstevel@tonic-gate 	uint8_t		si_has_waiters;	/* non-zero iff at least one waiter */
2997c478bd9Sstevel@tonic-gate 	uint8_t		si_is_wlock;	/* non-zero iff rwlock write-locked */
3007c478bd9Sstevel@tonic-gate 	uint8_t		si_rcount;	/* count for locked recursive mutex */
3017c478bd9Sstevel@tonic-gate 	uint8_t		si_prioceiling;	/* ceiling pri (PTHREAD_PRIO_PROTECT) */
3027c478bd9Sstevel@tonic-gate 	td_thrhandle_t	si_owner;	/* mutex holder or write-lock holder */
3037c478bd9Sstevel@tonic-gate 	psaddr_t	si_data;	/* optional data */
3047c478bd9Sstevel@tonic-gate } td_syncinfo_t;
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate /*
3077c478bd9Sstevel@tonic-gate  * Statistics structures for the various synchronization objects, contained
3087c478bd9Sstevel@tonic-gate  * within the td_syncstats structure returned by td_sync_get_stats().
3097c478bd9Sstevel@tonic-gate  */
3107c478bd9Sstevel@tonic-gate typedef struct {
3117c478bd9Sstevel@tonic-gate 	uint_t		mutex_lock;
3127c478bd9Sstevel@tonic-gate 	uint_t		mutex_sleep;
3137c478bd9Sstevel@tonic-gate 	hrtime_t	mutex_sleep_time;
3147c478bd9Sstevel@tonic-gate 	hrtime_t	mutex_hold_time;
3157c478bd9Sstevel@tonic-gate 	uint_t		mutex_try;
3167c478bd9Sstevel@tonic-gate 	uint_t		mutex_try_fail;
3177c478bd9Sstevel@tonic-gate 	uint_t		mutex_internal;		/* internal to libthread */
3187c478bd9Sstevel@tonic-gate } td_mutex_stats_t;
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate typedef struct {
3217c478bd9Sstevel@tonic-gate 	uint_t		cond_wait;
3227c478bd9Sstevel@tonic-gate 	uint_t		cond_timedwait;
3237c478bd9Sstevel@tonic-gate 	hrtime_t	cond_wait_sleep_time;
3247c478bd9Sstevel@tonic-gate 	hrtime_t	cond_timedwait_sleep_time;
3257c478bd9Sstevel@tonic-gate 	uint_t		cond_timedwait_timeout;
3267c478bd9Sstevel@tonic-gate 	uint_t		cond_signal;
3277c478bd9Sstevel@tonic-gate 	uint_t		cond_broadcast;
3287c478bd9Sstevel@tonic-gate 	uint_t		cond_internal;		/* internal to libthread */
3297c478bd9Sstevel@tonic-gate } td_cond_stats_t;
3307c478bd9Sstevel@tonic-gate 
3317c478bd9Sstevel@tonic-gate typedef struct {
3327c478bd9Sstevel@tonic-gate 	uint_t		rw_rdlock;
3337c478bd9Sstevel@tonic-gate 	uint_t		rw_rdlock_sleep;
3347c478bd9Sstevel@tonic-gate 	hrtime_t	rw_rdlock_sleep_time;
3357c478bd9Sstevel@tonic-gate 	uint_t		rw_rdlock_try;
3367c478bd9Sstevel@tonic-gate 	uint_t		rw_rdlock_try_fail;
3377c478bd9Sstevel@tonic-gate 	uint_t		rw_wrlock;
3387c478bd9Sstevel@tonic-gate 	uint_t		rw_wrlock_sleep;
3397c478bd9Sstevel@tonic-gate 	hrtime_t	rw_wrlock_sleep_time;
3407c478bd9Sstevel@tonic-gate 	hrtime_t	rw_wrlock_hold_time;
3417c478bd9Sstevel@tonic-gate 	uint_t		rw_wrlock_try;
3427c478bd9Sstevel@tonic-gate 	uint_t		rw_wrlock_try_fail;
3437c478bd9Sstevel@tonic-gate } td_rwlock_stats_t;
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate typedef struct {
3467c478bd9Sstevel@tonic-gate 	uint_t		sema_wait;
3477c478bd9Sstevel@tonic-gate 	uint_t		sema_wait_sleep;
3487c478bd9Sstevel@tonic-gate 	hrtime_t	sema_wait_sleep_time;
3497c478bd9Sstevel@tonic-gate 	uint_t		sema_trywait;
3507c478bd9Sstevel@tonic-gate 	uint_t		sema_trywait_fail;
3517c478bd9Sstevel@tonic-gate 	uint_t		sema_post;
3527c478bd9Sstevel@tonic-gate 	uint_t		sema_max_count;
3537c478bd9Sstevel@tonic-gate 	uint_t		sema_min_count;
3547c478bd9Sstevel@tonic-gate } td_sema_stats_t;
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate /*
3577c478bd9Sstevel@tonic-gate  * Synchronization object statistics structure filled in by td_sync_get_stats()
3587c478bd9Sstevel@tonic-gate  */
3597c478bd9Sstevel@tonic-gate typedef struct td_syncstats {
3607c478bd9Sstevel@tonic-gate 	td_syncinfo_t	ss_info;	/* as returned by td_sync_get_info() */
3617c478bd9Sstevel@tonic-gate 	union {
3627c478bd9Sstevel@tonic-gate 		td_mutex_stats_t	mutex;
3637c478bd9Sstevel@tonic-gate 		td_cond_stats_t		cond;
3647c478bd9Sstevel@tonic-gate 		td_rwlock_stats_t	rwlock;
3657c478bd9Sstevel@tonic-gate 		td_sema_stats_t		sema;
3667c478bd9Sstevel@tonic-gate 		uint_t			pad[32];	/* for future growth */
3677c478bd9Sstevel@tonic-gate 	} ss_un;
3687c478bd9Sstevel@tonic-gate } td_syncstats_t;
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate /* The set of error codes. */
3717c478bd9Sstevel@tonic-gate typedef enum {
3727c478bd9Sstevel@tonic-gate 	TD_OK,		/* generic "call succeeded" */
3737c478bd9Sstevel@tonic-gate 	TD_ERR,		/* generic error. */
3747c478bd9Sstevel@tonic-gate 	TD_NOTHR,	/* no thread can be found to satisfy query */
3757c478bd9Sstevel@tonic-gate 	TD_NOSV,	/* no synch. handle can be found to satisfy query */
3767c478bd9Sstevel@tonic-gate 	TD_NOLWP,	/* no lwp can be found to satisfy query */
3777c478bd9Sstevel@tonic-gate 	TD_BADPH,	/* invalid process handle */
3787c478bd9Sstevel@tonic-gate 	TD_BADTH,	/* invalid thread handle */
3797c478bd9Sstevel@tonic-gate 	TD_BADSH,	/* invalid synchronization handle */
3807c478bd9Sstevel@tonic-gate 	TD_BADTA,	/* invalid thread agent */
3817c478bd9Sstevel@tonic-gate 	TD_BADKEY,	/* invalid key */
3827c478bd9Sstevel@tonic-gate 	TD_NOMSG,	/* no event message for td_thr_event_getmsg() */
3837c478bd9Sstevel@tonic-gate 	TD_NOFPREGS,	/* FPU register set not available */
3847c478bd9Sstevel@tonic-gate 	TD_NOLIBTHREAD,	/* application not linked with libthread */
3857c478bd9Sstevel@tonic-gate 	TD_NOEVENT,	/* requested event is not supported */
3867c478bd9Sstevel@tonic-gate 	TD_NOCAPAB,	/* capability not available */
3877c478bd9Sstevel@tonic-gate 	TD_DBERR,	/* Debugger service failed */
3887c478bd9Sstevel@tonic-gate 	TD_NOAPLIC,	/* Operation not applicable to */
3897c478bd9Sstevel@tonic-gate 	TD_NOTSD,	/* No thread-specific data for this thread */
3907c478bd9Sstevel@tonic-gate 	TD_MALLOC,	/* Malloc failed */
3917c478bd9Sstevel@tonic-gate 	TD_PARTIALREG,	/* Only part of register set was writen/read */
3927c478bd9Sstevel@tonic-gate 	TD_NOXREGS,	/* X register set not available for given thread */
3937c478bd9Sstevel@tonic-gate 	TD_NOTLS,	/* There is no TLS in the specified module */
3947c478bd9Sstevel@tonic-gate 	TD_TLSDEFER	/* module's TLS not yet allocated by the thread */
3957c478bd9Sstevel@tonic-gate }	td_err_e;
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate /* ----------------------------------------------------------------------- */
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate /*
4017c478bd9Sstevel@tonic-gate  * Exported functions.
4027c478bd9Sstevel@tonic-gate  */
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate /*
4057c478bd9Sstevel@tonic-gate  * Initialize the threads debug interface.
4067c478bd9Sstevel@tonic-gate  */
4077c478bd9Sstevel@tonic-gate td_err_e
4087c478bd9Sstevel@tonic-gate td_init(void);
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate /*
4117c478bd9Sstevel@tonic-gate  * A no-op, left for historical reasons.
4127c478bd9Sstevel@tonic-gate  */
4137c478bd9Sstevel@tonic-gate void
4147c478bd9Sstevel@tonic-gate td_log(void);
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate /*
4177c478bd9Sstevel@tonic-gate  * Allocate a new process handle ("thread agent").
4187c478bd9Sstevel@tonic-gate  */
4197c478bd9Sstevel@tonic-gate td_err_e
4207c478bd9Sstevel@tonic-gate td_ta_new(struct ps_prochandle *, td_thragent_t **);
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate /*
4237c478bd9Sstevel@tonic-gate  * De-allocate a process handle, releasing all related resources.
4247c478bd9Sstevel@tonic-gate  */
4257c478bd9Sstevel@tonic-gate td_err_e
4267c478bd9Sstevel@tonic-gate td_ta_delete(td_thragent_t *);
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate /*
4297c478bd9Sstevel@tonic-gate  * Map a process handle to a client process handle.
4307c478bd9Sstevel@tonic-gate  */
4317c478bd9Sstevel@tonic-gate td_err_e
4327c478bd9Sstevel@tonic-gate td_ta_get_ph(const td_thragent_t *, struct ps_prochandle **);
4337c478bd9Sstevel@tonic-gate 
4347c478bd9Sstevel@tonic-gate /*
4357c478bd9Sstevel@tonic-gate  * Set the process's suggested concurrency level.
4367c478bd9Sstevel@tonic-gate  */
4377c478bd9Sstevel@tonic-gate td_err_e
4387c478bd9Sstevel@tonic-gate td_ta_setconcurrency(const td_thragent_t *, int);
4397c478bd9Sstevel@tonic-gate 
4407c478bd9Sstevel@tonic-gate /*
4417c478bd9Sstevel@tonic-gate  * Get the number of threads in the process, including zombie threads.
4427c478bd9Sstevel@tonic-gate  */
4437c478bd9Sstevel@tonic-gate td_err_e
4447c478bd9Sstevel@tonic-gate td_ta_get_nthreads(const td_thragent_t *, int *);
4457c478bd9Sstevel@tonic-gate 
4467c478bd9Sstevel@tonic-gate /*
4477c478bd9Sstevel@tonic-gate  * Map a tid, as returned by thr_create(), to a thread handle.
4487c478bd9Sstevel@tonic-gate  */
4497c478bd9Sstevel@tonic-gate td_err_e
4507c478bd9Sstevel@tonic-gate td_ta_map_id2thr(const td_thragent_t *, thread_t,  td_thrhandle_t *);
4517c478bd9Sstevel@tonic-gate 
4527c478bd9Sstevel@tonic-gate /*
4537c478bd9Sstevel@tonic-gate  * Map the address of a synchronization object to a sync. object handle.
4547c478bd9Sstevel@tonic-gate  */
4557c478bd9Sstevel@tonic-gate td_err_e
4567c478bd9Sstevel@tonic-gate td_ta_map_addr2sync(const td_thragent_t *, psaddr_t, td_synchandle_t *);
4577c478bd9Sstevel@tonic-gate 
4587c478bd9Sstevel@tonic-gate /*
4597c478bd9Sstevel@tonic-gate  * Iterate over a process's thread-specific data (TSD) keys.
4607c478bd9Sstevel@tonic-gate  */
4617c478bd9Sstevel@tonic-gate td_err_e
4627c478bd9Sstevel@tonic-gate td_ta_tsd_iter(const td_thragent_t *, td_key_iter_f *, void *);
4637c478bd9Sstevel@tonic-gate 
4647c478bd9Sstevel@tonic-gate /*
4657c478bd9Sstevel@tonic-gate  * Iterate over a process's threads, including zombie threads.
4667c478bd9Sstevel@tonic-gate  */
4677c478bd9Sstevel@tonic-gate td_err_e
4687c478bd9Sstevel@tonic-gate td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *,
4697c478bd9Sstevel@tonic-gate 	td_thr_state_e, int, sigset_t *, unsigned);
4707c478bd9Sstevel@tonic-gate 
4717c478bd9Sstevel@tonic-gate /*
4727c478bd9Sstevel@tonic-gate  * Iterate over a process's known synchronization objects.
4737c478bd9Sstevel@tonic-gate  */
4747c478bd9Sstevel@tonic-gate td_err_e
4757c478bd9Sstevel@tonic-gate td_ta_sync_iter(const td_thragent_t *, td_sync_iter_f *, void *);
4767c478bd9Sstevel@tonic-gate 
4777c478bd9Sstevel@tonic-gate /*
4787c478bd9Sstevel@tonic-gate  * Enable/disable process statistics collection.
4797c478bd9Sstevel@tonic-gate  */
4807c478bd9Sstevel@tonic-gate td_err_e
4817c478bd9Sstevel@tonic-gate td_ta_enable_stats(const td_thragent_t *, int);
4827c478bd9Sstevel@tonic-gate 
4837c478bd9Sstevel@tonic-gate /*
4847c478bd9Sstevel@tonic-gate  * Reset process statistics.
4857c478bd9Sstevel@tonic-gate  */
4867c478bd9Sstevel@tonic-gate td_err_e
4877c478bd9Sstevel@tonic-gate td_ta_reset_stats(const td_thragent_t *);
4887c478bd9Sstevel@tonic-gate 
4897c478bd9Sstevel@tonic-gate /*
4907c478bd9Sstevel@tonic-gate  * Read process statistics.
4917c478bd9Sstevel@tonic-gate  */
4927c478bd9Sstevel@tonic-gate td_err_e
4937c478bd9Sstevel@tonic-gate td_ta_get_stats(const td_thragent_t *, td_ta_stats_t *);
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate /*
4967c478bd9Sstevel@tonic-gate  * Get thread information.
4977c478bd9Sstevel@tonic-gate  */
4987c478bd9Sstevel@tonic-gate td_err_e
4997c478bd9Sstevel@tonic-gate td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *);
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate /*
5027c478bd9Sstevel@tonic-gate  * Get the "event address" for an event type.
5037c478bd9Sstevel@tonic-gate  */
5047c478bd9Sstevel@tonic-gate td_err_e
5057c478bd9Sstevel@tonic-gate td_ta_event_addr(const td_thragent_t *, td_event_e, td_notify_t *);
5067c478bd9Sstevel@tonic-gate 
5077c478bd9Sstevel@tonic-gate /*
5087c478bd9Sstevel@tonic-gate  * Enable/disable event reporting for a thread.
5097c478bd9Sstevel@tonic-gate  */
5107c478bd9Sstevel@tonic-gate td_err_e
5117c478bd9Sstevel@tonic-gate td_thr_event_enable(const td_thrhandle_t *, int);
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate /*
5147c478bd9Sstevel@tonic-gate  * Enable a set of events for a thread.
5157c478bd9Sstevel@tonic-gate  */
5167c478bd9Sstevel@tonic-gate td_err_e
5177c478bd9Sstevel@tonic-gate td_thr_set_event(const td_thrhandle_t *, td_thr_events_t *);
5187c478bd9Sstevel@tonic-gate 
5197c478bd9Sstevel@tonic-gate /*
5207c478bd9Sstevel@tonic-gate  * Disable a set of events for a thread.
5217c478bd9Sstevel@tonic-gate  */
5227c478bd9Sstevel@tonic-gate td_err_e
5237c478bd9Sstevel@tonic-gate td_thr_clear_event(const td_thrhandle_t *, td_thr_events_t *);
5247c478bd9Sstevel@tonic-gate 
5257c478bd9Sstevel@tonic-gate /*
5267c478bd9Sstevel@tonic-gate  * Retrieve (and consume) an event message for a thread.
5277c478bd9Sstevel@tonic-gate  */
5287c478bd9Sstevel@tonic-gate td_err_e
5297c478bd9Sstevel@tonic-gate td_thr_event_getmsg(const td_thrhandle_t *, td_event_msg_t *);
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate /*
5327c478bd9Sstevel@tonic-gate  * Enable a set of events in the process.
5337c478bd9Sstevel@tonic-gate  */
5347c478bd9Sstevel@tonic-gate td_err_e
5357c478bd9Sstevel@tonic-gate td_ta_set_event(const td_thragent_t *, td_thr_events_t *);
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate /*
5387c478bd9Sstevel@tonic-gate  * Disable a set of events in the process.
5397c478bd9Sstevel@tonic-gate  */
5407c478bd9Sstevel@tonic-gate td_err_e
5417c478bd9Sstevel@tonic-gate td_ta_clear_event(const td_thragent_t *, td_thr_events_t *);
5427c478bd9Sstevel@tonic-gate 
5437c478bd9Sstevel@tonic-gate /*
5447c478bd9Sstevel@tonic-gate  * Retrieve (and consume) an event message for some thread in the process.
5457c478bd9Sstevel@tonic-gate  */
5467c478bd9Sstevel@tonic-gate td_err_e
5477c478bd9Sstevel@tonic-gate td_ta_event_getmsg(const td_thragent_t *, td_event_msg_t *);
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate /*
5507c478bd9Sstevel@tonic-gate  * Suspend a thread.
5517c478bd9Sstevel@tonic-gate  */
5527c478bd9Sstevel@tonic-gate td_err_e
5537c478bd9Sstevel@tonic-gate td_thr_dbsuspend(const td_thrhandle_t *);
5547c478bd9Sstevel@tonic-gate 
5557c478bd9Sstevel@tonic-gate /*
5567c478bd9Sstevel@tonic-gate  * Resume a suspended thread.
5577c478bd9Sstevel@tonic-gate  */
5587c478bd9Sstevel@tonic-gate td_err_e
5597c478bd9Sstevel@tonic-gate td_thr_dbresume(const td_thrhandle_t *);
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate /*
5627c478bd9Sstevel@tonic-gate  * Set a thread's signal mask.
5637c478bd9Sstevel@tonic-gate  */
5647c478bd9Sstevel@tonic-gate td_err_e
5657c478bd9Sstevel@tonic-gate td_thr_sigsetmask(const td_thrhandle_t *, const sigset_t);
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate /*
5687c478bd9Sstevel@tonic-gate  * Set a thread's "signals-pending" set.
5697c478bd9Sstevel@tonic-gate  */
5707c478bd9Sstevel@tonic-gate td_err_e
5717c478bd9Sstevel@tonic-gate td_thr_setsigpending(const td_thrhandle_t *, uchar_t, const sigset_t);
5727c478bd9Sstevel@tonic-gate 
5737c478bd9Sstevel@tonic-gate /*
5747c478bd9Sstevel@tonic-gate  * Get a thread's general register set.
5757c478bd9Sstevel@tonic-gate  */
5767c478bd9Sstevel@tonic-gate td_err_e
5777c478bd9Sstevel@tonic-gate td_thr_getgregs(const td_thrhandle_t *, prgregset_t);
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate /*
5807c478bd9Sstevel@tonic-gate  * Set a thread's general register set.
5817c478bd9Sstevel@tonic-gate  */
5827c478bd9Sstevel@tonic-gate td_err_e
5837c478bd9Sstevel@tonic-gate td_thr_setgregs(const td_thrhandle_t *, const prgregset_t);
5847c478bd9Sstevel@tonic-gate 
5857c478bd9Sstevel@tonic-gate /*
5867c478bd9Sstevel@tonic-gate  * Get a thread's floating-point register set.
5877c478bd9Sstevel@tonic-gate  */
5887c478bd9Sstevel@tonic-gate td_err_e
5897c478bd9Sstevel@tonic-gate td_thr_getfpregs(const td_thrhandle_t *, prfpregset_t *);
5907c478bd9Sstevel@tonic-gate 
5917c478bd9Sstevel@tonic-gate /*
5927c478bd9Sstevel@tonic-gate  * Set a thread's floating-point register set.
5937c478bd9Sstevel@tonic-gate  */
5947c478bd9Sstevel@tonic-gate td_err_e
5957c478bd9Sstevel@tonic-gate td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *);
5967c478bd9Sstevel@tonic-gate 
5977c478bd9Sstevel@tonic-gate /*
5987c478bd9Sstevel@tonic-gate  * Get the size of the extra state register set for this architecture.
5997c478bd9Sstevel@tonic-gate  */
6007c478bd9Sstevel@tonic-gate td_err_e
6017c478bd9Sstevel@tonic-gate td_thr_getxregsize(const td_thrhandle_t *th_p, int *xregsize);
6027c478bd9Sstevel@tonic-gate 
6037c478bd9Sstevel@tonic-gate /*
6047c478bd9Sstevel@tonic-gate  * Get a thread's extra state register set.
6057c478bd9Sstevel@tonic-gate  */
6067c478bd9Sstevel@tonic-gate td_err_e
6077c478bd9Sstevel@tonic-gate td_thr_getxregs(const td_thrhandle_t *th_p, void *xregs);
6087c478bd9Sstevel@tonic-gate 
6097c478bd9Sstevel@tonic-gate /*
6107c478bd9Sstevel@tonic-gate  * Set a thread's extra state register set.
6117c478bd9Sstevel@tonic-gate  */
6127c478bd9Sstevel@tonic-gate td_err_e
6137c478bd9Sstevel@tonic-gate td_thr_setxregs(const td_thrhandle_t *th_p, const void *xregs);
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate /*
6167c478bd9Sstevel@tonic-gate  * Validate a thread handle.
6177c478bd9Sstevel@tonic-gate  */
6187c478bd9Sstevel@tonic-gate td_err_e
6197c478bd9Sstevel@tonic-gate td_thr_validate(const td_thrhandle_t *);
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate /*
6227c478bd9Sstevel@tonic-gate  * Get a thread-specific data pointer for a thread.
6237c478bd9Sstevel@tonic-gate  */
6247c478bd9Sstevel@tonic-gate td_err_e
6257c478bd9Sstevel@tonic-gate td_thr_tsd(const td_thrhandle_t *, thread_key_t, void **);
6267c478bd9Sstevel@tonic-gate 
6277c478bd9Sstevel@tonic-gate /*
6287c478bd9Sstevel@tonic-gate  * Get the base address of a thread's thread local storage (TLS) block
6297c478bd9Sstevel@tonic-gate  * for the module (executable or shared object) identified by 'moduleid'.
6307c478bd9Sstevel@tonic-gate  */
6317c478bd9Sstevel@tonic-gate td_err_e
6327c478bd9Sstevel@tonic-gate td_thr_tlsbase(const td_thrhandle_t *, ulong_t moduleid, psaddr_t *base);
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate /*
6357c478bd9Sstevel@tonic-gate  * Set a thread's priority.
6367c478bd9Sstevel@tonic-gate  */
6377c478bd9Sstevel@tonic-gate td_err_e
6387c478bd9Sstevel@tonic-gate td_thr_setprio(const td_thrhandle_t *, int);
6397c478bd9Sstevel@tonic-gate 
6407c478bd9Sstevel@tonic-gate /*
6417c478bd9Sstevel@tonic-gate  * Iterate over the set of locks owned by a thread.
6427c478bd9Sstevel@tonic-gate  */
6437c478bd9Sstevel@tonic-gate td_err_e
6447c478bd9Sstevel@tonic-gate td_thr_lockowner(const td_thrhandle_t *, td_sync_iter_f *, void *);
6457c478bd9Sstevel@tonic-gate 
6467c478bd9Sstevel@tonic-gate /*
6477c478bd9Sstevel@tonic-gate  * Return the sync. handle of the object this thread is sleeping on.
6487c478bd9Sstevel@tonic-gate  */
6497c478bd9Sstevel@tonic-gate td_err_e
6507c478bd9Sstevel@tonic-gate td_thr_sleepinfo(const td_thrhandle_t *, td_synchandle_t *);
6517c478bd9Sstevel@tonic-gate 
6527c478bd9Sstevel@tonic-gate /*
6537c478bd9Sstevel@tonic-gate  * Map an lwpid, as returned by _lwp_create(), to a thread handle.
6547c478bd9Sstevel@tonic-gate  */
6557c478bd9Sstevel@tonic-gate td_err_e
6567c478bd9Sstevel@tonic-gate td_ta_map_lwp2thr(const td_thragent_t *, lwpid_t, td_thrhandle_t *th_p);
6577c478bd9Sstevel@tonic-gate 
6587c478bd9Sstevel@tonic-gate /*
6597c478bd9Sstevel@tonic-gate  * Enable/disable a process's synchronization object tracking.
6607c478bd9Sstevel@tonic-gate  */
6617c478bd9Sstevel@tonic-gate td_err_e
6627c478bd9Sstevel@tonic-gate td_ta_sync_tracking_enable(const td_thragent_t *, int);
6637c478bd9Sstevel@tonic-gate 
6647c478bd9Sstevel@tonic-gate /*
6657c478bd9Sstevel@tonic-gate  * Get information about a synchronization object.
6667c478bd9Sstevel@tonic-gate  */
6677c478bd9Sstevel@tonic-gate td_err_e
6687c478bd9Sstevel@tonic-gate td_sync_get_info(const td_synchandle_t *, td_syncinfo_t *);
6697c478bd9Sstevel@tonic-gate 
6707c478bd9Sstevel@tonic-gate /*
6717c478bd9Sstevel@tonic-gate  * Get statistics for a synchronization object.
6727c478bd9Sstevel@tonic-gate  */
6737c478bd9Sstevel@tonic-gate td_err_e
6747c478bd9Sstevel@tonic-gate td_sync_get_stats(const td_synchandle_t *, td_syncstats_t *);
6757c478bd9Sstevel@tonic-gate 
6767c478bd9Sstevel@tonic-gate /*
6777c478bd9Sstevel@tonic-gate  * Set the state of a synchronization object.
6787c478bd9Sstevel@tonic-gate  */
6797c478bd9Sstevel@tonic-gate td_err_e
6807c478bd9Sstevel@tonic-gate td_sync_setstate(const td_synchandle_t *, int value);
6817c478bd9Sstevel@tonic-gate 
6827c478bd9Sstevel@tonic-gate /*
6837c478bd9Sstevel@tonic-gate  * Iterate over all threads blocked on a synchronization object.
6847c478bd9Sstevel@tonic-gate  */
6857c478bd9Sstevel@tonic-gate td_err_e
6867c478bd9Sstevel@tonic-gate td_sync_waiters(const td_synchandle_t *, td_thr_iter_f *, void *);
6877c478bd9Sstevel@tonic-gate 
6887c478bd9Sstevel@tonic-gate #ifdef __cplusplus
6897c478bd9Sstevel@tonic-gate }
6907c478bd9Sstevel@tonic-gate #endif
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate #endif	/* _THREAD_DB_H */
693