cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Detection of HAVE_GETADDRINFO_THREADSAFE in configure

From: Mason <mpeg.blue_at_free.fr>
Date: Thu, 22 Mar 2012 17:35:17 +0100

Yang Tse wrote:

> Do you have a system on which current git version detection of
> getaddrinfo() thread-safeness is wrong?

It doesn't work with lwip, where, in the typical configuration,

1) gethostbyname is not thread-safe
2) getaddrinfo is thread-safe (AFAICT)
3) netdb.h declares extern int h_errno; (as permitted by POSIX)

> Not theoretical thinking but actual run and facts.

I'm sorry you don't like to hear it, but checking for h_errno
to decide whether getaddrinfo is thread-safe is misguided.
Just because it works for glibc(*) doesn't change that fact.

(*) # define h_errno (*__h_errno_location ())

> In any case take in account that the most important thing about the
> test is to not provide false-positive results that would break libcurl
> operation. A false-negative detection is not a big issue given that
> libcurl will work nicely in that case.

( libcurl works with non thread-safe gethostbyname, but breaks
with non thread-safe getaddrinfo? )

The problem with h_errno is that it is tied to obsolete functions.
There is no connection whatsoever between h_errno and getaddrinfo.

I'll take a look at the getaddrinfo code in FreeBSD 4 to understand
why libcurl declare this implementation not thread-safe. Do you know,
off-hand?

> Obviously if you have a system on which detection is wrong, I'm
> interested in further details about that platform.

With the lwip port, libcurl picks gethostbyname. I suppose I can
live with it for now, but since gethostbyname has been zapped by
POSIX since 2008, it might disappear from lwip some day.

-- 
Regards.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-22