From owner-freebsd-threads@FreeBSD.ORG Mon Feb 16 09:33:27 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F31BD16A4CE; Mon, 16 Feb 2004 09:33:26 -0800 (PST) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA4C043D1D; Mon, 16 Feb 2004 09:33:26 -0800 (PST) (envelope-from rodrigc@crodrigues.org) Received: from h00609772adf0.ne.client2.attbi.com ([66.31.45.197]) by comcast.net (rwcrmhc13) with ESMTP id <2004021617332601500gs1f0e>; Mon, 16 Feb 2004 17:33:26 +0000 Received: from h00609772adf0.ne.client2.attbi.com (localhost.crodrigues.org [127.0.0.1])i1GHXghd060138; Mon, 16 Feb 2004 12:33:42 -0500 (EST) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost)i1GHXfaF060137; Mon, 16 Feb 2004 12:33:41 -0500 (EST) (envelope-from rodrigc) Date: Mon, 16 Feb 2004 12:33:41 -0500 From: Craig Rodrigues To: freebsd-gnats-submit@freebsd.org Message-ID: <20040216173341.GA60096@crodrigues.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i cc: hook@aktrad.ru cc: freebsd-threads@freebsd.org Subject: Re: misc/18824: gethostbyname is not thread safe X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 17:33:27 -0000 > The gethostbyname() is not thread safe. It causes lock ups if >compiled with threads. It would be helpful if this is mentioned in >the docs or if a thread-safe version is provided (gethostbyname_r >?) The gethostbyname() man page mentions in the BUGS section: "These functions use static data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it." You should use the getaddrinfo() function which is reentrant, since it doesn't use static data storage. I think this PR should be closed. -- Craig Rodrigues rodrigc@crodrigues.org