Subject: Re: nsswitch.conf and irs.conf
To: None <>
From: Noriyuki Soda <>
List: tech-net
Date: 01/20/2003 19:06:46
>>>>> On Mon, 20 Jan 2003 09:33:21 +0900, said:

>	do we have such manpower to maintain separate resolver library from
>	BIND8?  this is my fundamental question.

I think we should switch to the BIND8 resolver library.
But what we are now talking about is not a resolver library, but
a name service library built upon the resolver library, isn't it?

>> BTW, I think the way to implement the thread safeness in the IRS library
>> is somewhat lame. gethostbyname(3) should be implemented by a call to
>> gethostbyname_r(3), rather than vice versa as the IRS currently
>> does. Using a thread local strage may make sesne, if you cannot modify

> 	which source code are you looking at?  i guess you are looking at
> 	something wrong.  if you look at BIND8 src/lib/irs/gethostent.c,
> 		gethostbyname() calls gethostbyname_p()
> 		gethostbyname_p() calls gethostbyname2_p()
> 		gethostbyname2_p() does the real thing
> 	so i see no problem here.

For example, please look at either
	BIND8 src/lib/irs/gethostent_r.c
	BIND9 lib/bind/irs/gethostent_r.c.
In this file, gethostbyname_r(3) calls gethostbyname(3) internally.
In other words, what the IRS did is to make gethostbyname(3) MT safe
to implement gethostbyname_r(3). :-O
This is what I think wasteful.

It seems the IRS implementation heavily depends on the thread specific 
data feature of the pthread library. But in theory, a name service
library doesn't have to use the TSD feature in its implemetation
(and actually glibc nsswitch implementation doesn't use it).
I think it is better to avoid the use of the thread specific data,
because of efficiency and source code readablity reason.