summaryrefslogtreecommitdiffstats
path: root/libc/inet/resolv.c
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-08-12 11:18:23 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-08-12 11:18:23 +0000
commitb46868ff8b3d2fb592e3fca4a516695533eae9e5 (patch)
tree09f3f841693624a20dcf7bbd2a69d08dee728323 /libc/inet/resolv.c
parent50dcba0bb24c6c57397dab0ee4a083ee2c8266aa (diff)
downloaduClibc-alpine-b46868ff8b3d2fb592e3fca4a516695533eae9e5.tar.bz2
uClibc-alpine-b46868ff8b3d2fb592e3fca4a516695533eae9e5.tar.xz
This will hopefully be the last modification to the resolver code for a while. The complexity comes from the code used only during library build time, to non-threaded programs to threaded programs such that things are not a mess. I was getting undefined '_res' when doing a buildroot, but things are fixed now. This is much cleaner and more sane.
Diffstat (limited to 'libc/inet/resolv.c')
-rw-r--r--libc/inet/resolv.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 5e82c95d6..bb188b959 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1096,17 +1096,22 @@ struct hostent *gethostbyname2(const char *name, int family)
#ifdef L_res_init
+#undef _res
+struct __res_state _res;
+
+struct __res_state * weak_const_function __res_state (void)
+{
+ return &_res;
+}
+
#ifdef __PTHREADS_NATIVE__
#include <tls.h>
-struct __res_state _res_thread;
-__thread struct __res_state *__resp = &_res_thread;
-#else
-struct __res_state _res;
+__thread struct __res_state *__resp = &_res;
#endif
int res_init(void)
{
- struct __res_state *rp = &(_res);
+ struct __res_state *rp = __res_state();
__close_nameservers();
__open_nameservers();