[CFR] reflect resolv.conf update to running application

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Aug 21 17:17:10 GMT 2005


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.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list