Subject: port-i386/3564: db_machdep.h pulls in excess vm headers
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@erik-be.uni-c.dk>
List: netbsd-bugs
Date: 05/01/1997 12:01:53
>Number:         3564
>Category:       port-i386
>Synopsis:       db_machdep.h pulls in excess vm headers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May  1 01:05:01 1997
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	UNI-C
>Release:        NetBSD-current 30 April 1997
>Environment:
	
System: NetBSD erik-be.uni-c.dk 1.2D NetBSD 1.2D (ERIKBE) #23: Tue Apr 15 16:25:12 MEST 1997 erik@erik-be.uni-c.dk:/sw/NetBSD/src/sys/arch/i386/compile/ERIKBE i386


>Description:
	sys/arch/i386/include/db_machdep.h pulls in all of the major
	vm headers by including vm.h just to declare boolean_t.

	See m68k/3213 for a further discussion about why to avoid this.

	I also noticed that my custom kernel compiles even when I just
	remove the '#include <vm/vm.h>' line altogether, but GENERIC
	needs a declaration of boolean_t, which may be provided by 
	including <vm/vm_param.h> here as in my patch below. Actually
	GENERIC will compile with no vm headers included in i386/include/
	db_machdep.h if you include vm_param.h in ddb/db_{access,
	sym,interface,run}.h.

	An even better patch will probably be to declare boolean_t
	in types.h as discussed in vm_param.h (possibly guarding it
	by conditionals to make it declared only for kernel builds).

	regards
	Erik Bertelsen
>How-To-Repeat:
>Fix:

Index: db_machdep.h
===================================================================
RCS file: /sw/cvs-base/src/sys/arch/i386/include/db_machdep.h,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 db_machdep.h
*** db_machdep.h        1997/02/07 16:01:46     1.1.1.3
--- db_machdep.h        1997/05/01 09:51:45
***************
*** 34,40 ****
   */
  
  #include <sys/param.h>
! #include <vm/vm.h>
  #include <machine/trap.h>
  
  typedef       vm_offset_t     db_addr_t;      /* address - unsigned */
--- 34,45 ----
   */
  
  #include <sys/param.h>
! 
! /*
!  * XXX - Would rather not pull in vm headers, but need boolean_t,
!   * at least until boolean_t moves to <sys/types.h> or someplace.
!    */
! #include <vm/vm_param.h>
  #include <machine/trap.h>
  
  typedef       vm_offset_t     db_addr_t;      /* address - unsigned */
>Audit-Trail:
>Unformatted: