* Makefile: Define -D_RPC_THREAD_SAFE_ for cancel.c.
This commit is contained in:
Ulrich Drepper 2001-03-20 21:05:29 +00:00
parent f1e4a4a403
commit 481b550f58
13 changed files with 129 additions and 48 deletions

4
NEWS
View File

@ -30,6 +30,10 @@ Version 2.2.3
* David Mosberger <davidm@hpl.hp.com> implemented the setcontext family * David Mosberger <davidm@hpl.hp.com> implemented the setcontext family
of functions for Linux/IA-64. of functions for Linux/IA-64.
* The RPC code is now thread safe. Threads can now use the same service
of different services at the same time. Patch by Eric Norum
<eric.norum@usask.ca> with some help by Ulrich Drepper.
Version 2.2.2 Version 2.2.2

View File

@ -199,3 +199,9 @@ contact <bug-glibc@gnu.org>.
[26] ...done [26] ...done
[27] We need a second test suite with tests which cannot run during a normal
`make check' run. This test suite can require root priviledges and
can test things like DNS (i.e., require network access),
user-interaction, networking in general, and probably many other things.

View File

@ -1,5 +1,6 @@
2001-03-20 Ulrich Drepper <drepper@redhat.com> 2001-03-20 Ulrich Drepper <drepper@redhat.com>
* Makefile: Define -D_RPC_THREAD_SAFE_ for cancel.c.
* cancel.c (__pthread_perform_cleanup): Call __rpc_thread_destroy. * cancel.c (__pthread_perform_cleanup): Call __rpc_thread_destroy.
* sysdeps/pthread/bits/libc-tsd.h: Define _LIBC_TSD_KEY_VARS. * sysdeps/pthread/bits/libc-tsd.h: Define _LIBC_TSD_KEY_VARS.

View File

@ -70,7 +70,7 @@ CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES $(znodelete-$(have-z-nodelete)) CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES $(znodelete-$(have-z-nodelete))
CFLAGS-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES CFLAGS-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES -D_RPC_THREAD_SAFE_
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\" CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"
# Depend on libc.so so a DT_NEEDED is generated in the shared objects. # Depend on libc.so so a DT_NEEDED is generated in the shared objects.

View File

@ -1,3 +1,16 @@
2001-03-20 Ulrich Drepper <drepper@redhat.com>
* Makefile (libthread_db-routines): Add td_symbol_list.
* Versions [libthread_db] (GLIBC_2.2.3): Add td_symbol_list.
* td_symbol_list.c: New file.
* thread_db.h: Add prototype for td_symbol_list.
* thread_dbP.h: Define symbol name indices.
Add prototype for td_lookup.
* td_ta_event_addr.c: Use td_lookup instead of directly using
ps_pglobal_lookup to find symbol address.
* td_ta_get_nthreads.c: Likewise.
* td_ta_new.c: Likewise.
2001-03-18 Ulrich Drepper <drepper@redhat.com> 2001-03-18 Ulrich Drepper <drepper@redhat.com>
* Makefile: When generating DSO link with libc_nonshared.a. * Makefile: When generating DSO link with libc_nonshared.a.

View File

@ -39,7 +39,7 @@ libthread_db-routines = td_init td_log td_ta_delete td_ta_get_nthreads \
td_thr_event_enable td_thr_set_event \ td_thr_event_enable td_thr_set_event \
td_thr_clear_event td_thr_event_getmsg \ td_thr_clear_event td_thr_event_getmsg \
td_ta_set_event td_ta_event_getmsg \ td_ta_set_event td_ta_event_getmsg \
td_ta_clear_event td_ta_clear_event td_symbol_list
libthread_db-inhibit-o = $(filter-out .os,$(object-suffixes)) libthread_db-inhibit-o = $(filter-out .os,$(object-suffixes))

View File

@ -12,4 +12,7 @@ libthread_db {
td_thr_setprio; td_thr_setsigpending; td_thr_setxregs; td_thr_sigsetmask; td_thr_setprio; td_thr_setsigpending; td_thr_setxregs; td_thr_sigsetmask;
td_thr_tsd; td_thr_validate; td_thr_tsd; td_thr_validate;
} }
GLIBC_2.2.3 {
td_symbol_list;
}
} }

View File

@ -0,0 +1,55 @@
/* Return list of symbols the library can request.
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <assert.h>
#include <gnu/lib-names.h>
#include "thread_dbP.h"
static const char *symbol_list_arr[] =
{
[PTHREAD_THREADS_EVENTS] = "__pthread_threads_events",
[PTHREAD_LAST_EVENT] = "__pthread_last_event",
[PTHREAD_HANDLES_NUM] = "__pthread_handles_num",
[PTHREAD_HANDLES] = "__pthread_handles",
[PTHREAD_KEYS] = "pthread_keys",
[LINUXTHREADS_PTHREAD_THREADS_MAX] = "__linuxthreads_pthread_threads_max",
[LINUXTHREADS_PTHREAD_KEYS_MAX] = "__linuxthreads_pthread_keys_max",
[LINUXTHREADS_PTHREAD_SIZEOF_DESCR] = "__linuxthreads_pthread_sizeof_descr",
[LINUXTHREADS_CREATE_EVENT] = "__linuxthreads_create_event",
[LINUXTHREADS_DEATH_EVENT] = "__linuxthreads_death_event",
[LINUXTHREADS_REAP_EVENT] = "__linuxthreads_reap_event",
[NUM_MESSAGES] = NULL
};
const char **
td_symbol_list (void)
{
return symbol_list_arr;
}
int
td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr)
{
assert (idx >= 0 && idx < NUM_MESSAGES);
return ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx], sym_addr);
}

View File

@ -1,5 +1,5 @@
/* Get event address. /* Get event address.
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@ -18,8 +18,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <gnu/lib-names.h>
#include "thread_dbP.h" #include "thread_dbP.h"
@ -27,7 +25,7 @@ td_err_e
td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr) td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
{ {
td_err_e res = TD_NOEVENT; td_err_e res = TD_NOEVENT;
const char *symbol = NULL; int idx = -1;
LOG (__FUNCTION__); LOG (__FUNCTION__);
@ -38,15 +36,15 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
switch (event) switch (event)
{ {
case TD_CREATE: case TD_CREATE:
symbol = "__linuxthreads_create_event"; idx = LINUXTHREADS_CREATE_EVENT;
break; break;
case TD_DEATH: case TD_DEATH:
symbol = "__linuxthreads_death_event"; idx = LINUXTHREADS_DEATH_EVENT;
break; break;
case TD_REAP: case TD_REAP:
symbol = "__linuxthreads_reap_event"; idx = LINUXTHREADS_REAP_EVENT;
break; break;
default: default:
@ -55,11 +53,11 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
} }
/* Now get the address. */ /* Now get the address. */
if (symbol != NULL) if (idx != -1)
{ {
psaddr_t taddr; psaddr_t taddr;
if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, symbol, &taddr) == PS_OK) if (td_lookup (ta->ph, idx, &taddr) == PS_OK)
{ {
/* Success, we got the address. */ /* Success, we got the address. */
addr->type = NOTIFY_BPT; addr->type = NOTIFY_BPT;

View File

@ -1,5 +1,5 @@
/* Get the number of threads in the process. /* Get the number of threads in the process.
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "thread_dbP.h" #include "thread_dbP.h"
#include <gnu/lib-names.h>
td_err_e td_err_e
td_ta_get_nthreads (const td_thragent_t *ta, int *np) td_ta_get_nthreads (const td_thragent_t *ta, int *np)
@ -33,8 +32,7 @@ td_ta_get_nthreads (const td_thragent_t *ta, int *np)
return TD_BADTA; return TD_BADTA;
/* Access the variable `__pthread_handles_num'. */ /* Access the variable `__pthread_handles_num'. */
if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, "__pthread_handles_num", if (td_lookup (ta->ph, PTHREAD_HANDLES_NUM, &addr) != PS_OK)
&addr) != PS_OK)
return TD_ERR; /* XXX Other error value? */ return TD_ERR; /* XXX Other error value? */
if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK) if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK)

View File

@ -1,5 +1,5 @@
/* Attach to target process. /* Attach to target process.
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@ -20,7 +20,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <gnu/lib-names.h>
#include "thread_dbP.h" #include "thread_dbP.h"
@ -41,8 +40,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
/* Get the global event mask. This is one of the variables which /* Get the global event mask. This is one of the variables which
are new in the thread library to enable debugging. If it is are new in the thread library to enable debugging. If it is
not available we cannot debug. */ not available we cannot debug. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK)
"__pthread_threads_events", &addr) != PS_OK)
return TD_NOLIBTHREAD; return TD_NOLIBTHREAD;
/* Fill in the appropriate information. */ /* Fill in the appropriate information. */
@ -59,9 +57,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
/* Get the pointer to the variable pointing to the thread descriptor /* Get the pointer to the variable pointing to the thread descriptor
with the last event. */ with the last event. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, PTHREAD_LAST_EVENT, &(*ta)->pthread_last_event) != PS_OK)
"__pthread_last_event",
&(*ta)->pthread_last_event) != PS_OK)
{ {
free_return: free_return:
free (*ta); free (*ta);
@ -70,21 +66,18 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
/* Get the pointer to the variable containing the number of active /* Get the pointer to the variable containing the number of active
threads. */ threads. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, PTHREAD_HANDLES_NUM, &(*ta)->pthread_handles_num)
"__pthread_handles_num", != PS_OK)
&(*ta)->pthread_handles_num) != PS_OK)
goto free_return; goto free_return;
/* See whether the library contains the necessary symbols. */ /* See whether the library contains the necessary symbols. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "__pthread_handles", if (td_lookup (ps, PTHREAD_HANDLES, &addr) != PS_OK)
&addr) != PS_OK)
goto free_return; goto free_return;
(*ta)->handles = (struct pthread_handle_struct *) addr; (*ta)->handles = (struct pthread_handle_struct *) addr;
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "pthread_keys", if (td_lookup (ps, PTHREAD_KEYS, &addr) != PS_OK)
&addr) != PS_OK)
goto free_return; goto free_return;
/* Cast to the right type. */ /* Cast to the right type. */
@ -93,8 +86,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
/* Find out about the maximum number of threads. Old implementations /* Find out about the maximum number of threads. Old implementations
don't provide this information. In this case we assume that the don't provide this information. In this case we assume that the
debug library is compiled with the same values. */ debug library is compiled with the same values. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, LINUXTHREADS_PTHREAD_THREADS_MAX, &addr) != PS_OK)
"__linuxthreads_pthread_threads_max", &addr) != PS_OK)
(*ta)->pthread_threads_max = PTHREAD_THREADS_MAX; (*ta)->pthread_threads_max = PTHREAD_THREADS_MAX;
else else
{ {
@ -104,8 +96,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
} }
/* Similar for the maximum number of thread local data keys. */ /* Similar for the maximum number of thread local data keys. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, LINUXTHREADS_PTHREAD_KEYS_MAX, &addr) != PS_OK)
"__linuxthreads_pthread_keys_max", &addr) != PS_OK)
(*ta)->pthread_keys_max = PTHREAD_KEYS_MAX; (*ta)->pthread_keys_max = PTHREAD_KEYS_MAX;
else else
{ {
@ -115,9 +106,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
} }
/* And for the size of the second level arrays for the keys. */ /* And for the size of the second level arrays for the keys. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, if (td_lookup (ps, LINUXTHREADS_PTHREAD_SIZEOF_DESCR, &addr) != PS_OK)
"__linuxthreads_pthread_sizeof_descr", &addr)
!= PS_OK)
(*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct); (*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct);
else else
{ {
@ -125,17 +114,6 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
goto free_return; goto free_return;
} }
/* Similar for the maximum number of thread local data keys. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__linuxthreads_pthread_keys_max", &addr) != PS_OK)
(*ta)->pthread_keys_max = PTHREAD_KEYS_MAX;
else
{
if (ps_pdread (ps, addr, &(*ta)->pthread_keys_max, sizeof (int))
!= PS_OK)
goto free_return;
}
/* Now add the new agent descriptor to the list. */ /* Now add the new agent descriptor to the list. */
elemp = (struct agent_list *) malloc (sizeof (struct agent_list)); elemp = (struct agent_list *) malloc (sizeof (struct agent_list));
if (elemp == NULL) if (elemp == NULL)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999 Free Software Foundation, Inc. /* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -289,6 +289,9 @@ extern td_err_e td_init (void);
/* Historical relict. Should not be used anymore. */ /* Historical relict. Should not be used anymore. */
extern td_err_e td_log (void); extern td_err_e td_log (void);
/* Return list of symbols the library can request. */
extern const char **td_symbol_list (void);
/* Generate new thread debug library handle for process PS. */ /* Generate new thread debug library handle for process PS. */
extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta); extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);

View File

@ -8,6 +8,24 @@
#include "../linuxthreads/internals.h" #include "../linuxthreads/internals.h"
/* Indeces for the symbol names. */
enum
{
PTHREAD_THREADS_EVENTS = 0,
PTHREAD_LAST_EVENT,
PTHREAD_HANDLES_NUM,
PTHREAD_HANDLES,
PTHREAD_KEYS,
LINUXTHREADS_PTHREAD_THREADS_MAX,
LINUXTHREADS_PTHREAD_KEYS_MAX,
LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
LINUXTHREADS_CREATE_EVENT,
LINUXTHREADS_DEATH_EVENT,
LINUXTHREADS_REAP_EVENT,
NUM_MESSAGES
};
/* Comment out the following for less verbose output. */ /* Comment out the following for less verbose output. */
#ifndef NDEBUG #ifndef NDEBUG
# define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n")) # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
@ -80,4 +98,8 @@ ta_ok (const td_thragent_t *ta)
return runp != NULL; return runp != NULL;
} }
/* Internal wrapper around ps_pglobal_lookup. */
extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
#endif /* thread_dbP.h */ #endif /* thread_dbP.h */