aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostbyname.3
diff options
context:
space:
mode:
authorBrian Feldman <green@FreeBSD.org>2004-02-25 21:03:46 +0000
committerBrian Feldman <green@FreeBSD.org>2004-02-25 21:03:46 +0000
commit33dee819339974eaf7dbf69068001771cbdcd548 (patch)
tree9638e0bc7f96f243bb180d862cc5f1093a53454c /lib/libc/net/gethostbyname.3
parent59b4f7f45e04e06c04c5928e6750e43c2562a6ff (diff)
downloadsrc-33dee819339974eaf7dbf69068001771cbdcd548.tar.gz
src-33dee819339974eaf7dbf69068001771cbdcd548.zip
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.
Notes
Notes: svn path=/head/; revision=126243
Diffstat (limited to 'lib/libc/net/gethostbyname.3')
-rw-r--r--lib/libc/net/gethostbyname.36
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/net/gethostbyname.3 b/lib/libc/net/gethostbyname.3
index e703e3221275..a4486bc6e9f8 100644
--- a/lib/libc/net/gethostbyname.3
+++ b/lib/libc/net/gethostbyname.3
@@ -369,6 +369,12 @@ version 4.9.4.
These functions use static data storage;
if the data is needed for future use, it should be
copied before any subsequent calls overwrite it.
+Threaded applications should never use them, as they will also conflict
+with the
+.Xr getaddrinfo 3
+and
+.Xr getipnodebyname 3
+families of functions (which should be used instead).
Only the Internet
address format is currently understood.
.Pp