From owner-freebsd-hackers Mon Aug 9 15:43:48 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from hotmail.com (law2-f174.hotmail.com [216.32.181.174]) by hub.freebsd.org (Postfix) with SMTP id 9B45B150A7 for ; Mon, 9 Aug 1999 15:43:46 -0700 (PDT) (envelope-from steve_tarkalson@hotmail.com) Received: (qmail 39660 invoked by uid 0); 9 Aug 1999 22:41:20 -0000 Message-ID: <19990809224120.39659.qmail@hotmail.com> Received: from 207.225.138.17 by www.hotmail.com with HTTP; Mon, 09 Aug 1999 15:41:20 PDT X-Originating-IP: [207.225.138.17] From: "Steve Tarkalson" To: ognir@humboldt1.com, bmcgover@cisco.com Cc: dan@trinsec.com, hackers@FreeBSD.ORG Subject: Re: gethostbyaddr() and threads. Date: Mon, 09 Aug 1999 15:41:20 PDT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG this is solved by one of two methods: 1-) require the caller of gethostbyaddr() to supply a pointer to a hostent struct which will be filled. or 2-) the library uses thread specific storage which is re-used in each call. >From: Joe Groff >Reply-To: ognir@humboldt1.com >To: bmcgover@cisco.com >CC: dan@trinsec.com, hackers@FreeBSD.ORG >Subject: Re: gethostbyaddr() and threads. >Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT) >MIME-Version: 1.0 >From owner-freebsd-hackers@freebsd.org Mon Aug 9 14:22:43 1999 >Received: by hub.freebsd.org (Postfix, from userid 538)id 13F1E152DC; Mon, >9 Aug 1999 14:24:36 -0700 (PDT) >Received: from localhost (localhost [127.0.0.1])by hub.freebsd.org >(Postfix) with SMTPid F31551CD65D; Mon, 9 Aug 1999 14:24:35 -0700 >(PDT)(envelope-from owner-freebsd-hackers) >Received: by hub.freebsd.org (bulk_mailer v1.12); Mon, 9 Aug 1999 14:24:35 >-0700 >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 9598214D75for >; 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) >Message-Id: <199908092121.OAA21266@home.humboldt1.com> >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/ >Sender: owner-freebsd-hackers@FreeBSD.ORG >X-Loop: FreeBSD.ORG >Precedence: bulk > >---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 > _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message