From owner-freebsd-hackers Mon Aug 9 16:56:49 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from home.humboldt1.com (home.humboldt1.com [206.13.45.1]) by hub.freebsd.org (Postfix) with ESMTP id BF1EE14FA2 for ; Mon, 9 Aug 1999 16:56:46 -0700 (PDT) (envelope-from ognir@humboldt1.com) Received: from shovel.groff (ppp177-pm5.humboldt1.com [207.104.21.170]) by home.humboldt1.com (Pro-8.9.2/Pro-8.9.2) with SMTP id QAA18586; Mon, 9 Aug 1999 16:54:24 -0700 (PDT) Date: Mon, 9 Aug 1999 16:54:24 -0700 (PDT) Message-Id: <199908092354.QAA18586@home.humboldt1.com> From: Joe Groff To: louie@TransSys.COM Cc: steve_tarkalson@hotmail.com, bmcgover@cisco.com, dan@trinsec.com, hackers@FreeBSD.ORG Reply-To: ognir@humboldt1.com Subject: Re: gethostbyaddr() and threads. In-Reply-To: <199908092322.TAA68246@whizzo.transsys.com> X-Mailer: XCmail 1.0.0 - with PGP support, PGP engine version 0.5 (FreeBSD) X-Mailerorigin: http://www.fsai.fh-trier.de/~schmitzj/Xclasses/XCmail/ MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG ---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? -Joe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message