From owner-p4-projects@FreeBSD.ORG Sun Jun 27 05:15:11 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3EFB716A4D4; Sun, 27 Jun 2004 05:15:11 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B17DC16A4D0 for ; Sun, 27 Jun 2004 05:15:10 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AACB443D4C for ; Sun, 27 Jun 2004 05:15:10 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5R5DIci089784 for ; Sun, 27 Jun 2004 05:13:18 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5R5DI2L089781 for perforce@freebsd.org; Sun, 27 Jun 2004 05:13:18 GMT (envelope-from davidxu@freebsd.org) Date: Sun, 27 Jun 2004 05:13:18 GMT Message-Id: <200406270513.i5R5DI2L089781@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 55901 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 05:15:11 -0000 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 #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 {