Subject: kern/1511: dev/scsi/ files fail to include
To: None <gnats-bugs@gnats.netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 09/25/1995 17:17:02
>Number:         1511
>Category:       kern
>Synopsis:       sys/scsi/scsiconf.c etc. fail to include <sys/systm.h>
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 25 20:35:01 1995
>Last-Modified:
>Originator:     Jonathan Stone
>Organization:
	
>Release:        NetBSD-current from 18 september 1995
>Environment:
	
System: NetBSD Reno.Stanford.EDU 1.0A NetBSD 1.0A (NEWCONF) #579: Mon Sep 25 13:42:43 PDT 1995 jonathan@Reno.Stanford.EDU:/usr/src/sys/arch/pmax/compile/NEWCONF pmax


>Description:
	[[ I thought I'd send-pr'ed this already but I couldn't find it
	   with query-pr]]

	The NetBSD /sys/scsi drivers use min() without, in general, including
	<sys/systm.h>, which is where min() is declared. This breaks the
	scsi code on ports that don't (yet) have min in the kernel, and
	breaks prototype checking for  functions declared in lib/libkern/libkern.h
	(such as min()).   cgd says the canonical way to get these is
	via <sys/systm.h>.
	

>How-To-Repeat:
	Configure a NetBSD/Pmax kernel with the NetBSD scsi drivers. The
	kernelwill fail to link, due to undefined references to min().
	Compiling with warnings about prototypes also fails, due to
	not including the relevant prototype declarations.

>Fix:
	1. Add #include <sys/systm.h> to the /sys/scsi/{cd,scsi_base,
	  scsi_ioctl}.c source files.  This cannot hurt.
	2. Add non-inline definitions for min(), etc. to the
	   sys/lib/libkern/arch/mips Makefile.inc.
>Audit-Trail:
>Unformatted: