gethostbyname() and resolv.conf updates

Stephen Gallagher sgallagh at
Fri Jun 18 13:56:01 UTC 2010

On 06/18/2010 09:43 AM, Colin Walters wrote:
> On Fri, Jun 18, 2010 at 8:23 AM, Stephen Gallagher<sgallagh at>  wrote:
>> This is the entire purpose of the res_init() function in glibc. If your
>> application needs to be aware of a change in resolv.conf, you should be
>> monitoring it with inotify and calling res_init() anytime the file is
>> changed.
> That's awful.  Really, really awful.  Do you have any idea how many
> things would need to be patched to do that?  Other operating systems
> handle this just fine.  Asking every component to use inotify and
> res_init() because the glibc maintainers apparently think a simple
> stat() on a sure-to-be-in-kernel cache inode is too expensive...well,
> think about it.

Sorry, my reply was more directed against the assertion that NSCD should 
be mandatory to solve this without changes to glibc. I agree that it 
would be ideal for gethostbyname() to internally perform a res_init() 
when appropriate.

Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.

More information about the devel mailing list