[CFR] reflect resolv.conf update to running application
Brooks Davis
brooks at one-eyed-alien.net
Mon Aug 22 15:16:46 GMT 2005
On Sun, Aug 21, 2005 at 07:17:06PM +0200, Poul-Henning Kamp wrote:
> In message <20050821115454.55441a64 at Magellan.Leidinger.net>, Alexander Leidinger writes:
> >On Sun, 21 Aug 2005 00:37:56 +0100 (BST)
> >Robert Watson <rwatson at freebsd.org> wrote:
> >
> >> (2) By reading the configuration file more frequently and more quickly
> >> after a change, we increase the chances of a race condition in which
> >> the resolve reads a partially written resolv.conf file during an
> >> update. Does this happen in practice? I've always been very leery of
> >> re-reading configuration files automatically based on a time-stamp, as
> >> updates to files are not atomic at all.
> >
> >Can kqueue be used instead of polling?
>
> Programs writing resolv.conf should just this the right way:
>
> 1. Write new contents to temorary file.
> 2. Rename temporary file to resolv.conf.
The one issue with this is that we sortof support a read-only /etc with
resolv.conf as a symlink to somewhere else. Short of following the
symlink by hand in dhclient-script, you have to do the current cat
trick. It should cause the file to be replaced in one write() though so
I don't think the race exists (unless someone comes up with a dhclient
config that generates a resolv.conf larger then 512-bytes).
-- Brooks
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20050822/74f2887e/attachment.bin
More information about the freebsd-arch
mailing list