summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2005-04-28 18:21:11 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2005-04-28 18:21:11 +0000
commitb8ab0f450604115bceeea92c7bbbf819b1642dfd (patch)
tree62c85b6f810e9398de78a24f7b242b5d436ad7d3 /lib
parentaa2f4ec72aa5a0edf89218a157cc36087316a2c5 (diff)
Notes
Diffstat (limited to 'lib')
-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 d9de5bf6fc24..dbef578c8040 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 9df78428ec4f..af69ddc604df 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;
}