From 412b7128e447d4c3ccd08e6a8115cd65c287dc28 Mon Sep 17 00:00:00 2001 From: ume Date: Thu, 28 Apr 2005 18:21:11 +0000 Subject: [PATCH] we don't need mutex lock to call _gethostbynis*(), anymore. --- lib/libc/net/getipnodebyname.3 | 9 --------- lib/libc/net/name6.c | 12 ++---------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/libc/net/getipnodebyname.3 b/lib/libc/net/getipnodebyname.3 index d9de5bf6fc2..dbef578c804 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 9df78428ec4..af69ddc604d 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 @@ -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; } -- 2.45.2