From owner-cvs-all@FreeBSD.ORG Wed Feb 25 13:03:46 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C961916A4CE; Wed, 25 Feb 2004 13:03:46 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACEBB43D2F; Wed, 25 Feb 2004 13:03:46 -0800 (PST) (envelope-from green@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i1PL3kGe030017; Wed, 25 Feb 2004 13:03:46 -0800 (PST) (envelope-from green@repoman.freebsd.org) Received: (from green@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i1PL3kkh030016; Wed, 25 Feb 2004 13:03:46 -0800 (PST) (envelope-from green) Message-Id: <200402252103.i1PL3kkh030016@repoman.freebsd.org> From: Brian Feldman Date: Wed, 25 Feb 2004 13:03:46 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/include netdb.h resolv.h src/lib/libc/include reentrant.h src/lib/libc/net getaddrinfo.3 getaddrinfo.c gethostbydns.c gethostbyname.3 gethostbynis.c getipnodebyname.3 herror.c name6.c res_init.c res_send.c res_send_private.h ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 21:03:47 -0000 green 2004/02/25 13:03:46 PST FreeBSD src repository Modified files: include netdb.h resolv.h lib/libc/include reentrant.h lib/libc/net getaddrinfo.3 getaddrinfo.c gethostbydns.c gethostbyname.3 gethostbynis.c getipnodebyname.3 herror.c name6.c res_init.c res_send.c resolver.3 Added files: lib/libc/net res_send_private.h Log: Make the resolver(3) and many associated interfaces much more reentrant. The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now with what should be totally reentrant, and h_errno values will now be preserved correctly, but this does not affect interfaces such as gethostbyname(3) which are still mostly non-reentrant. In all of these relevant functions, the thread-safety has been pushed down as far as it seems possible right now. This means that operations that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected still under global locks that getaddrinfo(3) defines, but where possible the locking is greatly reduced. The most noticeable improvement is that multiple DNS lookups can now be run at the same time, and this shows major improvement in performance of DNS-lookup threaded programs, and solves the "Mozilla tab serialization" problem. No single-threaded applications need to be recompiled. Multi-threaded applications that reference "_res" to change resolver(3) options will need to be recompiled, and ones which reference "h_errno" will also if they desire the correct h_errno values. If the applications already understood that _res and h_errno were not thread-safe and had their own locking, they will see no performance improvement but will not actually break in any way. Please note that when NSS modules are used, or when nsdispatch(3) defaults to adding any lookups of its own to the individual libc _nsdispatch() calls, those MUST be reentrant as well. Revision Changes Path 1.32 +3 -2 src/include/netdb.h 1.24 +6 -1 src/include/resolv.h 1.3 +3 -0 src/lib/libc/include/reentrant.h 1.24 +6 -2 src/lib/libc/net/getaddrinfo.3 1.49 +15 -12 src/lib/libc/net/getaddrinfo.c 1.44 +0 -1 src/lib/libc/net/gethostbydns.c 1.31 +6 -0 src/lib/libc/net/gethostbyname.3 1.17 +0 -2 src/lib/libc/net/gethostbynis.c 1.11 +9 -2 src/lib/libc/net/getipnodebyname.3 1.12 +4 -3 src/lib/libc/net/herror.c 1.35 +14 -13 src/lib/libc/net/name6.c 1.32 +119 -9 src/lib/libc/net/res_init.c 1.47 +11 -8 src/lib/libc/net/res_send.c 1.1 +82 -0 src/lib/libc/net/res_send_private.h (new) 1.26 +11 -0 src/lib/libc/net/resolver.3