Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
	* Makefile: Define -D_RPC_THREAD_SAFE_ for cancel.c.
  • Loading branch information
Ulrich Drepper committed Mar 20, 2001
1 parent f1e4a4a commit 481b550
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 48 deletions.
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -30,6 +30,10 @@ Version 2.2.3

* David Mosberger <davidm@hpl.hp.com> implemented the setcontext family
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

Expand Down
6 changes: 6 additions & 0 deletions PROJECTS
Expand Up @@ -199,3 +199,9 @@ contact <bug-glibc@gnu.org>.


[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.
1 change: 1 addition & 0 deletions linuxthreads/ChangeLog
@@ -1,5 +1,6 @@
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.
* sysdeps/pthread/bits/libc-tsd.h: Define _LIBC_TSD_KEY_VARS.

Expand Down
2 changes: 1 addition & 1 deletion linuxthreads/Makefile
Expand Up @@ -70,7 +70,7 @@ CFLAGS-mutex.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-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)\"

# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
Expand Down
13 changes: 13 additions & 0 deletions linuxthreads_db/ChangeLog
@@ -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>

* Makefile: When generating DSO link with libc_nonshared.a.
Expand Down
2 changes: 1 addition & 1 deletion linuxthreads_db/Makefile
Expand Up @@ -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_clear_event td_thr_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))

Expand Down
3 changes: 3 additions & 0 deletions linuxthreads_db/Versions
Expand Up @@ -12,4 +12,7 @@ libthread_db {
td_thr_setprio; td_thr_setsigpending; td_thr_setxregs; td_thr_sigsetmask;
td_thr_tsd; td_thr_validate;
}
GLIBC_2.2.3 {
td_symbol_list;
}
}
55 changes: 55 additions & 0 deletions linuxthreads_db/td_symbol_list.c
@@ -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);
}
16 changes: 7 additions & 9 deletions linuxthreads_db/td_ta_event_addr.c
@@ -1,5 +1,5 @@
/* 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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
Expand All @@ -18,16 +18,14 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#include <gnu/lib-names.h>

#include "thread_dbP.h"


td_err_e
td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
{
td_err_e res = TD_NOEVENT;
const char *symbol = NULL;
int idx = -1;

LOG (__FUNCTION__);

Expand All @@ -38,15 +36,15 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
switch (event)
{
case TD_CREATE:
symbol = "__linuxthreads_create_event";
idx = LINUXTHREADS_CREATE_EVENT;
break;

case TD_DEATH:
symbol = "__linuxthreads_death_event";
idx = LINUXTHREADS_DEATH_EVENT;
break;

case TD_REAP:
symbol = "__linuxthreads_reap_event";
idx = LINUXTHREADS_REAP_EVENT;
break;

default:
Expand All @@ -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. */
if (symbol != NULL)
if (idx != -1)
{
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. */
addr->type = NOTIFY_BPT;
Expand Down
6 changes: 2 additions & 4 deletions linuxthreads_db/td_ta_get_nthreads.c
@@ -1,5 +1,5 @@
/* 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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
Expand All @@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */

#include "thread_dbP.h"
#include <gnu/lib-names.h>

td_err_e
td_ta_get_nthreads (const td_thragent_t *ta, int *np)
Expand All @@ -33,8 +32,7 @@ td_ta_get_nthreads (const td_thragent_t *ta, int *np)
return TD_BADTA;

/* Access the variable `__pthread_handles_num'. */
if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, "__pthread_handles_num",
&addr) != PS_OK)
if (td_lookup (ta->ph, PTHREAD_HANDLES_NUM, &addr) != PS_OK)
return TD_ERR; /* XXX Other error value? */

if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK)
Expand Down
42 changes: 10 additions & 32 deletions linuxthreads_db/td_ta_new.c
@@ -1,5 +1,5 @@
/* 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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
Expand All @@ -20,7 +20,6 @@

#include <stddef.h>
#include <stdlib.h>
#include <gnu/lib-names.h>

#include "thread_dbP.h"

Expand All @@ -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
are new in the thread library to enable debugging. If it is
not available we cannot debug. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__pthread_threads_events", &addr) != PS_OK)
if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK)
return TD_NOLIBTHREAD;

/* Fill in the appropriate information. */
Expand All @@ -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
with the last event. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__pthread_last_event",
&(*ta)->pthread_last_event) != PS_OK)
if (td_lookup (ps, PTHREAD_LAST_EVENT, &(*ta)->pthread_last_event) != PS_OK)
{
free_return:
free (*ta);
Expand All @@ -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
threads. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__pthread_handles_num",
&(*ta)->pthread_handles_num) != PS_OK)
if (td_lookup (ps, PTHREAD_HANDLES_NUM, &(*ta)->pthread_handles_num)
!= PS_OK)
goto free_return;

/* See whether the library contains the necessary symbols. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "__pthread_handles",
&addr) != PS_OK)
if (td_lookup (ps, PTHREAD_HANDLES, &addr) != PS_OK)
goto free_return;

(*ta)->handles = (struct pthread_handle_struct *) addr;


if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "pthread_keys",
&addr) != PS_OK)
if (td_lookup (ps, PTHREAD_KEYS, &addr) != PS_OK)
goto free_return;

/* Cast to the right type. */
Expand All @@ -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
don't provide this information. In this case we assume that the
debug library is compiled with the same values. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__linuxthreads_pthread_threads_max", &addr) != PS_OK)
if (td_lookup (ps, LINUXTHREADS_PTHREAD_THREADS_MAX, &addr) != PS_OK)
(*ta)->pthread_threads_max = PTHREAD_THREADS_MAX;
else
{
Expand All @@ -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. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__linuxthreads_pthread_keys_max", &addr) != PS_OK)
if (td_lookup (ps, LINUXTHREADS_PTHREAD_KEYS_MAX, &addr) != PS_OK)
(*ta)->pthread_keys_max = PTHREAD_KEYS_MAX;
else
{
Expand All @@ -115,27 +106,14 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
}

/* And for the size of the second level arrays for the keys. */
if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
"__linuxthreads_pthread_sizeof_descr", &addr)
!= PS_OK)
if (td_lookup (ps, LINUXTHREADS_PTHREAD_SIZEOF_DESCR, &addr) != PS_OK)
(*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct);
else
{
if (ps_pdread (ps, addr, &(*ta)->sizeof_descr, sizeof (int)) != PS_OK)
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. */
elemp = (struct agent_list *) malloc (sizeof (struct agent_list));
if (elemp == NULL)
Expand Down
5 changes: 4 additions & 1 deletion linuxthreads_db/thread_db.h
@@ -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.
The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -289,6 +289,9 @@ extern td_err_e td_init (void);
/* Historical relict. Should not be used anymore. */
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. */
extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);

Expand Down
22 changes: 22 additions & 0 deletions linuxthreads_db/thread_dbP.h
Expand Up @@ -8,6 +8,24 @@
#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. */
#ifndef NDEBUG
# define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
Expand Down Expand Up @@ -80,4 +98,8 @@ ta_ok (const td_thragent_t *ta)
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 */

0 comments on commit 481b550

Please sign in to comment.