Re: Testers wanted: reentrant resolver

From: Brian F. Feldman <green_at_FreeBSD.org>
Date: Fri, 20 Feb 2004 19:48:31 -0500
Daniel Eischen <eischen_at_vigrid.com> wrote:
> On Fri, 20 Feb 2004, Brian F. Feldman wrote:
> 
> > Daniel Eischen <eischen_at_vigrid.com> wrote:
> > > Ugh, can you put h_errno inside the per-thread res stuff.
> > > We shouldn't need to have to add special hooks in the
> > > threads libraries for this.
> > 
> > Please explain what you're saying further.  On correctly-threaded operating 
> > systems, h_errno is just like errno -- and I made it act EXACTLY as errno 
> > acts, and is per-thread storage for everything but the first thread.  It's 
> > absolutely necessary if we want to return the correct errors; even if 
> > everything else in the world is totally reentrant, if h_errno isn't, the 
> > wrong errors can be returned!  What "special hooks" do you mean?  There's no 
> > way to not change probably hundreds of lines of code without actually doing 
> > the work to make h_errno thread-safe.  It's the only proper thing to do.
> 
> The implementation of __h_errno() need not depend on something
> special stuffed in struct pthread.  Use thread-local storage
> (pthread_getspecific()) like you did for the res_send_private
> stuff.  Especially since these interfaces should be deprecated
> in favor of what looks to be BIND 8.2.2 interfaces (according
> to the Solaris man pages).

Other APIs have the option of failing.  __h_errno() does not have the option 
of failing, so what do I do if pthread_key_create() fails?  Also, if 
malloc() fails each time pthread_getspecific() returns NULL for the thread?

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green_at_FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\
Received on Fri Feb 20 2004 - 15:48:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:44 UTC