From 4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 Nov 2008 15:07:10 +0000 Subject: [PATCH] * 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 * 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. --- ChangeLog | 30 +++++++++++++++++++++++ bits/libc-tsd.h | 29 +++++++++++----------- ctype/ctype-info.c | 9 +++---- include/ctype.h | 45 ++++++++++++----------------------- include/rpc/rpc.h | 2 +- locale/global-locale.c | 6 ++--- locale/lc-ctype.c | 9 +++---- locale/localeinfo.h | 7 +++--- locale/uselocale.c | 12 ++++++---- nptl/ChangeLog | 7 ++++++ nptl/sysdeps/pthread/malloc-machine.h | 8 +++---- sunrpc/rpc_thread.c | 20 +++++++++------- sysdeps/mach/hurd/bits/libc-tsd.h | 15 ++++++------ sysdeps/mach/hurd/malloc-machine.h | 8 +++---- 14 files changed, 120 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 197fb79..6f56381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2008-11-07 Jakub Jelinek + + * 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 * malloc/malloc.c (public_rEALLOc): When new arena is used, copy diff --git a/bits/libc-tsd.h b/bits/libc-tsd.h index d393829..1a24b70 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 35f2fb5..03b67d1 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 #include -__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 diff --git a/include/ctype.h b/include/ctype.h index ae38b1b..f4b782e 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 e5b1685..d2f3013 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 2280f68..771742e 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 #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 a0a54fb..f2530af 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 5e3e99c..3661080 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 -__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 6a54b58..ec5dc8f 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 bc87e2b..dd01d38 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,10 @@ +2008-11-07 Jakub Jelinek + + * 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 [BZ #6955] diff --git a/nptl/sysdeps/pthread/malloc-machine.h b/nptl/sysdeps/pthread/malloc-machine.h index 33a3d20..e99aaa7 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 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 diff --git a/sunrpc/rpc_thread.c b/sunrpc/rpc_thread.c index 7a9cc9d..796bf08 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 56393e9..926dd1f 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 -#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 70aaf11..e6078f6 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 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 -- 2.7.4