PERFORCE change 74642 for review
David Xu
davidxu at FreeBSD.org
Thu Apr 7 00:21:04 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=74642
Change 74642 by davidxu at davidxu_celeron on 2005/04/07 07:20:51
Add code to support event reporting.
Affected files ...
.. //depot/projects/davidxu_thread/src/lib/libthr/pthread.map#3 edit
.. //depot/projects/davidxu_thread/src/lib/libthr/thread/Makefile.inc#3 edit
.. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_init.c#7 edit
.. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_private.h#7 edit
.. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_symbols.c#2 edit
Differences ...
==== //depot/projects/davidxu_thread/src/lib/libthr/pthread.map#3 (text+ko) ====
@@ -362,6 +362,8 @@
_thread_size_key;
_thread_state_running;
_thread_state_zoombie;
+ _thread_off_per_thread_event_mask;
+ _thread_event_mask;
local:
*;
};
==== //depot/projects/davidxu_thread/src/lib/libthr/thread/Makefile.inc#3 (text+ko) ====
@@ -15,6 +15,7 @@
thr_create.c \
thr_detach.c \
thr_equal.c \
+ thr_event.c \
thr_exit.c \
thr_fork.c \
thr_getprio.c \
==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_init.c#7 (text+ko) ====
@@ -384,6 +384,7 @@
_thr_umtx_init(&_rwlock_static_lock);
_thr_umtx_init(&_keytable_lock);
_thr_umtx_init(&_thr_atfork_lock);
+ _thr_umtx_init(&_thr_event_lock);
_thr_spinlock_init();
_thr_list_init();
==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_private.h#7 (text+ko) ====
@@ -491,6 +491,9 @@
/* Cleanup handlers Link List */
struct pthread_cleanup *cleanup;
+
+ /* Event reporting mask */
+ int event_mask;
};
#define THR_UMTX_TRYLOCK(thrd, lck) \
@@ -573,6 +576,17 @@
#define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
+struct pthread_event
+{
+ int event;
+ struct pthread *thread;
+ void *data;
+};
+
+/* XXX this must match thread_db.h */
+#define TD_CREATE 0x0004
+#define TD_DEATH 0x0008
+
extern int __isthreaded;
/*
@@ -581,9 +595,12 @@
SCLASS void *_usrstack SCLASS_PRESET(NULL);
SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL);
+SCLASS int _thr_scope_system SCLASS_PRESET(0);
+
/* For debugger */
SCLASS int _libthr_debug SCLASS_PRESET(0);
-SCLASS int _thr_scope_system SCLASS_PRESET(0);
+SCLASS int _thread_event_mask SCLASS_PRESET(0);
+SCLASS struct pthread_event _thread_event;
/* List of all threads: */
SCLASS TAILQ_HEAD(, pthread) _thread_list
@@ -643,6 +660,7 @@
SCLASS umtx_t _rwlock_static_lock;
SCLASS umtx_t _keytable_lock;
SCLASS umtx_t _thr_list_lock;
+SCLASS umtx_t _thr_event_lock;
/* Undefine the storage class and preset specifiers: */
#undef SCLASS
@@ -720,6 +738,11 @@
void _thr_unlink(struct pthread *curthread, struct pthread *thread);
void _thr_suspend_check(struct pthread *curthread);
void _thr_assert_lock_level() __dead2;
+void _thr_report_create(struct pthread *curthread);
+void _thr_report_death(struct pthread *curthread);
+void _thr_report_event(struct pthread *curthread, int event);
+int _thr_create_bp(void);
+int _thr_death_bp(void);
/* #include <sys/aio.h> */
#ifdef _SYS_AIO_H_
==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_symbols.c#2 (text+ko) ====
@@ -49,6 +49,7 @@
int _thread_off_linkmap = offsetof(Obj_Entry, linkmap);
int _thread_off_tlsindex = offsetof(Obj_Entry, tlsindex);
int _thread_off_isdead = offsetof(struct pthread, terminated);
+int _thread_off_per_thread_event_mask = offsetof(struct pthread, event_mask);
int _thread_size_key = sizeof(struct pthread_key);
int _thread_off_key_allocated = offsetof(struct pthread_key, allocated);
int _thread_off_key_destructor = offsetof(struct pthread_key, destructor);
More information about the p4-projects
mailing list