svn commit: branches/uClibc-nptl: include libc/inet

sjhill at uclibc.org sjhill at uclibc.org
Thu Jan 5 01:28:25 UTC 2006


Author: sjhill
Date: 2006-01-04 17:28:23 -0800 (Wed, 04 Jan 2006)
New Revision: 13095

Log:
Make resolver state pointer '__resp' to be TLS variable. Again, these changes work for the threaded and non-threaded cases.


Modified:
   branches/uClibc-nptl/include/resolv.h
   branches/uClibc-nptl/libc/inet/Makefile.in
   branches/uClibc-nptl/libc/inet/resolv.c


Changeset:
Modified: branches/uClibc-nptl/include/resolv.h
===================================================================
--- branches/uClibc-nptl/include/resolv.h	2006-01-05 01:25:30 UTC (rev 13094)
+++ branches/uClibc-nptl/include/resolv.h	2006-01-05 01:28:23 UTC (rev 13095)
@@ -51,20 +51,18 @@
 
 #ifndef _RESOLV_H_
 
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#else
-# include <sys/types.h>
-#endif
-#include <stdio.h>
+/* These headers are needed for types used in the `struct res_state'
+   declaration.  */
+#include <sys/types.h>
 #include <netinet/in.h>
 
 #ifndef __need_res_state
-#define	_RESOLV_H_
+# define _RESOLV_H_
 
-#include <sys/param.h>
-#include <sys/cdefs.h>
-#include <arpa/nameser.h>
+# include <sys/param.h>
+# include <sys/cdefs.h>
+# include <stdio.h>
+# include <arpa/nameser.h>
 #endif
 
 #ifndef __res_state_defined
@@ -87,51 +85,21 @@
 					   int anssiz,
 					   int *resplen);
 
-struct res_sym {
-	int	number;		/* Identifying number, like T_MX */
-	char *	name;		/* Its symbolic name, like "MX" */
-	char *	humanname;	/* Its fun name, like "mail exchanger" */
-};
-
 /*
- * Resolver options (keep these in synch with res_debug.c, please)
- */
-#define RES_INIT	0x00000001	/* address initialized */
-#define RES_DEBUG	0x00000002	/* print debug messages */
-#define RES_AAONLY	0x00000004	/* authoritative answers only (!IMPL)*/
-#define RES_USEVC	0x00000008	/* use virtual circuit */
-#define RES_PRIMARY	0x00000010	/* query primary server only (!IMPL) */
-#define RES_IGNTC	0x00000020	/* ignore trucation errors */
-#define RES_RECURSE	0x00000040	/* recursion desired */
-#define RES_DEFNAMES	0x00000080	/* use default domain name */
-#define RES_STAYOPEN	0x00000100	/* Keep TCP socket open */
-#define RES_DNSRCH	0x00000200	/* search up local domain tree */
-#define	RES_INSECURE1	0x00000400	/* type 1 security disabled */
-#define	RES_INSECURE2	0x00000800	/* type 2 security disabled */
-#define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */
-#define	RES_USE_INET6	0x00002000	/* use/map IPv6 in gethostbyname() */
-#define RES_ROTATE	0x00004000	/* rotate ns list after each query */
-#define	RES_NOCHECKNAME	0x00008000	/* do not check names for sanity. */
-#define	RES_KEEPTSIG	0x00010000	/* do not strip TSIG records */
-#define	RES_BLAST	0x00020000	/* blast all recursive servers */
-
-#define RES_DEFAULT	(RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
-
-/*
  * Global defines and variables for resolver stub.
  */
-#define	MAXNS			3	/* max # name servers we'll track */
-#define	MAXDFLSRCH		3	/* # default domain levels to try */
-#define	MAXDNSRCH		6	/* max # domains in search path */
-#define	LOCALDOMAINPARTS	2	/* min levels in name that is "local" */
+# define MAXNS			3	/* max # name servers we'll track */
+# define MAXDFLSRCH		3	/* # default domain levels to try */
+# define MAXDNSRCH		6	/* max # domains in search path */
+# define LOCALDOMAINPARTS	2	/* min levels in name that is "local" */
 
-#define	RES_TIMEOUT		5	/* min. seconds between retries */
-#define	MAXRESOLVSORT		10	/* number of net to sort on */
-#define	RES_MAXNDOTS		15	/* should reflect bit field size */
-#define	RES_MAXRETRANS		30	/* only for resolv.conf/RES_OPTIONS */
-#define	RES_MAXRETRY		5	/* only for resolv.conf/RES_OPTIONS */
-#define	RES_DFLRETRY		2	/* Default #/tries. */
-#define	RES_MAXTIME		65535	/* Infinity, in milliseconds. */
+# define RES_TIMEOUT		5	/* min. seconds between retries */
+# define MAXRESOLVSORT		10	/* number of net to sort on */
+# define RES_MAXNDOTS		15	/* should reflect bit field size */
+# define RES_MAXRETRANS		30	/* only for resolv.conf/RES_OPTIONS */
+# define RES_MAXRETRY		5	/* only for resolv.conf/RES_OPTIONS */
+# define RES_DFLRETRY		2	/* Default #/tries. */
+# define RES_MAXTIME		65535	/* Infinity, in milliseconds. */
 
 struct __res_state {
 	int	retrans;	 	/* retransmition time interval */
@@ -140,7 +108,7 @@
 	int	nscount;		/* number of name servers */
 	struct sockaddr_in
 		nsaddr_list[MAXNS];	/* address of name server */
-#define	nsaddr	nsaddr_list[0]		/* for backward compatibility */
+# define nsaddr	nsaddr_list[0]		/* for backward compatibility */
 	u_short	id;			/* current message id */
 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
 	char	defdname[256];		/* default domain (deprecated) */
@@ -161,22 +129,31 @@
 		char	pad[52];	/* On an i386 this means 512b total. */
 		struct {
 			u_int16_t		nscount;
-			u_int16_t		nstimes[MAXNS];	/* ms. */
+#if 0
+			u_int16_t		nsmap[MAXNS];
+#else
+			u_int16_t		nstimes[MAXNS]; /* ms. */
+#endif
 			int			nssocks[MAXNS];
 			u_int16_t		nscount6;
 			u_int16_t		nsinit;
 			struct sockaddr_in6	*nsaddrs[MAXNS];
+#if 0
+#ifdef _LIBC
+			unsigned long long int	initstamp
+			  __attribute__((packed));
+#else
+			unsigned int		_initstamp[2];
+#endif
+#endif
 		} _ext;
 	} _u;
 };
 
 typedef struct __res_state *res_state;
 # undef __need_res_state
-#endif /* ! __res_state_defined */
+#endif
 
-#endif /* ! _RESOLV_H_ */
-
-
 #ifdef _RESOLV_H_
 /*
  * Revision information.  This is the release date in YYYYMMDD format.
@@ -186,8 +163,11 @@
  * is new enough to contain a certain feature.
  */
 
-/* #define	__RES	19991006 we don't have a new resolver yet */
+#if 0
+#define	__RES	19991006
+#else
 #define	__RES	19960801
+#endif
 
 /*
  * Resolver configuration file.
@@ -199,8 +179,12 @@
 #define _PATH_RESCONF        "/etc/resolv.conf"
 #endif
 
+struct res_sym {
+	int	number;		/* Identifying number, like T_MX */
+	char *	name;		/* Its symbolic name, like "MX" */
+	char *	humanname;	/* Its fun name, like "mail exchanger" */
+};
 
-
 /*
  * Resolver flags (used to be discrete per-module statics ints).
  */
@@ -211,6 +195,38 @@
 #define	RES_EXHAUSTIVE	0x00000001	/* always do all queries */
 
 /*
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT	0x00000001	/* address initialized */
+#define RES_DEBUG	0x00000002	/* print debug messages */
+#define RES_AAONLY	0x00000004	/* authoritative answers only (!IMPL)*/
+#define RES_USEVC	0x00000008	/* use virtual circuit */
+#define RES_PRIMARY	0x00000010	/* query primary server only (!IMPL) */
+#define RES_IGNTC	0x00000020	/* ignore trucation errors */
+#define RES_RECURSE	0x00000040	/* recursion desired */
+#define RES_DEFNAMES	0x00000080	/* use default domain name */
+#define RES_STAYOPEN	0x00000100	/* Keep TCP socket open */
+#define RES_DNSRCH	0x00000200	/* search up local domain tree */
+#define	RES_INSECURE1	0x00000400	/* type 1 security disabled */
+#define	RES_INSECURE2	0x00000800	/* type 2 security disabled */
+#define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */
+#define	RES_USE_INET6	0x00002000	/* use/map IPv6 in gethostbyname() */
+#define RES_ROTATE	0x00004000	/* rotate ns list after each query */
+#define	RES_NOCHECKNAME	0x00008000	/* do not check names for sanity. */
+#define	RES_KEEPTSIG	0x00010000	/* do not strip TSIG records */
+#define	RES_BLAST	0x00020000	/* blast all recursive servers */
+#if 0
+#define RES_USEBSTRING	0x00040000	/* IPv6 reverse lookup with byte
+					   strings */
+#define RES_NOIP6DOTINT	0x00080000	/* Do not use .ip6.int in IPv6
+					   reverse lookup */
+
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+#else
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH)
+#endif
+
+/*
  * Resolver "pfcode" values.  Used by dig.
  */
 #define RES_PRF_STATS	0x00000001
@@ -236,8 +252,6 @@
 __END_DECLS
 #define _res (*__res_state())
 
-#ifndef __BIND_NOSTATIC
-
 #define fp_nquery		__fp_nquery
 #define fp_query		__fp_query
 #define hostalias		__hostalias
@@ -252,40 +266,22 @@
 #define res_send		__res_send
 
 __BEGIN_DECLS
-void		fp_nquery __P((const u_char *, int, FILE *));
-void		fp_query __P((const u_char *, FILE *));
-const char *	hostalias __P((const char *));
-void		p_query __P((const u_char *));
-void		res_close __P((void));
-int		res_init __P((void));
-int		res_isourserver __P((const struct sockaddr_in *));
-int		res_mkquery __P((int, const char *, int, int, const u_char *,
-				 int, const u_char *, u_char *, int));
-int		res_query __P((const char *, int, int, u_char *, int));
-int		res_querydomain __P((const char *, const char *, int, int,
-				     u_char *, int));
-int		res_search __P((const char *, int, int, u_char *, int));
-int		res_send __P((const u_char *, int, u_char *, int));
+void		fp_nquery (const u_char *, int, FILE *) __THROW;
+void		fp_query (const u_char *, FILE *) __THROW;
+const char *	hostalias (const char *) __THROW;
+void		p_query (const u_char *) __THROW;
+void		res_close (void) __THROW;
+int		res_init (void) __THROW;
+int		res_isourserver (const struct sockaddr_in *) __THROW;
+int		res_mkquery (int, const char *, int, int, const u_char *,
+			     int, const u_char *, u_char *, int) __THROW;
+int		res_query (const char *, int, int, u_char *, int) __THROW;
+int		res_querydomain (const char *, const char *, int, int,
+				 u_char *, int) __THROW;
+int		res_search (const char *, int, int, u_char *, int) __THROW;
+int		res_send (const u_char *, int, u_char *, int) __THROW;
 __END_DECLS
 
-#endif /* !__BIND_NOSTATIC */
-
-
-#if !defined(SHARED_LIBBIND) || defined(LIB)
-/*
- * If libbind is a shared object (well, DLL anyway)
- * these externs break the linker when resolv.h is
- * included by a lib client (like named)
- * Make them go away if a client is including this
- *
- */
-extern const struct res_sym __p_key_syms[];
-extern const struct res_sym __p_cert_syms[];
-extern const struct res_sym __p_class_syms[];
-extern const struct res_sym __p_type_syms[];
-extern const struct res_sym __p_rcode_syms[];
-#endif /* SHARED_LIBBIND */
-
 #define b64_ntop		__b64_ntop
 #define b64_pton		__b64_pton
 #define dn_comp			__dn_comp
@@ -329,69 +325,82 @@
 #define sym_ntos		__sym_ntos
 #define sym_ston		__sym_ston
 __BEGIN_DECLS
-int		res_hnok __P((const char *));
-int		res_ownok __P((const char *));
-int		res_mailok __P((const char *));
-int		res_dnok __P((const char *));
-int		sym_ston __P((const struct res_sym *, const char *, int *));
-const char *	sym_ntos __P((const struct res_sym *, int, int *));
-const char *	sym_ntop __P((const struct res_sym *, int, int *));
-int		b64_ntop __P((u_char const *, size_t, char *, size_t));
-int		b64_pton __P((char const *, u_char *, size_t));
-int		loc_aton __P((const char *ascii, u_char *binary));
-const char *	loc_ntoa __P((const u_char *binary, char *ascii));
-int		dn_skipname __P((const u_char *, const u_char *));
-void		putlong __P((u_int32_t, u_char *));
-void		putshort __P((u_int16_t, u_char *));
-const char *	p_class __P((int));
-const char *	p_time __P((u_int32_t));
-const char *	p_type __P((int));
-const char *	p_rcode __P((int));
-const u_char *	p_cdnname __P((const u_char *, const u_char *, int, FILE *));
-const u_char *	p_cdname __P((const u_char *, const u_char *, FILE *));
-const u_char *	p_fqnname __P((const u_char *cp, const u_char *msg,
-			       int, char *, int));
-const u_char *	p_fqname __P((const u_char *, const u_char *, FILE *));
-const char *	p_option __P((u_long option));
-char *		p_secstodate __P((u_long));
-int		dn_count_labels __P((const char *));
-int		dn_comp __P((const char *, u_char *, int,
-			     u_char **, u_char **));
-int		dn_expand __P((const u_char *, const u_char *, const u_char *,
-			       char *, int));
-u_int		res_randomid __P((void));
-int		res_nameinquery __P((const char *, int, int,
-				     const u_char *, const u_char *));
-int		res_queriesmatch __P((const u_char *, const u_char *,
-				      const u_char *, const u_char *));
-const char *	p_section __P((int section, int opcode));
+int		res_hnok (const char *) __THROW;
+int		res_ownok (const char *) __THROW;
+int		res_mailok (const char *) __THROW;
+int		res_dnok (const char *) __THROW;
+int		sym_ston (const struct res_sym *, const char *, int *) __THROW;
+const char *	sym_ntos (const struct res_sym *, int, int *) __THROW;
+const char *	sym_ntop (const struct res_sym *, int, int *) __THROW;
+int		b64_ntop (u_char const *, size_t, char *, size_t) __THROW;
+int		b64_pton (char const *, u_char *, size_t) __THROW;
+int		loc_aton (const char *ascii, u_char *binary) __THROW;
+const char *	loc_ntoa (const u_char *binary, char *ascii) __THROW;
+int		dn_skipname (const u_char *, const u_char *) __THROW;
+void		putlong (u_int32_t, u_char *) __THROW;
+void		putshort (u_int16_t, u_char *) __THROW;
+const char *	p_class (int) __THROW;
+const char *	p_time (u_int32_t) __THROW;
+const char *	p_type (int) __THROW;
+const char *	p_rcode (int) __THROW;
+const u_char *	p_cdnname (const u_char *, const u_char *, int, FILE *)
+     __THROW;
+const u_char *	p_cdname (const u_char *, const u_char *, FILE *) __THROW;
+const u_char *	p_fqnname (const u_char *cp, const u_char *msg,
+			   int, char *, int) __THROW;
+const u_char *	p_fqname (const u_char *, const u_char *, FILE *) __THROW;
+const char *	p_option (u_long option) __THROW;
+char *		p_secstodate (u_long) __THROW;
+int		dn_count_labels (const char *) __THROW;
+int		dn_comp (const char *, u_char *, int, u_char **, u_char **)
+     __THROW;
+int		dn_expand (const u_char *, const u_char *, const u_char *,
+			   char *, int) __THROW;
+u_int		res_randomid (void) __THROW;
+int		res_nameinquery (const char *, int, int,
+				 const u_char *, const u_char *) __THROW;
+int		res_queriesmatch (const u_char *, const u_char *,
+				  const u_char *, const u_char *) __THROW;
+const char *	p_section (int section, int opcode) __THROW;
 /* Things involving a resolver context. */
-int		res_ninit __P((res_state));
-int		res_nisourserver __P((const res_state,
-				      const struct sockaddr_in *));
-void		fp_resstat __P((const res_state, FILE *));
-void		res_npquery __P((const res_state, const u_char *, int, FILE *));
-const char *	res_hostalias __P((const res_state, const char *,
-				   char *, size_t));
-int		res_nquery __P((res_state,
-				const char *, int, int, u_char *, int));
-int		res_nsearch __P((res_state, const char *, int,
-				 int, u_char *, int));
-int		res_nquerydomain __P((res_state,
-				      const char *, const char *, int, int,
-				      u_char *, int));
-int		res_nmkquery __P((res_state,
-				  int, const char *, int, int, const u_char *,
-				  int, const u_char *, u_char *, int));
-int		res_nsend __P((res_state, const u_char *, int, u_char *, int));
-void		res_nclose __P((res_state));
+int		res_ninit (res_state) __THROW;
+int		res_nisourserver (const res_state,
+				  const struct sockaddr_in *) __THROW;
+void		fp_resstat (const res_state, FILE *) __THROW;
+void		res_npquery (const res_state, const u_char *, int, FILE *)
+     __THROW;
+const char *	res_hostalias (const res_state, const char *, char *, size_t)
+     __THROW;
+int		res_nquery (res_state, const char *, int, int, u_char *, int)
+     __THROW;
+int		res_nsearch (res_state, const char *, int, int, u_char *, int)
+     __THROW;
+int		res_nquerydomain (res_state, const char *, const char *, int,
+				  int, u_char *, int) __THROW;
+int		res_nmkquery (res_state, int, const char *, int, int,
+			      const u_char *, int, const u_char *, u_char *,
+			      int) __THROW;
+int		res_nsend (res_state, const u_char *, int, u_char *, int)
+     __THROW;
+void		res_nclose (res_state) __THROW;
 __END_DECLS
 
-#endif /* _RESOLV_H_ */
+# if _LIBC
+#  ifdef __UCLIBC_HAS_THREADS__
+#   if defined __UCLIBC_HAS_THREADS_NATIVE__ \
+	       && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+#    undef _res
+#    ifndef NOT_IN_libc
+#     define __resp __libc_resp
+#    endif
+#    define _res (*__resp)
+extern __thread struct __res_state *__resp attribute_tls_model_ie;
+#    endif
+#   else
+#    undef _res
+extern struct __res_state _res;
+#   endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
+#  endif /* __UCLIBC_HAS_THREADS__ */
+# endif /* _LIBC */
 
-#if defined(__UCLIBC_HAS_THREADS_NATIVE__) && defined(IS_IN_libpthread)
-# include <tls.h>
-# undef _res
-# define _res (*__resp)
-extern __thread struct __res_state *__resp attribute_tls_model_ie;
-#endif
+#endif /* !_RESOLV_H_ */

Modified: branches/uClibc-nptl/libc/inet/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/inet/Makefile.in	2006-01-05 01:25:30 UTC (rev 13094)
+++ branches/uClibc-nptl/libc/inet/Makefile.in	2006-01-05 01:28:23 UTC (rev 13095)
@@ -24,7 +24,7 @@
 	res_query.o gethostbyaddr.o read_etc_hosts_r.o get_hosts_byname_r.o \
 	get_hosts_byaddr_r.o gethostbyname2.o getnameinfo.o gethostent.o \
 	gethostbyname_r.o gethostbyname2_r.o gethostbyaddr_r.o \
-	res_comp.o ns_name.o
+	res_comp.o ns_name.o res_state.o
 
 MSRC3:=	socketcalls.c
 MOBJ3:=	accept.o bind.o connect.o getpeername.o getsockname.o getsockopt.o \

Modified: branches/uClibc-nptl/libc/inet/resolv.c
===================================================================
--- branches/uClibc-nptl/libc/inet/resolv.c	2006-01-05 01:25:30 UTC (rev 13094)
+++ branches/uClibc-nptl/libc/inet/resolv.c	2006-01-05 01:28:23 UTC (rev 13095)
@@ -1136,44 +1136,31 @@
 
 
 #ifdef L_res_init
-#undef _res
-struct __res_state _res;
-
-struct __res_state * weak_const_function __res_state (void)
-{
-	return &_res;
-}
-
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-__thread struct __res_state *__resp = &_res;
-#endif
-
 int res_init(void)
 {
-	struct __res_state *rp = __res_state();
-
 	__close_nameservers();
 	__open_nameservers();
-	rp->retrans = RES_TIMEOUT;
-	rp->retry = 4;
-	rp->options = RES_INIT;
-	rp->id = (u_int) random();
-	rp->nsaddr.sin_addr.s_addr = INADDR_ANY;
-	rp->nsaddr.sin_family = AF_INET;
-	rp->nsaddr.sin_port = htons(NAMESERVER_PORT);
-	rp->ndots = 1;
-	/** rp->pfcode = 0; **/
-	rp->_vcsock = -1;
-	/** rp->_flags = 0; **/
-	/** rp->qhook = NULL; **/
-	/** rp->rhook = NULL; **/
-	/** rp->_u._ext.nsinit = 0; **/
 
 	BIGLOCK;
+	_res.retrans = RES_TIMEOUT;
+	_res.retry = 4;
+	_res.options = RES_INIT;
+	_res.id = (u_int) random();
+	_res.nsaddr.sin_addr.s_addr = INADDR_ANY;
+	_res.nsaddr.sin_family = AF_INET;
+	_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
+	_res.ndots = 1;
+	/** _res.pfcode = 0; **/
+	_res._vcsock = -1;
+	/** _res._flags = 0; **/
+	/** _res.qhook = NULL; **/
+	/** _res.rhook = NULL; **/
+	/** _res._u._ext.nsinit = 0; **/
+
 	if(__searchdomains) {
 		int i;
 		for(i=0; i<__searchdomains; i++) {
-			rp->dnsrch[i] = __searchdomain[i];
+			_res.dnsrch[i] = __searchdomain[i];
 		}
 	}
 
@@ -1182,13 +1169,13 @@
 		struct in_addr a;
 		for(i=0; i<__nameservers; i++) {
 			if (inet_aton(__nameserver[i], &a)) {
-				rp->nsaddr_list[i].sin_addr = a;
-				rp->nsaddr_list[i].sin_family = AF_INET;
-				rp->nsaddr_list[i].sin_port = htons(NAMESERVER_PORT);
+				_res.nsaddr_list[i].sin_addr = a;
+				_res.nsaddr_list[i].sin_family = AF_INET;
+				_res.nsaddr_list[i].sin_port = htons(NAMESERVER_PORT);
 			}
 		}
 	}
-	rp->nscount = __nameservers;
+	_res.nscount = __nameservers;
 	BIGUNLOCK;
 
 	return(0);
@@ -1199,9 +1186,55 @@
 	return;
 }
 
+/* This needs to be after the use of _res in res_init, above.  */
+#undef _res
+
+/* The resolver state for use by single-threaded programs.
+   This differs from plain `struct __res_state _res;' in that it doesn't
+   create a common definition, but a plain symbol that resides in .bss,
+   which can have an alias.  */
+struct __res_state _res __attribute__((section (".bss")));
+
+#if defined __UCLIBC_HAS_THREADS_NATIVE__ \
+	    && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+# undef __resp
+__thread struct __res_state *__resp = &_res; 
+/*
+ * FIXME: Add usage of hidden attribute for this when used in the shared
+ *        library. It currently crashes the linker when doing section
+ *        relocations.
+ */
+extern __thread struct __res_state *__libc_resp
+	__attribute__ ((alias ("__resp")));
 #endif
 
+#endif
 
+#ifdef L_res_state
+# if defined __UCLIBC_HAS_THREADS_NATIVE__ \
+	    && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+#  undef _res
+extern struct __res_state _res;
+
+/* When threaded, _res may be a per-thread variable.  */
+struct __res_state *
+weak_const_function
+__res_state (void)
+{
+	return &_res;
+}
+
+# else
+struct __res_state *
+__res_state (void)
+{
+	return __resp;
+}
+# endif
+hidden_def (__res_state)
+
+#endif
+
 #ifdef L_res_query
 
 #ifndef MIN




More information about the uClibc-cvs mailing list