This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Improved DNS resolving for laptops?
- From: Nix <nix at esperi dot org dot uk>
- To: prj at po dot cwru dot edu (Paul Jarc)
- Cc: Petter Reinholdtsen <pere at hungry dot com>, libc-alpha at gnu dot org
- Date: Mon, 26 Jul 2004 06:23:41 +0100
- Subject: Re: Improved DNS resolving for laptops?
- References: <E1BnwjW-0004mX-VG@saruman.uio.no><m33c3iai7m.fsf@multivac.cwru.edu>
On Fri, 23 Jul 2004, Paul Jarc mused:
> Petter Reinholdtsen <pere@hungry.com> wrote:
>> The file /etc/resolv.conf is updated by the DHCP client, but the
>> programs do not re-read this file once they are started. This is a
>> problem for long-lived programs, and for my laptop this means it is
>> a problem for most programs (hibernate works. :).
>
> The djbdns client library's approach could be useful.
> <URL:http://cr.yp.to/djbdns/resolve.html>:
> * Most long-running programs don't notice changes in
> /etc/resolv.conf; they read /etc/resolv.conf when they start, and
> they don't reread it until they are restarted. In contrast, the
> djbdns procedure checks for changes every 10 minutes or 10000
> uses.
If you don't mind nonportability you could use fcntl (..., F_NOTIFY,...)
to find out the instant resolv.conf is changed. (In practice you'd
probably just set a flag on notification and consult the flag on next
DNS lookup: rereading resolv.conf more often than that is pointless.)
--
`The copyright file is for everyone. That we make it available in
plain-text, uncompressed form rather than in spinning, throbbing
OpenGL-rendered 3D text over a thumping dance music soundtrack is a
feature, not a bug.' --- Branden Robinson