summaryrefslogtreecommitdiff
path: root/nptl_db/td_thr_tlsbase.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-09-09 07:01:01 +0000
committerRoland McGrath <roland@gnu.org>2003-09-09 07:01:01 +0000
commit7f08f55a9f88d23fcfbf1fed00f4d5a094e5fffc (patch)
tree5796d7f5d713c3c264a70a6039b0ba52e262b06f /nptl_db/td_thr_tlsbase.c
parent416be7f049391ce421d9b12a2c3b81bb3cad9f58 (diff)
* sysdeps/unix/sysv/linux/speed.c
(cfsetospeed): Only set c_ospeed under [_HAVE_STRUCT_TERMIOS_C_OSPEED]. (cfsetispeed): Only set c_ispeed under [_HAVE_STRUCT_TERMIOS_C_ISPEED]. * sysdeps/unix/sysv/linux/bits/termios.h (_HAVE_STRUCT_TERMIOS_C_ISPEED, _HAVE_STRUCT_TERMIOS_C_OSPEED): Define. * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
Diffstat (limited to 'nptl_db/td_thr_tlsbase.c')
-rw-r--r--nptl_db/td_thr_tlsbase.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/nptl_db/td_thr_tlsbase.c b/nptl_db/td_thr_tlsbase.c
index ff8f1c7504..c57009a73c 100644
--- a/nptl_db/td_thr_tlsbase.c
+++ b/nptl_db/td_thr_tlsbase.c
@@ -19,49 +19,32 @@
#include "thread_dbP.h"
-/* Value used for dtv entries for which the allocation is delayed. */
-# define TLS_DTV_UNALLOCATED ((void *) -1l)
-
td_err_e
td_thr_tlsbase (const td_thrhandle_t *th,
unsigned long int modid,
psaddr_t *base)
{
+ td_err_e err;
+ psaddr_t dtv, dtvptr;
+
if (modid < 1)
return TD_NOTLS;
-#if USE_TLS
- union dtv pdtv, *dtvp;
-
- LOG ("td_thr_tlsbase");
-
- psaddr_t dtvpp = th->th_unique;
-#if TLS_TCB_AT_TP
- dtvpp += offsetof (struct pthread, header.dtv);
-#elif TLS_DTV_AT_TP
- dtvpp += TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv);
-#else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined."
-#endif
-
/* Get the DTV pointer from the thread descriptor. */
- if (ps_pdread (th->th_ta_p->ph, dtvpp, &dtvp, sizeof dtvp) != PS_OK)
- return TD_ERR; /* XXX Other error value? */
+ err = DB_GET_FIELD (dtv, th->th_ta_p, th->th_unique, pthread, dtvp, 0);
+ if (err != TD_OK)
+ return err;
/* Get the corresponding entry in the DTV. */
- if (ps_pdread (th->th_ta_p->ph, dtvp + modid,
- &pdtv, sizeof (union dtv)) != PS_OK)
- return TD_ERR; /* XXX Other error value? */
+ err = DB_GET_FIELD (dtvptr, th->th_ta_p, dtv, dtv, dtv, modid);
+ if (err != TD_OK)
+ return err;
/* It could be that the memory for this module is not allocated for
the given thread. */
- if (pdtv.pointer == TLS_DTV_UNALLOCATED)
+ if ((uintptr_t) dtvptr & 1)
return TD_TLSDEFER;
- *base = (char *) pdtv.pointer;
-
+ *base = dtvptr;
return TD_OK;
-#else
- return TD_ERR;
-#endif
}