Date: Sun, 27 Jun 2004 05:13:18 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55901 for review Message-ID: <200406270513.i5R5DI2L089781@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=55901 Change 55901 by davidxu@davidxu_alona on 2004/06/27 05:13:02 Export following symbols to debugger: _libkse_debug _thread_activated _thread_list _thread_keytable _thread_active_threads Affected files ... .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/pthread.map#2 edit .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_create.c#2 edit .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_exit.c#2 edit .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_private.h#4 edit .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_spec.c#2 edit Differences ... ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/pthread.map#2 (text+ko) ==== @@ -329,14 +329,11 @@ writev; # Debugger needs these. + _libkse_debug; + _thread_activated; _thread_list; - _thread_next_offset; - _thread_uniqueid_offset; - _thread_state_offset; - _thread_name_offset; - _thread_ctx_offset; - _thread_PS_RUNNING_value; - _thread_PS_DEAD_value; + _thread_keytable; + _thread_active_threads; local: *; ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_create.c#2 (text+ko) ==== @@ -44,20 +44,6 @@ #include "thr_private.h" #include "libc_private.h" -#define OFF(f) offsetof(struct pthread, f) -int _thread_next_offset = OFF(tle.tqe_next); -int _thread_uniqueid_offset = OFF(uniqueid); -int _thread_state_offset = OFF(state); -int _thread_name_offset = OFF(name); -void *_thread_tcb_offset = OFF(tcb); -#undef OFF -#define OFF(f) offsetof(struct tcb, f) -int _thread_ctx_offset = OFF(tcb_tmbx.tm_context); -#undef OFF - -int _thread_PS_RUNNING_value = PS_RUNNING; -int _thread_PS_DEAD_value = PS_DEAD; - static void free_thread(struct pthread *curthread, struct pthread *thread); static int create_stack(struct pthread_attr *pattr); static void free_stack(struct pthread_attr *pattr); ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_exit.c#2 (text+ko) ==== @@ -125,11 +125,11 @@ curkse = _get_curkse(); KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); /* Use thread_list_lock */ - _thr_active_threads--; + _thread_active_threads--; #ifdef SYSTEM_SCOPE_ONLY - if (_thr_active_threads == 0) { + if (_thread_active_threads == 0) { #else - if (_thr_active_threads == 1) { + if (_thread_active_threads == 1) { #endif KSE_LOCK_RELEASE(curkse, &_thread_list_lock); _kse_critical_leave(crit); ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_private.h#4 (text+ko) ==== @@ -582,6 +582,13 @@ int seqno; }; +struct pthread_key { + volatile int allocated; + volatile int count; + int seqno; + void (*destructor) (void *); +}; + #define MAX_THR_LOCKLEVEL 5 /* * Thread structure. ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_spec.c#2 (text+ko) ==== @@ -38,15 +38,8 @@ #include <pthread.h> #include "thr_private.h" -struct pthread_key { - volatile int allocated; - volatile int count; - int seqno; - void (*destructor) (); -}; - /* Static variables: */ -static struct pthread_key key_table[PTHREAD_KEYS_MAX]; +struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; __weak_reference(_pthread_key_create, pthread_key_create); __weak_reference(_pthread_key_delete, pthread_key_delete); @@ -64,10 +57,10 @@ THR_LOCK_ACQUIRE(curthread, &_keytable_lock); for (i = 0; i < PTHREAD_KEYS_MAX; i++) { - if (key_table[i].allocated == 0) { - key_table[i].allocated = 1; - key_table[i].destructor = destructor; - key_table[i].seqno++; + if (_thread_keytable[i].allocated == 0) { + _thread_keytable[i].allocated = 1; + _thread_keytable[i].destructor = destructor; + _thread_keytable[i].seqno++; /* Unlock the key table: */ THR_LOCK_RELEASE(curthread, &_keytable_lock); @@ -91,8 +84,8 @@ /* Lock the key table: */ THR_LOCK_ACQUIRE(curthread, &_keytable_lock); - if (key_table[key].allocated) - key_table[key].allocated = 0; + if (_thread_keytable[key].allocated) + _thread_keytable[key].allocated = 0; else ret = EINVAL; @@ -123,13 +116,13 @@ (curthread->specific_data_count > 0); key++) { destructor = NULL; - if (key_table[key].allocated && + if (_thread_keytable[key].allocated && (curthread->specific[key].data != NULL)) { if (curthread->specific[key].seqno == - key_table[key].seqno) { + _thread_keytable[key].seqno) { data = (void *) curthread->specific[key].data; - destructor = key_table[key].destructor; + destructor = _thread_keytable[key].destructor; } curthread->specific[key].data = NULL; curthread->specific_data_count--; @@ -185,7 +178,7 @@ if ((pthread->specific) || (pthread->specific = pthread_key_allocate_data())) { if ((unsigned int)key < PTHREAD_KEYS_MAX) { - if (key_table[key].allocated) { + if (_thread_keytable[key].allocated) { if (pthread->specific[key].data == NULL) { if (value != NULL) pthread->specific_data_count++; @@ -193,7 +186,7 @@ pthread->specific_data_count--; pthread->specific[key].data = value; pthread->specific[key].seqno = - key_table[key].seqno; + _thread_keytable[key].seqno; ret = 0; } else ret = EINVAL; @@ -216,8 +209,8 @@ /* Check if there is specific data: */ if (pthread->specific != NULL && (unsigned int)key < PTHREAD_KEYS_MAX) { /* Check if this key has been used before: */ - if (key_table[key].allocated && - (pthread->specific[key].seqno == key_table[key].seqno)) { + if (_thread_keytable[key].allocated && + (pthread->specific[key].seqno == _thread_keytable[key].seqno)) { /* Return the value: */ data = (void *) pthread->specific[key].data; } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406270513.i5R5DI2L089781>