summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/netdb.h20
-rw-r--r--libc/inet/resolv.c1
-rw-r--r--libc/misc/internals/__h_errno_location.c6
3 files changed, 8 insertions, 19 deletions
diff --git a/include/netdb.h b/include/netdb.h
index 774aac268..1d27ddcd4 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -54,15 +54,8 @@
__BEGIN_DECLS
/* Error status for non-reentrant lookup functions.
- We use a macro to access always the thread-specific `h_errno' variable.
- We always need the extern int here in case internal libc code undefines
- the macro because it needs access to the underlying storage. */
-#if !defined(__UCLIBC_HAS_THREADS_NATIVE__)
-extern int h_errno;
-#endif
-#if defined(__UCLIBC_HAS_THREADS__)
-# define h_errno (*__h_errno_location ())
-#endif
+ We use a macro to access always the thread-specific `h_errno' variable. */
+#define h_errno (*__h_errno_location ())
/* Function to get address of global `h_errno' variable. */
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
@@ -657,13 +650,4 @@ extern int getnameinfo (__const struct sockaddr *__restrict __sa,
__END_DECLS
-#ifdef _LIBC
-# ifdef __UCLIBC_HAS_THREADS_NATIVE__
-# include <tls.h>
-# undef h_errno
-# define h_errno h_errno /* For #ifndef h_errno tests. */
-extern __thread int h_errno attribute_tls_model_ie;
-# endif
-#endif
-
#endif /* netdb.h */
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 4bfec0a50..c2df49224 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1145,7 +1145,6 @@ struct __res_state * weak_const_function __res_state (void)
}
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tls.h>
__thread struct __res_state *__resp = &_res;
#endif
diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c
index f4f598057..d1040dd87 100644
--- a/libc/misc/internals/__h_errno_location.c
+++ b/libc/misc/internals/__h_errno_location.c
@@ -3,6 +3,12 @@
#include <netdb.h>
#undef h_errno
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+extern __thread int h_errno;
+#else
+extern int h_errno;
+#endif
+
int * weak_const_function __h_errno_location (void)
{
return &h_errno;