diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-08-24 03:35:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-08-24 03:35:35 +0000 |
commit | 069125e53a03f46341754a9458d9ff9d0d119241 (patch) | |
tree | 4bd0452bc3f034cdf080b17dc27cde3b4c8c02f2 /linuxthreads_db/td_ta_new.c | |
parent | 27692f89660541896c591236fea9714e72b5a811 (diff) | |
download | glibc-069125e53a03f46341754a9458d9ff9d0d119241.tar.gz glibc-069125e53a03f46341754a9458d9ff9d0d119241.tar.xz glibc-069125e53a03f46341754a9458d9ff9d0d119241.zip |
Update.
2002-08-23 Ulrich Drepper <drepper@redhat.com> * pthread.c (__linuxthreads_version): New global constant.
Diffstat (limited to 'linuxthreads_db/td_ta_new.c')
-rw-r--r-- | linuxthreads_db/td_ta_new.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/linuxthreads_db/td_ta_new.c b/linuxthreads_db/td_ta_new.c index 7505f53e63..50ddf0acc3 100644 --- a/linuxthreads_db/td_ta_new.c +++ b/linuxthreads_db/td_ta_new.c @@ -1,5 +1,5 @@ /* Attach to target process. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -20,6 +20,8 @@ #include <stddef.h> #include <stdlib.h> +#include <string.h> +#include <version.h> #include "thread_dbP.h" @@ -33,6 +35,8 @@ td_err_e td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta) { psaddr_t addr; + psaddr_t versaddr; + char versbuf[sizeof (VERSION)]; struct agent_list *elemp; LOG ("td_ta_new"); @@ -43,6 +47,17 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta) if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK) return TD_NOLIBTHREAD; + /* Check whether the versions match. */ + if (td_lookup (ps, LINUXTHREADS_VERSION, &versaddr) != PS_OK) + return TD_VERSION; + if (ps_pdread (ps, versaddr, versbuf, sizeof (versbuf)) != PS_OK) + return TD_ERR; + + versbuf[sizeof (versbuf) - 1] = '\0'; + if (strcmp (versbuf, VERSION) != 0) + /* Not the right version. */ + return TD_VERSION; + /* Fill in the appropriate information. */ *ta = (td_thragent_t *) malloc (sizeof (td_thragent_t)); if (*ta == NULL) |