Subject: Re: gethostbyname_r() ?
To: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <>
From: Hajimu UMEMOTO <>
List: tech-net
Date: 07/18/2006 15:50:06

>>> Tue, 18 Jul 2006 15:01:44 +0900,
>>> JINMEI Tatuya <> 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).


Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan  ume@{,jp.}