summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-04-28 18:21:11 +0000
committerume <ume@FreeBSD.org>2005-04-28 18:21:11 +0000
commit412b7128e447d4c3ccd08e6a8115cd65c287dc28 (patch)
tree62c85b6f810e9398de78a24f7b242b5d436ad7d3
parentb384ad94d82a804ef207d245503de1f7d151c499 (diff)
downloadFreeBSD-src-412b7128e447d4c3ccd08e6a8115cd65c287dc28.zip
FreeBSD-src-412b7128e447d4c3ccd08e6a8115cd65c287dc28.tar.gz
we don't need mutex lock to call _gethostbynis*(), anymore.
-rw-r--r--lib/libc/net/getipnodebyname.39
-rw-r--r--lib/libc/net/name6.c12
2 files changed, 2 insertions, 19 deletions
diff --git a/lib/libc/net/getipnodebyname.3 b/lib/libc/net/getipnodebyname.3
index d9de5bf..dbef578 100644
--- a/lib/libc/net/getipnodebyname.3
+++ b/lib/libc/net/getipnodebyname.3
@@ -461,15 +461,6 @@ are documented in
The implementation first appeared in KAME advanced networking kit.
.\"
.Sh BUGS
-Although the current implementation is otherwise thread-safe, using
-it in conjunction with
-.Fn gethostby*
-(see
-.Xr gethostbyname 3 )
-or
-.Xr yp 8
-breaks the thread-safety of both.
-.Pp
The
.Fn getipnodebyname
and
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 9df7842..af69ddc 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -91,7 +91,7 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
-#if defined(YP) || defined(ICMPNL)
+#ifdef ICMPNL
#include "reentrant.h"
#endif
#include <sys/param.h>
@@ -234,11 +234,7 @@ static void _dns_ehent(void) __unused;
static int _icmp_ghbyaddr(void *, void *, va_list);
#endif /* ICMPNL */
-/*
- * XXX: Many dependencies are not thread-safe. Still, we cannot use
- * getipnodeby*() in conjunction with other functions which call them.
- */
-#if defined(YP) || defined(ICMPNL)
+#ifdef ICMPNL
static mutex_t _getipnodeby_thread_lock = MUTEX_INITIALIZER;
#define THREAD_LOCK() mutex_lock(&_getipnodeby_thread_lock);
#define THREAD_UNLOCK() mutex_unlock(&_getipnodeby_thread_lock);
@@ -1387,11 +1383,9 @@ _nis_ghbyname(void *rval, void *cb_data, va_list ap)
af = va_arg(ap, int);
errp = va_arg(ap, int *);
- THREAD_LOCK();
hp = _gethostbynisname(name, af);
if (hp != NULL)
hp = _hpcopy(hp, errp);
- THREAD_UNLOCK();
*(struct hostent **)rval = hp;
return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
@@ -1410,11 +1404,9 @@ _nis_ghbyaddr(void *rval, void *cb_data, va_list ap)
addrlen = va_arg(ap, int);
af = va_arg(ap, int);
- THREAD_LOCK();
hp = _gethostbynisaddr(addr, addrlen, af);
if (hp != NULL)
hp = _hpcopy(hp, errp);
- THREAD_UNLOCK();
*(struct hostent **)rval = hp;
return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
}
OpenPOWER on IntegriCloud