Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2002 09:28:40 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Jev <jev@ecad.org>, freebsd-hackers@freebsd.org
Subject:   Re: gethostbyname_r() fbsd equiv?
Message-ID:  <3D821238.38BAF06D@mindspring.com>
References:  <20020913145830.GB41842@ecad.org> <3D820700.DB53B0F9@mindspring.com> <3D820BE9.7E69C57E@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert wrote:
> Terry Lambert wrote:
> > Jev wrote:
> > > Im trying to build some software on freebsd, which wants to use
> > > the thread safe gethostbyname_r(). Despite having very bad C skills im
> > > going to attempt to patch it. What would I use in place of
> > > gethostbyname_r() on freebsd?
> >
> > Do you need the real gethostbyname_r(), or do you need the
> > bastardized Linux version?  The real version has the prototype:
> 
> In case anyone cares, it's the pre-knowing the buffer size, with
> no ability to return partial results and at the same time indicate
> the buffer is to short, and the h_errno pointer and the return
> of the hostent structure whose address was passed, rather than an
> int, that I object to in the Linux interface.
> 
> And yes, I know it matches the Solaris interface.

Cool.  In current versions of AIX and HP/UX, the _r versions
of the interfaces don't exist, and the calls use thread local
storage, as I had suggested previously for some of the other
_r versions of itnerfaces in FreeBSD to make them thread
reentrant.

There's actually a crt0 modification that's needed to make this
work in that case; it requires passing the address of the arg
pointer down to the init constructors, so that it's available
(right now, they take void arguments).

This would also let us create a static "libdlopen", as a side
effect, if anyone is interested (you would lose the program
symbols from the ligage set, but that's not really a big loss,
compared to what you get from having it, IMO).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D821238.38BAF06D>