From owner-freebsd-hackers Sun Apr 16 0: 5:35 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from obie.softweyr.com (obie.softweyr.com [204.68.178.33]) by hub.freebsd.org (Postfix) with ESMTP id 722D137B513 for ; Sun, 16 Apr 2000 00:05:31 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from softweyr.com (Foolstrustident!@homer.softweyr.com [204.68.178.39]) by obie.softweyr.com (8.8.8/8.8.8) with ESMTP id BAA15492; Sun, 16 Apr 2000 01:05:24 -0600 (MDT) (envelope-from wes@softweyr.com) Message-ID: <38F89DF7.4633F025@softweyr.com> Date: Sat, 15 Apr 2000 10:51:03 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.0-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: Ming Zhang Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Multithread safe gethostbyname() ? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Ming Zhang wrote: > > Is there a MT-safe implementation of gethostbyname() in FreeBSD (3.4/4.0)? > > On Solaris there is gethostbyname_r(). Calling gethostbyname() with in > two threads cause both threads to block. > > I know the "struct hostent" is static in gethostbyname(), however it seems > like the socket that is used to get the DNS info is static too. If you look at the current implementatino of the getXbyY functions, you'll find they are jungles full of static data. I've been (slowly) writing the _r function missing from FreeBSD, documenting the hidden ones I've found, and generally fleshing this out, but I've left getXbyY to last because they're fugly. I'll start with gethostbyname_r because that is the most useful, but I cannot promise when that might be. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message