summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/name6.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-04-06 15:36:34 +0000
committerume <ume@FreeBSD.org>2005-04-06 15:36:34 +0000
commitaa9bf872c4504b84b35eb3aa05e438afe02d8b81 (patch)
treecc2c65bb4388ac2a0fe13a74170056ed74db54a7 /lib/libc/net/name6.c
parent26cc55077b9d660a9361d4f60788692cded25f18 (diff)
downloadFreeBSD-src-aa9bf872c4504b84b35eb3aa05e438afe02d8b81.zip
FreeBSD-src-aa9bf872c4504b84b35eb3aa05e438afe02d8b81.tar.gz
- we are no longer shareing any resources to be locked between
getaddrinfo(3) and getipnodeby*(3). - use definitions in reentrant.h. - remove obsolete comment.
Diffstat (limited to 'lib/libc/net/name6.c')
-rw-r--r--lib/libc/net/name6.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 425ee25..f00ce26 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -87,16 +87,11 @@
* Atsushi Onoe <onoe@sm.sony.co.jp>
*/
-/*
- * TODO for thread safe
- * use mutex for _hostconf, _hostconf_init.
- * rewrite resolvers to be thread safe
- */
-
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "namespace.h"
+#include "reentrant.h"
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -121,7 +116,6 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <stdarg.h>
#include <nsswitch.h>
-#include <pthread.h>
#include <unistd.h>
#include "un-namespace.h"
@@ -238,17 +232,12 @@ static int _icmp_ghbyaddr(void *, void *, va_list);
#endif /* ICMPNL */
/*
- * XXX: Many dependencies are not thread-safe. So, we share lock between
- * getaddrinfo() and getipnodeby*(). Still, we cannot use
- * getaddrinfo() and getipnodeby*() in conjunction with other
- * functions which call them.
+ * XXX: Many dependencies are not thread-safe. Still, we cannot use
+ * getipnodeby*() in conjunction with other functions which call them.
*/
-#include "libc_private.h"
-extern pthread_mutex_t __getaddrinfo_thread_lock;
-#define THREAD_LOCK() \
- if (__isthreaded) _pthread_mutex_lock(&__getaddrinfo_thread_lock);
-#define THREAD_UNLOCK() \
- if (__isthreaded) _pthread_mutex_unlock(&__getaddrinfo_thread_lock);
+static mutex_t _getipnodeby_thread_lock = MUTEX_INITIALIZER;
+#define THREAD_LOCK() mutex_lock(&_getipnodeby_thread_lock);
+#define THREAD_UNLOCK() mutex_unlock(&_getipnodeby_thread_lock);
/* Host lookup order if nsswitch.conf is broken or nonexistant */
static const ns_src default_src[] = {
OpenPOWER on IntegriCloud