Subject: Re: re-reading /etc/resolv.conf on change
To: Bruce J.A. Nourish <email@example.com>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 01/01/2004 15:12:39
[ On Wednesday, December 31, 2003 at 16:24:13 (-0700), Bruce J.A. Nourish wrote: ]
> Subject: Re: re-reading /etc/resolv.conf on change
> On Wed, Dec 31, 2003 at 05:19:18PM -0500, Perry E. Metzger wrote:
> > Then, if you alter resolv.conf, run a program announcing "I've altered
> > resolv.conf" to the world and all will be well! :)
> This touches on a general problem that exists in all the free Unices:
> user <-> kernel communication. There is simply no general, event based
> infrastructure to communicate changes in the system state.
Huh? /etc/resolv.conf edits are not kernel related. There's no kernel
state change to communicate.
This is only a userland to userland issue. SIGHUP is your friend.
> "The network addresses have all changed," and all the other messages
> you mention are in the same class as "someone just plugged in a PCMCIA
> card/scanner/whatever," or "we just found a wireless LAN that we can
Even networrk addresses are not really kernel things. Well they are as
implemented in *BSD kernels but conceptually they're very similar to
filenames and/or file content (and in some more advanced systems that's
exactly what they are).
If I'm not mistaken there's always still a userland process that sets or
changes those addresses and conceptually that's no different than a
userland program editing resolv.conf or any other configuration file.
Even so the kernel can easily identify processes that have certain
devices open and send them a SIGHUP itself if it thinks they'll treat it
as an indication that something in their world has changed. An ioctl()
on such a device could be used to register one's desire to have a signal
sent when that device's status changes, though the concept of using
SIGHUP to notify of device state changes is about as standard as you can
get already and has been used for this same purpose practically since
the beginning of the Unix Epoch.
Why all this desire to invent something new when there's already a
perfectly viable, adequate, well known, widely used, and well proven
mechanism in place? Has the NIH syndrome taken over even more people
recently? Is it contagious or something?
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <email@example.com>
Planix, Inc. <firstname.lastname@example.org> Secrets of the Weird <email@example.com>