[vlc-devel] [PATCH 08/18] Add missing getaddrinfo(), freeaddrinfo(), getnameinfo() and gai_strerror() for OS/2

KO Myung-Hun komh78 at gmail.com
Mon Oct 31 14:52:15 CET 2011



Rémi Denis-Courmont wrote:
>    Hello,
> 
> On Friday 21 October 2011, KO Myung-Hun wrote:
>> Rémi Denis-Courmont wrote:
>>> Le jeudi 20 octobre 2011 15:30:15 KO Myung-Hun, vous avez écrit :
>>>> ---
>>>>
>>>>  include/vlc_network.h     |   33 +++++
>>>>  src/network/getaddrinfo.c |  334
>>>>
>>>> +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 367
>>>> insertions(+), 0 deletions(-)
>>>
>>> This code seems to be ripped from some old crap that I wrote years ago.
>>> Unfortunately, that implementation of getaddrinfo() assumes that
>>> gethostbyname() and gethostbyaddr() are thread-safe. I believe this is
>>> the case on Winsock 2 / Windows 9x which this code was aimed at.
>>
>> I've confirmed that gethostbyname() and gethostbyaddr() uses static dat,
>> so they are not thread-safe.
> 
> getaddrinfo() and getnameinfo() are supposed to be thread-safe (as they are 
> specified by IETF and POSIX), and VLC assumes they are.
> 
> On Windows, I think gethostbyname() returns data from thread-local storage, so 
> it is thread-safe. But this is an exception.
> 

With some more tests, I could know that gethostbyname()on OS/2 also had
no effect on other threads even though it is using a static data. Maybe
it also uses TLS. Anyway, it is thread-safe on OS/2 as well.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.0.14
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1GHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr




More information about the vlc-devel mailing list