Subject: Re: re-reading /etc/resolv.conf on change
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
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
fstat(PATH_RESCONF)
- the back-end always calls res_init(), and res_init() always reload the
config.
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 <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--