From owner-freebsd-hackers Mon Aug 9 22:36:21 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from xylan.com (postal.xylan.com [208.8.0.248]) by hub.freebsd.org (Postfix) with ESMTP id 99CF714D84 for ; Mon, 9 Aug 1999 22:36:17 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from mailhub.xylan.com by xylan.com (8.8.7/SMI-SVR4 (xylan-mgw 2.2 [OUT])) id WAA03299; Mon, 9 Aug 1999 22:31:18 -0700 (PDT) Received: from omni.xylan.com by mailhub.xylan.com (SMI-8.6/SMI-SVR4 (mailhub 2.1 [HUB])) id WAA19305; Mon, 9 Aug 1999 22:26:50 -0700 Received: from softweyr.com ([204.68.178.39]) by omni.xylan.com (4.1/SMI-4.1 (xylan engr [SPOOL])) id AA14998; Mon, 9 Aug 99 22:31:13 PDT Message-Id: <37AFB921.D3070875@softweyr.com> Date: Mon, 09 Aug 1999 23:31:13 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en Mime-Version: 1.0 To: ognir@humboldt1.com Cc: louie@TransSys.COM, steve_tarkalson@hotmail.com, bmcgover@cisco.com, dan@trinsec.com, hackers@FreeBSD.ORG Subject: Re: gethostbyaddr() and threads. References: <199908092354.QAA18586@home.humboldt1.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Joe Groff wrote: > > ---Louis A. Mamakos said: > >> You could malloc() a struct hostent for each call to > >> gethostby*(), each time registering the hostent in some list along with the > >> thread's PID. If the same thread calls gethostby*, use the same buffer, or > >> allocate a new one if another thread calls it. Have a static function be > > called > >> atexit to free all the mallocs. > > > > Yuk! > > > > If you're writing a multithreaded program, a slightly different API for > > gethostbyname() is likely to be the least of your worries. > > > Yeah, that IS a horrible idea of mine. :) Changing the API should be a last > resort, though, since we don't want to introduce to many FreeBSDisms into the > already-fragmented-enough Unix world. > > Just a thought, how does Linux's GNU libc handle gethostby* in threaded apps? Probably the way POSIX specifies, which would certainly be *our* target. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC http://softweyr.com/ wes@softweyr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message