Subject: Re: re-reading /etc/resolv.conf on change
To: Jason Thorpe <>
From: Manuel Bouyer <>
List: tech-userlevel
Date: 01/06/2004 20:50:40
On Tue, Jan 06, 2004 at 11:36:53AM -0800, Jason Thorpe wrote:
> gethostby*() calls a dispatch routine to "backend" functions that 
> implement the various methods.
> The questions are:
> 	* How does gethostby*()'s DNS back-end know to re-read resolv.conf?
> 	  I.e. how does it get the timestamp information about the 
> 	  resolv.conf
> 	  file for comparisons?

I can see 3 ways of doing it:
- the back-end fstat() PATH_RESCONF and call res_init() when needed
- the back-end always calls res_init(), and res_init() does the
- the back-end always calls res_init(), and res_init() always reload the

I don't know the implications on performances of the last proposal,
but it may be small enouth to be acceptable.
I'll run some bechmarks, but I don't have to do it right now.

Manuel Bouyer <>
     NetBSD: 24 ans d'experience feront toujours la difference