Subject: misc/10809: sys/ansi.h mess
To: None <gnats-bugs@gnats.netbsd.org>
From: David Holland <dholland@flurgle.eecs.harvard.edu>
List: netbsd-bugs
Date: 08/10/2000 14:42:12
>Number:         10809
>Category:       misc
>Synopsis:       nonstandard type symbol manipulation in sys/ansi.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 10 14:43:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     dholland@eecs.harvard.edu
>Release:        NetBSD-1.5 branch of 2000-Aug-08
>Organization:
   - David A. Holland             |    VINO project home page:
     dholland@eecs.harvard.edu    | http://www.eecs.harvard.edu/vino
>Environment:

	I found this in the 1.5 branch source just now, but it appears
to affect -current as well.

>Description:

	The normal mechanism in 4.4BSD for making *_t types that
	need to be definable in more than one place work is to 
	define _BSD_WHATEVER_T_ to the actual type in sys/types.h
	or equivalent, and then anywhere the type is wanted, if
	the preprocessor symbol is still defined, use it to make
	a typedef and #undef it.

	For some reason socklen_t wasn't implemented this way and
	instead uses its own different mechanism, as well as its
	own private include file <sys/ansi.h>.

	IMO this is an undesirable increase in entropy and ought to 
	be corrected so socklen_t behaves like ptrdiff_t and clock_t
	and the like.

>How-To-Repeat:
	N/A.

>Fix:
	- Put _BSD_SOCKLEN_T_ in sys/sys/types.h.
	- Find the places that use <sys/ansi.h> and correct them to use 
	  the standard mechanism,

#ifdef _BSD_SOCKLEN_T_
typedef _BSD_SOCKLEN_T_ socklen_t;
#undef _BSD_SOCKLEN_T_
#endif

	- Remove sys/sys/ansi.h.

	I have not put together a patch yet because I lack a working 
	up-to-date system at the moment, but I should be able to put
	one together soon if desired.


>Release-Note:
>Audit-Trail:
>Unformatted: