Subject: kern/2599: svr4_misc.c includes , breaks cross-compiles, should
To: None <gnats-bugs@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 07/02/1996 16:02:00
>Number:         2599
>Category:       kern
>Synopsis:       svr4_misc.c includes <sys/dir.h>, should include <sys/dirent.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul  2 19:35:03 1996
>Last-Modified:
>Originator:     Jonathan Stone
>Organization:
	
>Release:        NetBSD-1.2-Beta at 2 July 1996.
>Environment:
	
System: NetBSD Bowl.DSG.Stanford.EDU 1.2_BETA NetBSD 1.2_BETA (DSG) #1: Fri Jun 28 13:31:00 PDT 1996 jonathan@Bowl.DSG.Stanford.EDU:/aga/n1/src/NetBSD/DSG-LOCAL/src/sys/arch/i386/compile/DSG i386


>Description:
Someone wrote
	#include <sys/dir.h>

in sys/compat/svr4/svr4_misc.c, when they really meant
	#include <sys/dirent.h>

The former is just a placebo that does #include <dirent.h>.
While this works on native NetBSD systems, it's including a file from
/usr/include, _not_ from sys.  This, naturally, breaks when
cross-compiling.  It will also pull in the "wrong" version of
<dirent.h>, when and if the version in /usr/include and in the kernel
source tree are different.


>How-To-Repeat:

cross compile on, e.g., SunOS, using a ported bmake.
Run config on GENERIC or GENERIC_SCSI3. Compile using, gcc and gas
and a make command something like:

    bmake -k CPP=/usr/lib/cpp AS=gas CC="gcc" GCCWFLAGS="-Wall -nostdinc -D__NetBSD__"

which works for me, after fixing tsort -q in bsd.lib.mk.


>Fix:
	

The following patch substitutes the appropriate header file.
It compiles for me...

*** svr4_misc.c.DIST	Tue Jun 11 04:47:39 1996
--- svr4_misc.c.dsg	Tue Jul  2 14:37:32 1996
***************
*** 36,42 ****
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/namei.h>
! #include <sys/dir.h>
  #include <sys/proc.h>
  #include <sys/file.h>
  #include <sys/stat.h>
--- 36,42 ----
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/namei.h>
! #include <sys/dirent.h>
  #include <sys/proc.h>
  #include <sys/file.h>
  #include <sys/stat.h>
>Audit-Trail:
>Unformatted: