1998-11-30 14:21:53 +00:00
|
|
|
/* libc-internal interface for thread-specific data. LinuxThreads version.
|
2003-01-03 22:32:41 +00:00
|
|
|
Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
|
1998-11-30 14:21:53 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2002-08-26 22:40:48 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2.1 of the
|
1998-11-30 14:21:53 +00:00
|
|
|
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
|
2002-08-26 22:40:48 +00:00
|
|
|
Lesser General Public License for more details.
|
1998-11-30 14:21:53 +00:00
|
|
|
|
2002-08-26 22:40:48 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1998-11-30 14:21:53 +00:00
|
|
|
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. */
|
|
|
|
|
|
|
|
#ifndef _BITS_LIBC_TSD_H
|
|
|
|
#define _BITS_LIBC_TSD_H 1
|
|
|
|
|
2002-12-28 10:24:40 +00:00
|
|
|
#include <linuxthreads/descr.h>
|
* sysdeps/pthread/bits/libc-tsd.h: Include <tls.h>.
[USE_TLS && HAVE___THREAD]: Just include the sysdeps/generic file,
which does the right thing when __thread support is available.
* descr.h (struct _pthread_descr_struct) [USE_TLS && HAVE___THREAD]:
Omit `p_libc_specific', `p_errnop', `p_errno', `p_h_errnop',
`p_h_errno', `p_resp', and `p_res' members.
* pthread.c (__pthread_initialize_minimal) [USE_TLS && HAVE___THREAD]:
Don't initialize `p_errnop' and `p_h_errnop' members.
(__pthread_reset_main_thread): Likewise.
(__pthread_initialize_manager): Likewise.
* manager.c (__pthread_manager, pthread_handle_create): Likewise.
* pthread.c (pthread_initialize) [USE_TLS && HAVE___THREAD]:
Don't initialize `p_resp' member.
(__pthread_reset_main_thread): Likewise.
* manager.c (pthread_handle_create): Likewise.
* specific.c (libc_internal_tsd_set, libc_internal_tsd_get):
Conditionalize these on [!(USE_TLS && HAVE___THREAD)].
* errno.c [USE_TLS && HAVE___THREAD]
(__h_errno_location, __res_state): Don't define these at all.
* sysdeps/i386/tls.h (INSTALL_DTV): Add parens around arguments!
(INSTALL_NEW_DTV, GET_DTV): Likewise.
* sysdeps/sh/tls.h (INSTALL_DTV, INSTALL_NEW_DTV, GET_DTV): Likewise.
* weaks.c: Don't include <errno.h> here.
2002-08-01 Roland McGrath <roland@redhat.com>
* sysdeps/i386/tls.h (TLS_DO_MODIFY_LDT): New macro, broken out of
TLS_INIT_TP.
(TLS_DO_SET_THREAD_AREA): New macro, uses thread_set_area syscall.
(TLS_SETUP_GS_SEGMENT): New macro, try one or the other or both.
(TLS_INIT_TP): Use that.
2002-08-02 03:32:24 +00:00
|
|
|
#include <tls.h>
|
|
|
|
|
|
|
|
#if USE_TLS && HAVE___THREAD
|
|
|
|
|
|
|
|
/* When __thread works, the generic definition is what we want. */
|
|
|
|
# include <sysdeps/generic/bits/libc-tsd.h>
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2002-12-28 10:24:40 +00:00
|
|
|
# include <bits/libc-lock.h>
|
* ctype/ctype.h (__ctype_b, __ctype_toupper, __ctype_tolower):
Variable declarations removed.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Declare
these functions to replace them.
(__isctype, tolower, toupper, _tolower, _toupper): Use those accessor
functions plus an indirection rather than the old global variables.
* include/ctype.h (__isctype, tolower, _tolower, toupper, _toupper):
Macros removed.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): New extern
inline functions.
* ctype/ctype-info.c: Revert last reversion back the other way.
Define tsd vars CTYPE_B, CTYPE_TOLOWER, CTYPE_TOUPPER.
Define real function versions of include/ctype.h inlines here.
* ctype/Versions (libc: GLIBC_2.3): Add __ctype_b_loc,
__ctype_tolower_loc, __ctype_toupper_loc.
* locale/lc-ctype.c: Revert last reversion back the other way.
(_nl_postload_ctype): If current thread uses the global locale,
update its tsd vars.
* locale/uselocale.c (__uselocale): Update tsd vars from new locale.
* hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add CTYPE_B,
CTYPE_TOLOWER, CTYPE_TOUPPER.
* sysdeps/generic/bits/libc-tsd.h (__libc_tsd_address): New macro.
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_address): Renamed
from __libc_tsd_threadvar_location.
(__libc_tsd_set, __libc_tsd_get): Update uses.
2002-09-02 07:09:08 +00:00
|
|
|
|
2002-12-28 10:24:40 +00:00
|
|
|
# ifndef SHARED
|
2003-01-03 22:32:41 +00:00
|
|
|
extern void ** __pthread_internal_tsd_address (int);
|
|
|
|
extern void *__pthread_internal_tsd_get (int);
|
|
|
|
extern int __pthread_internal_tsd_set (int, const void *);
|
|
|
|
|
2002-12-28 10:24:40 +00:00
|
|
|
weak_extern (__pthread_internal_tsd_address)
|
|
|
|
weak_extern (__pthread_internal_tsd_get)
|
|
|
|
weak_extern (__pthread_internal_tsd_set)
|
|
|
|
# endif
|
1998-11-30 14:21:53 +00:00
|
|
|
|
|
|
|
#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
2002-12-28 10:24:40 +00:00
|
|
|
#define __libc_tsd_address(KEY) \
|
|
|
|
__libc_maybe_call2 (pthread_internal_tsd_address, \
|
|
|
|
(_LIBC_TSD_KEY_##KEY), &__libc_tsd_##KEY##_data)
|
1998-11-30 14:21:53 +00:00
|
|
|
#define __libc_tsd_get(KEY) \
|
2002-12-28 10:24:40 +00:00
|
|
|
__libc_maybe_call2 (pthread_internal_tsd_get, \
|
|
|
|
(_LIBC_TSD_KEY_##KEY), __libc_tsd_##KEY##_data)
|
1998-11-30 14:21:53 +00:00
|
|
|
#define __libc_tsd_set(KEY, VALUE) \
|
2002-12-28 10:24:40 +00:00
|
|
|
__libc_maybe_call2 (pthread_internal_tsd_set, \
|
|
|
|
(_LIBC_TSD_KEY_##KEY, (VALUE)), \
|
|
|
|
(__libc_tsd_##KEY##_data = (VALUE), 0))
|
1998-11-30 14:21:53 +00:00
|
|
|
|
* sysdeps/pthread/bits/libc-tsd.h: Include <tls.h>.
[USE_TLS && HAVE___THREAD]: Just include the sysdeps/generic file,
which does the right thing when __thread support is available.
* descr.h (struct _pthread_descr_struct) [USE_TLS && HAVE___THREAD]:
Omit `p_libc_specific', `p_errnop', `p_errno', `p_h_errnop',
`p_h_errno', `p_resp', and `p_res' members.
* pthread.c (__pthread_initialize_minimal) [USE_TLS && HAVE___THREAD]:
Don't initialize `p_errnop' and `p_h_errnop' members.
(__pthread_reset_main_thread): Likewise.
(__pthread_initialize_manager): Likewise.
* manager.c (__pthread_manager, pthread_handle_create): Likewise.
* pthread.c (pthread_initialize) [USE_TLS && HAVE___THREAD]:
Don't initialize `p_resp' member.
(__pthread_reset_main_thread): Likewise.
* manager.c (pthread_handle_create): Likewise.
* specific.c (libc_internal_tsd_set, libc_internal_tsd_get):
Conditionalize these on [!(USE_TLS && HAVE___THREAD)].
* errno.c [USE_TLS && HAVE___THREAD]
(__h_errno_location, __res_state): Don't define these at all.
* sysdeps/i386/tls.h (INSTALL_DTV): Add parens around arguments!
(INSTALL_NEW_DTV, GET_DTV): Likewise.
* sysdeps/sh/tls.h (INSTALL_DTV, INSTALL_NEW_DTV, GET_DTV): Likewise.
* weaks.c: Don't include <errno.h> here.
2002-08-01 Roland McGrath <roland@redhat.com>
* sysdeps/i386/tls.h (TLS_DO_MODIFY_LDT): New macro, broken out of
TLS_INIT_TP.
(TLS_DO_SET_THREAD_AREA): New macro, uses thread_set_area syscall.
(TLS_SETUP_GS_SEGMENT): New macro, try one or the other or both.
(TLS_INIT_TP): Use that.
2002-08-02 03:32:24 +00:00
|
|
|
#endif
|
|
|
|
|
1998-11-30 14:21:53 +00:00
|
|
|
#endif /* bits/libc-tsd.h */
|