[vlc-devel] [PATCH 08/18] Add missing getaddrinfo(), freeaddrinfo(), getnameinfo() and gai_strerror() for OS/2
Rémi Denis-Courmont
remi at remlab.net
Sat Oct 22 18:17:20 CEST 2011
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.
> > I do not know if this really works correctly on OS/2. It might be a bit
> > more complicated than that...
>
> Fortunately, this works correctly on OS/2. So I'll submit a new patch to
> fix this after this patch is merged.
>
> Possible ?
I am not sure what you mean. But I don't really like to clutter the generic
network code with this. If you have an OS/2-specific solution, it belongs in
src/os2/ IMHO.
--
Rémi Denis-Courmont
http://www.remlab.info
More information about the vlc-devel
mailing list