Subject: Re: gethostbyname_r() ?
To: oliver gould <>
From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <>
List: tech-net
Date: 07/18/2006 15:01:44
>>>>> On Mon, 17 Jul 2006 16:03:02 -0400, 
>>>>> oliver gould <> said:

>> > Well last time I checked /usr/src/regress/lib/libpthread/resolv was
>> > working fine.
>> Cool!  The comments in src/lib/libc/net/getaddrinfo.c don't seem so sure
>> that the implementation is thread-safe.

> Nor the manpage for getaddrinfo(3):
>   BUGS
>      The implementation of getaddrinfo() is not thread-safe.

The major reason why getaddrinfo() was regarded as not thread-safe at
that time was:

- a (few) static variables used in getaddrinfo.c (this varied among
  BSD variants.  I don't remember whether it was the case for NetBSD)
- because the underlying libraries (res_xxx and/or getservbyname())
  were not thread safe

But at least recent current code does not seem to have any of these
problems, and the implementation now looks like thread safe.

(The source code comment and the man page should probably be updated)

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.