summaryrefslogtreecommitdiff
path: root/lib/librthread/tcb.h
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-02-15 22:01:25 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-02-15 22:01:25 +0000
commit79bcd4dfe34962b8fd02ab9e6d6c1785f5d4ce1c (patch)
tree41a199e0a5e656f4c29c5bfc20d3f3bcac5d6895 /lib/librthread/tcb.h
parentbbd4da32cb626e4d201c5da8818c72e4aa5eeb36 (diff)
Revert previous diff: sparc and sparc64 don't set the TCB to NULL in exec, yet,
and vax doesn't support symbols that are both weak and undefined (yet?). sparc issue diagnosed by kettenis@, vax problem found by todd@
Diffstat (limited to 'lib/librthread/tcb.h')
-rw-r--r--lib/librthread/tcb.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/librthread/tcb.h b/lib/librthread/tcb.h
index 2139d21d6db..12c5ec8fa63 100644
--- a/lib/librthread/tcb.h
+++ b/lib/librthread/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.5 2013/02/14 03:38:15 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.6 2013/02/15 22:01:24 guenther Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
*
@@ -85,6 +85,7 @@ struct thread_control_block {
__ERRNOPTR(TCB_THREAD())
#define TCB_INIT(tcb, thread, errnoptr) \
do { \
+ (tcb)->tcb_dtv = 0; \
(tcb)->tcb_thread = (thread); \
__ERRNOPTR(thread) = (errnoptr); \
} while (0)
@@ -112,6 +113,7 @@ struct thread_control_block {
#define TCB_INIT(tcb, thread, errnoptr) \
do { \
(tcb)->__tcb_self = (tcb); \
+ (tcb)->tcb_dtv = 0; \
(tcb)->tcb_thread = (thread); \
(tcb)->__tcb_errno = (errnoptr); \
} while (0)
@@ -127,11 +129,16 @@ struct thread_control_block {
#define TCB_SET(tcb) __set_tcb(tcb)
#endif
+#if 0
+void *_rtld_allocate_tls(void *, size_t, size_t);
+void _rtld_free_tls(void *, size_t, size_t);
+#else
/*
- * Functions that will eventually be provided by ld.so for allocating
- * and freeing TCBs
+ * XXX Until we have these in ld.so and support __thread, just use
+ * malloc/free. The main thread's TCB cannot be allocated or freed with these.
*/
-void *_dl_allocate_tls(void *);
-void _dl_free_tls(void *);
+#define _rtld_allocate_tls(old, size, align) malloc(size)
+#define _rtld_free_tls(old, size, align) free(old)
+#endif
#endif /* _TCB_H_ */