From owner-freebsd-threads@FreeBSD.ORG Mon Feb 16 09:40:13 2004 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B705E16A4CE for ; Mon, 16 Feb 2004 09:40:13 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 244B943D41 for ; Mon, 16 Feb 2004 09:40:07 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1GHe7bv021113 for ; Mon, 16 Feb 2004 09:40:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1GHe7vJ021112; Mon, 16 Feb 2004 09:40:07 -0800 (PST) (envelope-from gnats) Date: Mon, 16 Feb 2004 09:40:07 -0800 (PST) Message-Id: <200402161740.i1GHe7vJ021112@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Craig Rodrigues Subject: Re: misc/18824: gethostbyname is not thread safe X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 17:40:13 -0000 The following reply was made to PR misc/18824; it has been noted by GNATS. From: Craig Rodrigues 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