cvs commit: src/lib/libc/net getproto.c getprotoent.c getprotoname.c netdb_private.h

David Schultz das at FreeBSD.ORG
Wed Apr 20 17:04:00 PDT 2005


On Wed, Apr 20, 2005, Hajimu UMEMOTO wrote:
> Hi,
> 
> >>>>> On Tue, 19 Apr 2005 17:20:19 -0400
> >>>>> Garrett Wollman <wollman at csail.mit.edu> said:
> 
> wollman> If they are generally useful they should be globally visible, with the
> wollman> standard FreeBSD namespace protections.  (In this case, this probably
> wollman> means that the __ versions stay as they are, and non-__ versions can
> wollman> be defined using aliases in a separate compilation unit.)
> 
> I'm not sure they are really useful.  I think they are preffered to
> use for thread applications.  However, our get{serv,proto}*() is now
> thread-safe.  So, we don't need to use get{serv,proto}*_r() to have
> just thread-safeness.
> 
> Indeed, I started this work to call getservby*_r() from getaddrinfo()
> and getnameinfo().  But, after all, I didn't modify getaddrinfo() and
> getnameinfo() to call getservby*_r() directly.
> 
> Further, getserv*_r() takes struct servent_data for its argument.  So,
> once we decide to expose them, we will need to pay attention to an ABI
> compatibility in the future.  So, we should be careful, IMHO.

If they are stable, and if applications (even ones written for
other platforms) might benefit from them, then the right way to
support them is as follows:

In foo.c:

	#include <sys/cdefs.h>

	type
	__foo(params)
	{
		body;
	}

	__weak_reference(__foo, foo);

In foo.h:

	#include <sys/cdefs.h>

	#if __BSD_VISIBLE
	type foo(params);
	#endif	/* __BSD_VISIBLE */

But this assumes the ABI is stable.  If this is not the case, then
they should not be exported, at least not immediately.


More information about the cvs-src mailing list