Skip to Content.
Sympa Menu

freetds - Re: [freetds] threadsafe

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] threadsafe
  • Date: Wed, 23 Aug 2006 21:59:05 +0200

Il giorno mer, 23/08/2006 alle 12.03 +0100, Patrick Welche ha scritto:
> On Tue, Aug 22, 2006 at 08:23:00PM +0200, Frediano Ziglio wrote:
> > Il giorno mar, 22/08/2006 alle 18.29 +0100, Patrick Welche ha scritto:
> > > It seems that --disable-threadsafe has no effect:
> > >
> > > threadsafe.c:279:2: error: #error gethostbyname_r style unknown
> > >
> > > i.e., threadsafe.c is compiled, and the _r functions tried.
> > >
> > > It may be that defining NETDB_REENTRANT if --disable-threadsafe may be
> > > sufficient to fix it - I haven't tried.
> > >
> >
> > yes, actually --disable-threadsafe has the only effect to not define
> > _REENTRANT and _THREAD_SAFE, perhaps defining NETDB_REENTRANT would
> > help. Which platform are you using?
> >
> > >
> > > .. I was wondering also whether getaddrinfo / getnameinfo would be worth
> > > trying too..
> > >
> >
> > Look at threadsafe.c you will find getaddrinfo.
>
> Yes but :-)
>
> I looked at threadsafe.c, and the problem function which is
> tds_gethostbyname_r. The function will call gethostbyname,
> getipnodebyname or gethostbyname_r. So, if your gethostbyname is
> not reentrant, and you don't have getipnodebyname or gethostbyname_r,
> compilation will fail even if you --disable-threadsafe. If you define
> NETDB_REENTRANT, the non-threadsafe gethostbyname will be called, so
> this is a work around. tds_gethostbyname_r does not try getaddrinfo.
>
> Cheers,
>
> Patrick

Now I understand. You suggested to use getaddrinfo instead of
gethostbyname_r if not available. I though you means why we test for
getaddrinfo in configure... I think that one of the reasons why I didn't
use getaddrinfo is that on *BSD (where it is helpful to use it) this
function is not thread-safe...
I think you are right, if one don't want thread safety we shouldn't
check for thread-safe functions although nowadays threads are very
common so I don't suggest the use of this flag.

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page