Date: Mon, 16 Feb 2004 09:40:07 -0800 (PST) From: Craig Rodrigues <rodrigc@crodrigues.org> To: freebsd-threads@FreeBSD.org Subject: Re: misc/18824: gethostbyname is not thread safe Message-ID: <200402161740.i1GHe7vJ021112@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/18824; it has been noted by GNATS. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402161740.i1GHe7vJ021112>