From owner-freebsd-hackers Mon Aug 9 14:24:36 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 9598214D75 for ; Mon, 9 Aug 1999 14:24:29 -0700 (PDT) (envelope-from ognir@humboldt1.com) Received: from shovel.groff (ppp176-pm5.humboldt1.com [207.104.21.169]) by home.humboldt1.com (Pro-8.9.2/Pro-8.9.2) with SMTP id OAA21266; Mon, 9 Aug 1999 14:21:38 -0700 (PDT) Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT) Message-Id: <199908092121.OAA21266@home.humboldt1.com> From: Joe Groff To: bmcgover@cisco.com Cc: dan@trinsec.com, hackers@FreeBSD.ORG Reply-To: ognir@humboldt1.com Subject: Re: gethostbyaddr() and threads. In-Reply-To: <199908092104.RAA06010@bmcgover-pc.cisco.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 ---Brian McGovern said: > [snip] > > gethostbyaddr... actually, most of the gethostby* functions... are not > thread safe. They all use a static buffer in the library. > > Therefore, with threads, if you don't take precautions, I'd expect your > results to be odd. > -Brian > Couldn't this be easily fixed? I haven't looked at the source yet, but I believe you could replaced the static buffers with a dynamically-allocated list of buffers, with one for each thread using the gethost functions. Or perhaps you could just eliminate all the static stuff altogether? -Joe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message