[distcc] gethostbyname()

Dimitri Papadopoulos-Orfanos papadopo at www.NOSPAM.fr
Tue Oct 12 10:32:25 GMT 2004


Hi,

Function gethostbyname() is a known POSIX flaw. It used not to be 
possible to perform non-blocking calls to the resolver.

Martin lists the following options:


0- just suffer; or rather tell people to fix their nameserver or turn
down the timeout in resolv.conf

Martin thinks this is the best option.


1- use resolv.h, which can take a timeout but might be nonportable

That's a bad idea, header resolv.h is part of BIND which covers only 
DNS. Hosts are not always listed in a DNS server. They may be listed in 
NIS or LDAP servers. NIS is sometimes used where I work for example.


2- use an asynchronous DNS library; should be easy but adds another
dependency and/or thing that must be bundled

Is there such a library? One that also covers NIS servers and such? On 
the other hand there are proposals for an asynchronous lookup framework:
	http://people.redhat.com/drepper/asynchnl.pdf
Why not use getaddrinfo_a() on platforms where it's available? I'm 
pretty sure there are some autoconf macros that cover this function.


3- run lookups in a separate process, which can be killed off (a bit gross)

Note that mozilla uses lookups in a separate process, so that option may 
be gross but it can't be that bad.

--
Dimitri Papadopoulos



More information about the distcc mailing list