apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [PATCH] Add reentrant gethostbyname call
Date Fri, 20 Jul 2001 03:22:23 GMT
On Thursday 19 July 2001 19:54, Ian Holsman wrote:
> Justin Erenkrantz wrote:
> >During some testing with flood (~30 threads), we ran into a stack
> >corruption error in our code.  We tracked it down to the fact that
> > we were using a non-reentrant version of gethostbyname.  This
> > patch lets us call the reentrant version of gethostbyname and now
> > we haven't been able to recreate the segfault.
> >
> >The only possible optimization would be the size of the temporary
> >buffer (currently 256).  Roy mentioned that the address array in
> >hostent has a maximum of 10 entries.  If so, the size of the
> >structure plus the maximum size of the array (10 entries) may be
> >sufficient.  If we send in a too small buffer, we should
> >receive ERANGE.
> Is there a reason why we shouldn't just use the re-entrant versions
> where it is available?

It can be overhead that we don't need, it all depends on how the 
re-entrant version is implemented.

> >Any reason we shouldn't commit?  -- justin

You can't check for threads that way.  You need to use the same basic 
logic that we use in dir.c to check for readdir_r.


View raw message