Subject: Re: re-reading /etc/resolv.conf on change
To: Manuel Bouyer <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 01/06/2004 09:19:20
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

On Jan 5, 2004, at 1:22 PM, Manuel Bouyer wrote:

>> I certainly have a great deal less objection to having gethostby*()
>> simply re-invoking res_init() internally if there's evidence available
>> that it needs to be called again than I do to having the resolver(3) 
>> do
>> this to itself.  Keeping a copy of the stat() structure and comparing
>> the st_mtime, st_dev, and st_ino values with current results every 
>> time
>> through just as nsdispatch() does seems like the right way to do this
>> and the best alternative would be to only redo the stat if at least 60
>> seconds had elapsed since the last time through.  Note there's no need
>> for using lstat() if you also compare the st_dev and st_ino values.
> Well, maybe we're going to have a solution accpetable by everyone then.
> Great !

Uh, I don't really see how this is a better solution.  resolv.conf is 
not a configuration file that gethostby*() should ever have to care 
about.  This is a violation of abstraction, pure and simple.  The 
underlying resolver code should be the one to re-initialize, if 

         -- Jason R. Thorpe <>

content-type: application/pgp-signature; x-mac-type=70674453;
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

Version: GnuPG v1.2.3 (Darwin)