Subject: Re: re-reading /etc/resolv.conf on change
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-userlevel
Date: 01/06/2004 15:49:51
--Apple-Mail-17-636511616
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Jan 6, 2004, at 3:38 PM, Greg A. Woods wrote:
> In fact it's res_init() itself that has a well documented and well
> known
> public API and it is the semantics of that routine that I've been
> arguing to protect all along, in case you hadn't realized. What I've
> been trying to show is that res_init() _IS_ the defined way that the
> lowest layer resolver routines are to be initialized and that it's the
> responsibility of the gethost*() layer directly above to determine when
> to call res_init().
Your argument is bogus, of course, because of the implicit res_init()
call made by all of the other res_*() functions. If res_init() were
truly what you say it is for, then all of the functions that need to
use the resolver would perform this check and call before using any of
the other res_*() functions. However, res_init() is currently used
*purely* as an internal function call, and I dare say that there are
very few apps out there (save maybe some that are specifically designed
to invoke the resolver directly) that use it directly.
But, I'm willing to compromise (consider it a late Christmas present).
Here's a new proposal:
Add a new function:
int
res_reinit(void)
{
if ((_res.options & RES_INIT) == 0 && res_init() == -1)
return (-1);
return (0);
}
...and replace all of the implicit calls to res_init() that include
checks for RES_INIT with a call to res_reinit().
Then we can centralize the handling of resolv.conf into this new
res_reinit() function. Your precious res_init() function remains
unchanged.
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--Apple-Mail-17-636511616
content-type: application/pgp-signature; x-mac-type=70674453;
name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
iD8DBQE/+0miOpVKkaBm8XkRAvObAJ4jc3HArQR7I4VsiVieuwJsZ9qXnACfXIJS
XzR3DEkO52C74UgXDI46NCE=
=/kzg
-----END PGP SIGNATURE-----
--Apple-Mail-17-636511616--