about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-11-07 15:07:10 +0000
committerJakub Jelinek <jakub@redhat.com>2008-11-07 15:07:10 +0000
commit4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59 (patch)
treebf8360059895514a7409ba883f8b658fa62b85bb
parent486bdb886330a250af76cbb12af55d2c67ec0981 (diff)
downloadglibc-4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59.tar.gz
glibc-4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59.tar.xz
glibc-4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59.zip
* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type 
of the thread variable instead of void *. 
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define, 
__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise. 
* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust 
__libc_tsd_define arguments. 
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust 
__libc_tsd_address arguments.  Remove union hack. 
* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments. 
* sunrpc/rpc_thread.c (RPC_VARS): Likewise. 
(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables): 
Adjust __libc_tsd_{set,get} arguments. 
* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust 
__libc_tsd_define arguments. 
* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get} 
arguments. 
* locale/lc-ctype.c (_nl_postload_ctype): Likewise. 
* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type. 
(LOCALE): Adjust __libc_tsd_define arguments. 
* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get 
arguments. 
(LOCALE): Adjust __libc_tsd_define arguments. 
* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define 
arguments. 
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get} 
arguments. nptl/ 
* sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define 
arguments. 
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get} 
arguments.
2008-11-07  Jakub Jelinek  <jakub@redhat.com>

	* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
	__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
	of the thread variable instead of void *.
	* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
	__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
	* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
	__libc_tsd_define arguments.
	(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
	__libc_tsd_address arguments.  Remove union hack.
	* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
	* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
	(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
	Adjust __libc_tsd_{set,get} arguments.
	* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
	__libc_tsd_define arguments.
	* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
	arguments.
	* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
	* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
	(LOCALE): Adjust __libc_tsd_define arguments.
	* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
	arguments.
	(LOCALE): Adjust __libc_tsd_define arguments.
	* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
	arguments.
	(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
	arguments.
-rw-r--r--ChangeLog30
-rw-r--r--bits/libc-tsd.h29
-rw-r--r--ctype/ctype-info.c9
-rw-r--r--include/ctype.h45
-rw-r--r--include/rpc/rpc.h2
-rw-r--r--locale/global-locale.c6
-rw-r--r--locale/lc-ctype.c9
-rw-r--r--locale/localeinfo.h7
-rw-r--r--locale/uselocale.c12
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/sysdeps/pthread/malloc-machine.h8
-rw-r--r--sunrpc/rpc_thread.c20
-rw-r--r--sysdeps/mach/hurd/bits/libc-tsd.h15
-rw-r--r--sysdeps/mach/hurd/malloc-machine.h8
14 files changed, 120 insertions, 87 deletions
diff --git a/ChangeLog b/ChangeLog
index 197fb79944..6f563813fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2008-11-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
+	__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
+	of the thread variable instead of void *.
+	* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
+	__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
+	* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
+	__libc_tsd_define arguments.
+	(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
+	__libc_tsd_address arguments.  Remove union hack.
+	* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
+	* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
+	(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
+	Adjust __libc_tsd_{set,get} arguments.
+	* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
+	__libc_tsd_define arguments.
+	* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
+	arguments.
+	* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
+	* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
+	(LOCALE): Adjust __libc_tsd_define arguments.
+	* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
+	arguments.
+	(LOCALE): Adjust __libc_tsd_define arguments.
+	* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
+	arguments.
+	(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
+	arguments.
+
 2008-11-02  Ulrich Drepper  <drepper@redhat.com>
 
 	* malloc/malloc.c (public_rEALLOc): When new arena is used, copy
diff --git a/bits/libc-tsd.h b/bits/libc-tsd.h
index d39382952a..1a24b701b9 100644
--- a/bits/libc-tsd.h
+++ b/bits/libc-tsd.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  Stub or TLS version.
-   Copyright (C) 1998,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1998,2001,2002,2008 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
@@ -23,15 +23,15 @@
 /* This file defines the following macros for accessing a small fixed
    set of thread-specific `void *' data used only internally by libc.
 
-   __libc_tsd_define(CLASS, KEY)	-- Define or declare a `void *' datum
+   __libc_tsd_define(CLASS, TYPE, KEY)	-- Define or declare a datum with TYPE
    					   for KEY.  CLASS can be `static' for
 					   keys used in only one source file,
 					   empty for global definitions, or
 					   `extern' for global declarations.
-   __libc_tsd_address(KEY)		-- Return the `void **' pointing to
+   __libc_tsd_address(TYPE, KEY)	-- Return the `TYPE *' pointing to
    					   the current thread's datum for KEY.
-   __libc_tsd_get(KEY)			-- Return the `void *' datum for KEY.
-   __libc_tsd_set(KEY, VALUE)		-- Set the datum for KEY to VALUE.
+   __libc_tsd_get(TYPE, KEY)		-- Return the `TYPE' datum for KEY.
+   __libc_tsd_set(TYPE, KEY, VALUE)	-- Set the datum for KEY to VALUE.
 
    The set of available KEY's will usually be provided as an enum,
    and contains (at least):
@@ -52,18 +52,19 @@
    translate directly into variables by macro magic.  */
 
 #if USE___THREAD
-# define __libc_tsd_define(CLASS, KEY)	\
-  CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
+# define __libc_tsd_define(CLASS, TYPE, KEY)	\
+  CLASS __thread TYPE __libc_tsd_##KEY attribute_tls_model_ie;
 
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
+# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY)
+# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY)
+# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
 #else
-# define __libc_tsd_define(CLASS, KEY)	CLASS void *__libc_tsd_##KEY##_data;
+# define __libc_tsd_define(CLASS, TYPE, KEY)	\
+  CLASS TYPE __libc_tsd_##KEY##_data;
 
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY##_data)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY##_data)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
+# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY##_data)
+# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY##_data)
+# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
 #endif
 
 #endif	/* bits/libc-tsd.h */
diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c
index 35f2fb540f..03b67d179f 100644
--- a/ctype/ctype-info.c
+++ b/ctype/ctype-info.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,95,96,97,99,2000,02 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95,96,97,99,2000, 2002, 2008
+   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
@@ -20,9 +21,9 @@
 #include <ctype.h>
 #include <locale/localeinfo.h>
 
-__libc_tsd_define (, CTYPE_B)
-__libc_tsd_define (, CTYPE_TOLOWER)
-__libc_tsd_define (, CTYPE_TOUPPER)
+__libc_tsd_define (, const uint16_t *, CTYPE_B)
+__libc_tsd_define (, const int32_t *, CTYPE_TOLOWER)
+__libc_tsd_define (, const int32_t *, CTYPE_TOUPPER)
 
 
 #include <shlib-compat.h>
diff --git a/include/ctype.h b/include/ctype.h
index ae38b1bf23..f4b782e136 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -18,50 +18,35 @@ extern int __isctype (int __c, int __mask);
 #   define CTYPE_EXTERN_INLINE extern inline
 #  endif
 
-__libc_tsd_define (extern, CTYPE_B)
-__libc_tsd_define (extern, CTYPE_TOUPPER)
-__libc_tsd_define (extern, CTYPE_TOLOWER)
+__libc_tsd_define (extern, const uint16_t *, CTYPE_B)
+__libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER)
+__libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER)
 
 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
 __ctype_b_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const uint16_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_B);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
-  return u.tablep;
+  const uint16_t **tablep = __libc_tsd_address (const uint16_t *, CTYPE_B);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
+  return tablep;
 }
 
 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
 __ctype_toupper_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const int32_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_TOUPPER);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
-  return u.tablep;
+  const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
+  return tablep;
 }
 
 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
 __ctype_tolower_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const int32_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_TOLOWER);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
-  return u.tablep;
+  const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
+  return tablep;
 }
 
 # endif	/* Not NOT_IN_libc.  */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index e5b1685f54..d2f3013114 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -45,7 +45,7 @@ extern void __rpc_thread_key_cleanup (void);
 
 extern void __rpc_thread_destroy (void);
 
-__libc_tsd_define (extern, RPC_VARS)
+__libc_tsd_define (extern, struct rpc_thread_variables *, RPC_VARS)
 
 #define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x)
 
diff --git a/locale/global-locale.c b/locale/global-locale.c
index 2280f68df4..771742e1be 100644
--- a/locale/global-locale.c
+++ b/locale/global-locale.c
@@ -1,5 +1,5 @@
 /* Locale object representing the global locale controlled by setlocale.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006, 2008 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
@@ -62,9 +62,9 @@ struct __locale_struct _nl_global_locale attribute_hidden =
 #include <tls.h>
 #if HAVE___THREAD
 /* The tsd macros don't permit an initializer.  */
-__thread void *__libc_tsd_LOCALE = &_nl_global_locale;
+__thread __locale_t __libc_tsd_LOCALE = &_nl_global_locale;
 #else
-__libc_tsd_define (, LOCALE)
+__libc_tsd_define (, __locale_t, LOCALE)
 /* This is a bad kludge presuming the variable name used by the macros.
    Using typeof makes sure to barf if we do not match the macro definition.
    This ifndef is a further bad kludge for Hurd, where there is an explicit
diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c
index a0a54fbd8d..f2530afe5c 100644
--- a/locale/lc-ctype.c
+++ b/locale/lc-ctype.c
@@ -1,5 +1,5 @@
 /* Define current locale data for LC_CTYPE category.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005,2008
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -66,10 +66,11 @@ _nl_postload_ctype (void)
      in fact using the global locale.  */
   if (_NL_CURRENT_LOCALE == &_nl_global_locale)
     {
-      __libc_tsd_set (CTYPE_B, (void *) _nl_global_locale.__ctype_b);
-      __libc_tsd_set (CTYPE_TOUPPER,
+      __libc_tsd_set (const uint16_t *, CTYPE_B,
+		      (void *) _nl_global_locale.__ctype_b);
+      __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
 		      (void *) _nl_global_locale.__ctype_toupper);
-      __libc_tsd_set (CTYPE_TOLOWER,
+      __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
 		      (void *) _nl_global_locale.__ctype_tolower);
     }
 
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 5e3e99ca68..3661080bb2 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -1,5 +1,6 @@
 /* Declarations for internal libc locale interfaces
-   Copyright (C) 1995-2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2005, 2006, 2007, 2008
+   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
@@ -203,9 +204,9 @@ extern struct __locale_struct _nl_global_locale attribute_hidden;
 
 /* This fetches the thread-local locale_t pointer, either one set with
    uselocale or &_nl_global_locale.  */
-#define _NL_CURRENT_LOCALE	((__locale_t) __libc_tsd_get (LOCALE))
+#define _NL_CURRENT_LOCALE	(__libc_tsd_get (__locale_t, LOCALE))
 #include <bits/libc-tsd.h>
-__libc_tsd_define (extern, LOCALE)
+__libc_tsd_define (extern, __locale_t, LOCALE)
 
 
 /* For static linking it is desireable to avoid always linking in the code
diff --git a/locale/uselocale.c b/locale/uselocale.c
index 6a54b58a27..ec5dc8f356 100644
--- a/locale/uselocale.c
+++ b/locale/uselocale.c
@@ -1,5 +1,5 @@
 /* uselocale -- fetch and set the current per-thread locale
-   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2007, 2008 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
@@ -35,7 +35,7 @@ __uselocale (locale_t newloc)
     {
       const locale_t locobj
 	= newloc == LC_GLOBAL_LOCALE ? &_nl_global_locale : newloc;
-      __libc_tsd_set (LOCALE, locobj);
+      __libc_tsd_set (__locale_t, LOCALE, locobj);
 
 #ifdef NL_CURRENT_INDIRECT
       /* Now we must update all the per-category thread-local variables to
@@ -63,9 +63,11 @@ __uselocale (locale_t newloc)
 #endif
 
       /* Update the special tsd cache of some locale data.  */
-      __libc_tsd_set (CTYPE_B, (void *) locobj->__ctype_b);
-      __libc_tsd_set (CTYPE_TOLOWER, (void *) locobj->__ctype_tolower);
-      __libc_tsd_set (CTYPE_TOUPPER, (void *) locobj->__ctype_toupper);
+      __libc_tsd_set (const uint16_t *, CTYPE_B, (void *) locobj->__ctype_b);
+      __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
+		      (void *) locobj->__ctype_tolower);
+      __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
+		      (void *) locobj->__ctype_toupper);
     }
 
   return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index bc87e2b4d7..dd01d386cd 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
+	arguments.
+	(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
+	arguments.
+
 2008-11-01  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #6955]
diff --git a/nptl/sysdeps/pthread/malloc-machine.h b/nptl/sysdeps/pthread/malloc-machine.h
index 33a3d20531..e99aaa781f 100644
--- a/nptl/sysdeps/pthread/malloc-machine.h
+++ b/nptl/sysdeps/pthread/malloc-machine.h
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes,
    thread-specific data and parameters for malloc.
-   Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007, 2008 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
@@ -63,10 +63,10 @@ extern void *__dso_handle __attribute__ ((__weak__));
 #include <bits/libc-tsd.h>
 
 typedef int tsd_key_t[1];	/* no key data structure, libc magic does it */
-__libc_tsd_define (static, MALLOC)	/* declaration/common definition */
+__libc_tsd_define (static, void *, MALLOC)	/* declaration/common definition */
 #define tsd_key_create(key, destr)	((void) (key))
-#define tsd_setspecific(key, data)	__libc_tsd_set (MALLOC, (data))
-#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (MALLOC))
+#define tsd_setspecific(key, data)	__libc_tsd_set (void *, MALLOC, (data))
+#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (void *, MALLOC))
 
 #include <sysdeps/generic/malloc-machine.h>
 
diff --git a/sunrpc/rpc_thread.c b/sunrpc/rpc_thread.c
index 7a9cc9d62f..796bf086fc 100644
--- a/sunrpc/rpc_thread.c
+++ b/sunrpc/rpc_thread.c
@@ -10,7 +10,7 @@
 
 /* Variable used in non-threaded applications or for the first thread.  */
 static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
-__libc_tsd_define (, RPC_VARS)
+__libc_tsd_define (, struct rpc_thread_variables *, RPC_VARS)
 
 /*
  * Task-variable destructor
@@ -18,7 +18,8 @@ __libc_tsd_define (, RPC_VARS)
 void __attribute__ ((section ("__libc_thread_freeres_fn")))
 __rpc_thread_destroy (void)
 {
-	struct rpc_thread_variables *tvp = __libc_tsd_get (RPC_VARS);
+	struct rpc_thread_variables *tvp
+	  = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 
 	if (tvp != NULL) {
 		__rpc_thread_svc_cleanup ();
@@ -33,7 +34,7 @@ __rpc_thread_destroy (void)
 		free (tvp->svc_pollfd_s);
 		if (tvp != &__libc_tsd_RPC_VARS_mem)
 			free (tvp);
-		__libc_tsd_set (RPC_VARS, NULL);
+		__libc_tsd_set (struct rpc_thread_variables *, RPC_VARS, NULL);
 	}
 }
 #ifdef _LIBC_REENTRANT
@@ -48,7 +49,8 @@ text_set_element (__libc_subfreeres, __rpc_thread_destroy);
 static void
 rpc_thread_multi (void)
 {
-  __libc_tsd_set (RPC_VARS, &__libc_tsd_RPC_VARS_mem);
+  __libc_tsd_set (struct rpc_thread_variables *, RPC_VARS,
+		  &__libc_tsd_RPC_VARS_mem);
 }
 
 
@@ -58,16 +60,18 @@ __rpc_thread_variables (void)
 	__libc_once_define (static, once);
 	struct rpc_thread_variables *tvp;
 
-	tvp = __libc_tsd_get (RPC_VARS);
+	tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 	if (tvp == NULL) {
 		__libc_once (once, rpc_thread_multi);
-		tvp = __libc_tsd_get (RPC_VARS);
+		tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 		if (tvp == NULL) {
 			tvp = calloc (1, sizeof *tvp);
 			if (tvp != NULL)
-				__libc_tsd_set (RPC_VARS, tvp);
+				__libc_tsd_set (struct rpc_thread_variables *,
+						RPC_VARS, tvp);
 			else
-				tvp = __libc_tsd_get (RPC_VARS);
+				tvp = __libc_tsd_get (struct rpc_thread_variables *,
+						      RPC_VARS);
 		}
 	}
 	return tvp;
diff --git a/sysdeps/mach/hurd/bits/libc-tsd.h b/sysdeps/mach/hurd/bits/libc-tsd.h
index 56393e930d..926dd1fcc1 100644
--- a/sysdeps/mach/hurd/bits/libc-tsd.h
+++ b/sysdeps/mach/hurd/bits/libc-tsd.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  Hurd version.
-   Copyright (C) 1998,2002 Free Software Foundation, Inc.
+   Copyright (C) 1998,2002,2008 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
@@ -22,13 +22,14 @@
 
 #include <hurd/threadvar.h>
 
-#define __libc_tsd_define(CLASS, KEY) /* nothing, always have threadvars */
+#define __libc_tsd_define(CLASS, TYPE, KEY) /* nothing, always have threadvars */
 
-#define __libc_tsd_address(KEY) \
-  ((void **) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
-
-#define __libc_tsd_get(KEY)		(*__libc_tsd_address (KEY))
-#define __libc_tsd_set(KEY, VALUE)	(*__libc_tsd_address (KEY) = (VALUE))
+#define __libc_tsd_address(TYPE, KEY) \
+  ((TYPE *) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
 
+#define __libc_tsd_get(TYPE, KEY) \
+  (*__libc_tsd_address (TYPE, KEY))
+#define __libc_tsd_set(TYPE, KEY, VALUE) \
+  (*__libc_tsd_address (TYPE, KEY) = (VALUE))
 
 #endif	/* bits/libc-tsd.h */
diff --git a/sysdeps/mach/hurd/malloc-machine.h b/sysdeps/mach/hurd/malloc-machine.h
index 70aaf11b87..e6078f60dc 100644
--- a/sysdeps/mach/hurd/malloc-machine.h
+++ b/sysdeps/mach/hurd/malloc-machine.h
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes,
    thread-specific data and parameters for malloc.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008 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
@@ -58,10 +58,10 @@
 #include <bits/libc-tsd.h>
 
 typedef int tsd_key_t[1];	/* no key data structure, libc magic does it */
-__libc_tsd_define (static, MALLOC)	/* declaration/common definition */
+__libc_tsd_define (static, void *, MALLOC)	/* declaration/common definition */
 #define tsd_key_create(key, destr)	((void) (key))
-#define tsd_setspecific(key, data)	__libc_tsd_set (MALLOC, (data))
-#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (MALLOC))
+#define tsd_setspecific(key, data)	__libc_tsd_set (void *, MALLOC, (data))
+#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (void *, MALLOC))
 
 #include <sysdeps/generic/malloc-machine.h>