Subject: kern/2813: TRUE/FALSE declarations unguarded in sys/vm/vm_param.h
To: None <gnats-bugs@gnats.netbsd.org>
From: Simon Burge <simonb@telstra.com.au>
List: netbsd-bugs
Date: 10/07/1996 13:59:54
>Number:         2813
>Category:       kern
>Synopsis:       TRUE/FALSE declarations unguarded in sys/vm/vm_param.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct  6 21:20:00 1996
>Last-Modified:
>Originator:     Simon Burge
>Organization:
	Telstra, Australia
>Release:        1.2
>Environment:
System: NetBSD mona 1.2 NetBSD 1.2 (MONA) #1: Fri Oct 4 15:51:13 EST 1996 simonb@mona:/usr/src/sys/arch/pmax/compile/MONA pmax


>Description:
	The defines of TRUE and FALSE in /usr/src/sys/vm/vm_param.h
	do not check to see if TRUE and FALSE are already defined.
>How-To-Repeat:
	I found the bug playing around with sysctl().  <sys/sysctl.h>
	include <vm/vm.h>, which in turn includes <vm/vm_param.h>.
	For a shorter version, compile the following:

		#include <curses.h>
		#include <vm/vm_param.h>

		main() {}

	Watch warnings.
>Fix:
	Apply the following patch.  If people are really worried
	the "the kernel should do what it wants", at least a

		#ifdef TRUE
		#undef TRUE
		#endif

	type thing would do...

*** usr/src/sys/vm/vm_param.h.ORIG	Sat Oct 14 12:59:00 1995
--- usr/src/sys/vm/vm_param.h	Mon Oct  7 13:54:21 1996
***************
*** 77,84 ****
   * This belongs in types.h, but breaks too many existing programs.
   */
  typedef int	boolean_t;
! #define	TRUE	1
! #define	FALSE	0
  
  /*
   *	The machine independent pages are refered to as PAGES.  A page
--- 77,88 ----
   * This belongs in types.h, but breaks too many existing programs.
   */
  typedef int	boolean_t;
! #ifndef TRUE
! #define	TRUE	(1)
! #endif
! #ifndef FALSE
! #define	FALSE	(0)
! #endif
  
  /*
   *	The machine independent pages are refered to as PAGES.  A page
>Audit-Trail:
>Unformatted: