From nobody@FreeBSD.ORG  Thu May 25 23:40:07 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id E228F37B662; Thu, 25 May 2000 23:40:07 -0700 (PDT)
Message-Id: <20000526064007.E228F37B662@hub.freebsd.org>
Date: Thu, 25 May 2000 23:40:07 -0700 (PDT)
From: hook@aktrad.ru
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: gethostbyname is not thread safe
X-Send-Pr-Version: www-1.0

>Number:         18824
>Category:       kern
>Synopsis:       gethostbyname is not thread safe
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-threads
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 25 23:50:00 PDT 2000
>Closed-Date:    Fri Nov 11 08:43:00 GMT 2005
>Last-Modified:  Fri Nov 11 08:43:00 GMT 2005
>Originator:     Gene Sokolov
>Release:        2.2.8-4.0
>Organization:
>Environment:
>Description:
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 ?)
>How-To-Repeat:
man gethostbyname
try to find any mention of threads on the page.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-threads 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jul 12 18:40:03 PDT 2003 
Responsible-Changed-Why:  
Assign to threads mailing list 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18824 

From: Craig Rodrigues <rodrigc@crodrigues.org>
To: freebsd-gnats-submit@freebsd.org
Cc: hook@aktrad.ru, freebsd-threads@freebsd.org
Subject: Re: misc/18824: gethostbyname is not thread safe
Date: Mon, 16 Feb 2004 12:33:41 -0500

 > 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
State-Changed-From-To: open->closed 
State-Changed-By: davidxu 
State-Changed-When: Fri Nov 11 08:40:49 GMT 2005 
State-Changed-Why:  
I think it was fixed in 6.0, it is thread safe: 

> These functions use a thread-specific data storage; if the data is needed 
> for future use, it should be copied before any subsequent calls overwrite 
> it. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=18824 
>Unformatted:
