Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Aug 1999 10:06:26 -0400
From:      Dan Moschuk <dan@trinsec.com>
To:        Tony Finch <dot@dotat.at>
Cc:        hackers@freebsd.org
Subject:   Re: gethostbyaddr() and threads.
Message-ID:  <19990809100626.A43835@trinsec.com>
In-Reply-To: <E11Dok0-000LN9-00@fanf.noc.demon.net>; from Tony Finch on Mon, Aug 09, 1999 at 01:41:24PM %2B0100
References:  <19990808204333.A40377@trinsec.com> <E11Dok0-000LN9-00@fanf.noc.demon.net>

next in thread | previous in thread | raw e-mail | index | archive | help

| >After quite an exhausting night (of all the ways I didn't want to spend my
| >Sunday...) I've managed to track down a problem that has been frustrating me
| >all night.  The problem exists with multiple threads calling gethostbyaddr()
| >(not necessarily at the same time).  
| 
| src/lib/libc/net/gethostbydns.c seems to use a load of static
| variables in a non-thread-safe fashion.

Yes, I noticed that as well.  I also noticed that gethostbyaddr_r worked
"less" than gethostbyaddr did (the result was that all threads ended up 
thrashing each other, and not of them continued on).  I was going to use
res_query, but noticed that it too used static buffers (although it looks
pretty easy to fix).

Would anyone be offended if I were to produce a few patches to fix up these
routines once and for all?  Should I just produce a few #ifdef _THREAD_SAFEs
or try full blown routines (gethostbyaddr_r, res_query_r)?


Thanks,

Dan


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?19990809100626.A43835>