Is there any good reason for get*by*_r()?

Mark Andrews Mark_Andrews at isc.org
Wed Sep 27 16:40:17 PDT 2006


> On Tue, 26 Sep 2006, Mark Andrews wrote:
> 
> > 	get*by*_r() are deprecated on most platforms and there use
> > 	is highly non-portable, lots of different API's.
> 
> My understanding was that FreeBSD has copied the Linux version of the
> API.

	That still doesn't make it portable.
 
> > 	Why are we adding compatability for deprecated functions?
> 
> Some projects use them and do not consider get*by*() functions to be
> thread-safe (FreeBSD's are).  They would naturally impose extra locking
> on the get*by*() calls for safety.  devel/nspr which Firefox uses for
> its network calls.  I also saw that games/sauerbraten uses them.  Of
> course, these projects should replace these calls with getaddrinfo().

	We should not be encouraging the use of deprecated API's.  If
	a application is worried about being thread safe then it should
	use getaddrinfo() which has been thread safe from the begining.
	If getaddrinfo() is not available then protect gethostbyname()
	with locks if you can't determine if it is thread safe which
	it should be if the OS is keeping up with standards.

	Mark
--
ISC Training!  October 16-20, 2006, in the San Francisco Bay Area,
covering topics from DNS to DHCP.  Email training at isc.org.
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org


More information about the freebsd-stable mailing list