Index: src/untrusted/pthread/pthread_internal.h |
diff --git a/src/untrusted/pthread/pthread_internal.h b/src/untrusted/pthread/pthread_internal.h |
index d15b86175c352de78c18808f0b06d2ff03559eed..eae8ce70bef8f2b33ff3ca6b872da18e3f110558 100644 |
--- a/src/untrusted/pthread/pthread_internal.h |
+++ b/src/untrusted/pthread/pthread_internal.h |
@@ -8,9 +8,12 @@ |
#define NATIVE_CLIENT_SRC_UNTRUSTED_PTHREAD_PTHREAD_INTERNAL_H_ 1 |
#include "native_client/src/untrusted/irt/irt.h" |
+#include "native_client/src/untrusted/nacl/tls.h" |
+#include "native_client/src/untrusted/nacl/tls_params.h" |
#include "native_client/src/untrusted/pthread/pthread.h" |
+#include "native_client/src/untrusted/pthread/pthread_types.h" |
-struct nc_combined_tdb; |
+#define TDB_SIZE (sizeof(struct nc_combined_tdb)) |
extern int __nc_thread_initialized; |
extern pthread_t __nc_initial_thread_id; |
@@ -23,4 +26,14 @@ void __nc_initialize_interfaces(void); |
void __nc_tsd_exit(void); |
+static inline struct nc_thread_descriptor *__nc_get_tdb(void) { |
+ /* |
+ * Fetch the thread-specific data pointer. This is usually just |
+ * a wrapper around __libnacl_irt_tls.tls_get() but we don't use |
+ * that here so that the IRT build can override the definition. |
+ */ |
+ return (void *) ((char *) __nacl_read_tp_inline() |
+ + __nacl_tp_tdb_offset(TDB_SIZE)); |
+} |
+ |
#endif |