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 <og...@humboldt1.com>
Reply-To: og...@humboldt1.com
To: bmcgo...@cisco.com
CC: d...@trinsec.com, hack...@freebsd.org
Subject: Re: gethostbyaddr() and threads.
Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT)
MIME-Version: 1.0
From owner-freebsd-hack...@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 <hack...@freebsd.org>; Mon, 9 Aug 1999 14:24:29 -0700 (PDT)(envelope-from og...@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.oaa21...@home.humboldt1.com>
In-Reply-To: <199908092104.raa06...@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-hack...@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 majord...@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 majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to