Subject: Re: nsswitch.conf and irs.conf
To: None <itojun@iijlab.net>
From: Noriyuki Soda <soda@sra.co.jp>
List: tech-net
Date: 01/21/2003 14:17:27
>>>>> On Tue, 21 Jan 2003 10:55:02 +0900, itojun@iijlab.net said:

>> 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.

> 	what is wrong with that?

Because: 

- Using thread specific data has certain overhead on both
  time and space.

- Using thread specific data makes code maintainability worse.
  (You already saw I mistread it.)
  It is nearly always better to pass per-thread data explicitly
  in a function argument, rather than implicitly by using a
  thread specific data, for code maintenance POV.
  There are cases that one has to use thread specific data,
  when one cannot change an intermediate function interface.
  But in this IRS case, the thread specific data is not really
  needed, because the IRS library can choose any function interface
  in its internal implemetataion.

- It may make problems about reusability of our code.
  If we make gethostbyname(3) thread safe, some of our code
  may depend on the fact (by intentionally or accidentally).
  Because such thread safe assumption of gethostbyname(3) isn't true
  on other platforms, the code which depends on the assumption becomes
  non portable to other platfroms.
  So, if we make gethostbyname(3) thread safe, reusability
  of our code may become worse.

> 	to me you look like just trying to block other's work.

Well, I don't think it is bad thing to review code before integrating
our code base. Or, do you think we should not review?
--
soda