aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/sysdeps')
-rw-r--r--linuxthreads/sysdeps/pthread/bits/libc-tsd.h14
-rw-r--r--linuxthreads/sysdeps/sh/tls.h8
2 files changed, 16 insertions, 6 deletions
diff --git a/linuxthreads/sysdeps/pthread/bits/libc-tsd.h b/linuxthreads/sysdeps/pthread/bits/libc-tsd.h
index 7a532ea74c..79808a5b4d 100644
--- a/linuxthreads/sysdeps/pthread/bits/libc-tsd.h
+++ b/linuxthreads/sysdeps/pthread/bits/libc-tsd.h
@@ -1,5 +1,5 @@
/* libc-internal interface for thread-specific data. LinuxThreads version.
- Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997,98,99,2001,02 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,13 +20,21 @@
#ifndef _BITS_LIBC_TSD_H
#define _BITS_LIBC_TSD_H 1
-
/* Fast thread-specific data internal to libc. */
enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
_LIBC_TSD_KEY_DL_ERROR,
_LIBC_TSD_KEY_RPC_VARS,
_LIBC_TSD_KEY_N };
+#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
+
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
__const void *) __THROW;
@@ -41,4 +49,6 @@ extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \
: ((__libc_tsd_##KEY##_data = (VALUE)), 0))
+#endif
+
#endif /* bits/libc-tsd.h */
diff --git a/linuxthreads/sysdeps/sh/tls.h b/linuxthreads/sysdeps/sh/tls.h
index e8cf504387..7dc40409a6 100644
--- a/linuxthreads/sysdeps/sh/tls.h
+++ b/linuxthreads/sysdeps/sh/tls.h
@@ -73,16 +73,16 @@ typedef struct
/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */
# define INSTALL_DTV(descr, dtvp) \
- ((tcbhead_t *) descr)->dtv = dtvp + 1
+ ((tcbhead_t *) (descr))->dtv = dtvp + 1
/* Install new dtv for current thread. */
# define INSTALL_NEW_DTV(dtv) \
({ struct _pthread_descr_struct *__descr; \
- THREAD_SETMEM (__descr, p_header.data.dtvp, dtv); })
+ THREAD_SETMEM (__descr, p_header.data.dtvp, (dtv)); })
/* Return dtv of given thread descriptor. */
# define GET_DTV(descr) \
- (((tcbhead_t *) descr)->dtv)
+ (((tcbhead_t *) (descr))->dtv)
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
@@ -94,7 +94,7 @@ typedef struct
tcbhead_t *head = _descr; \
\
head->tcb = _descr; \
- /* For now the thread descriptor is at the same address. */ \
+ /* For now the thread descriptor is at the same address. */ \
head->self = _descr; \
\
asm ("ldc %0,gbr" : : "r" (_descr)); \