Subject: Re: re-reading /etc/resolv.conf on change
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: Manuel Bouyer <>
List: tech-userlevel
Date: 01/05/2004 22:22:02
On Sun, Jan 04, 2004 at 06:51:24PM -0500, Greg A. Woods wrote:
> [...]
> However res_init() is indeed already called automatically on first
> invocation of the gethostby*() APIs and so res_init() is "hidden" so
> some extent by the latter and from that perspective you could say
> they're at different levels.
> 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 !

I'll come with a new patch when I have some time.

> > Really ? So they are really confused by solaris I guess.
> No doubt!  ;-)
> > All applications want this. Or at last I want it in all applications.
> I can understand why you want it, but I'm not so sure all applications
> really want automatic config-file reloading, even if the config file in
> question is one that's normally only used by "standard" library routines.

Well, it's not really the application's config file, but the one from
the library. And gethostby* already reread /etc/nsswitch.conf automatically :)

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