Subject: Re: gethostbyname_r() ?
To: None <tech-net@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-net
Date: 07/18/2006 15:53:31
In article <ygek66bque9.wl%ume@mahoroba.org>,
Hajimu UMEMOTO  <ume@mahoroba.org> wrote:
>Hi,
>
>>>> Tue, 18 Jul 2006 15:01:44 +0900,
>>>> JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp> said:
>
>jinmei> The major reason why getaddrinfo() was regarded as not thread-safe at
>jinmei> that time was:
>
>jinmei> - a (few) static variables used in getaddrinfo.c (this varied among
>jinmei>   BSD variants.  I don't remember whether it was the case for NetBSD)
>jinmei> - because the underlying libraries (res_xxx and/or getservbyname())
>jinmei>   were not thread safe
>
>jinmei> But at least recent current code does not seem to have any of these
>jinmei> problems, and the implementation now looks like thread safe.
>
>I think getservbyname(3) is still not thread-safe.  This issue will be
>fixed by:
>
>	- _servent_data should be allocated per thread, or
>	- getaddrinfo(3) should use getservbyname_r(3).
>
I made it use getservbyname_r(3) for now.

christos