Subject: Re: re-reading /etc/resolv.conf on change
To: Jason Thorpe <>
From: Manuel Bouyer <>
List: tech-userlevel
Date: 12/31/2003 16:10:19
On Tue, Dec 30, 2003 at 01:07:17PM -0800, Jason Thorpe wrote:
> On Dec 28, 2003, at 8:54 AM, Manuel Bouyer wrote:
> >I found this really annoying on my laptop (I have to restart mozilla 
> >every time
> >I get online), so I came with the attached hack. Linux is probably 
> >already
> >rereading /etc/resolv.conf on change, because I didn't have this issue 
> >when
> >I used the linux netscape4 binary.
> I fully support this change (there is an open PR on it, as well).  
> FWIW, it's not annoying just on laptops.  It's also very annoying on 
> server appliances.  Pretty much anything where you have long-running 
> network-aware applications.
> Comments on the patch itself:
> 	* I don't think kqueue is necessarily what you want to use.  I
> 	  think you want to use a combination of lstat() (to detect if
> 	  a symlink changes) and fstat() (to detect if the destination
> 	  of the symlink changes without the symlink itself changing).

This is not enouth. You don't catch rename or delete events this way.
For this you need stat() (or close/reopen the file eac h time), but it's much
more expensive.

> 	  Then unresolved is what to do if the file doesn't exist.
> 	* Library routines should not spit warnings/errors out to stderr
> 	  or stdout.  Please remove the warn(), err(), etc. calls that you
> 	  added.

OK, would a message to syslog be acceptable ?

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