Subject: xosview and machine/cpu.h problems
To: None <port-mac68k@NetBSD.ORG>
From: Brian C. Grayson <bgrayson@ece.utexas.edu>
List: port-mac68k
Date: 12/30/1997 02:06:52
  I received notice recently (PR#4731, by Steve Allen) that
xosview-1.5.1 will not compile on macs, due to want_resched and
astpending being multiply defined.  After a bit of digging,
it appears that including /usr/include/sys/sysctl.h in a C file
will pull in /usr/include/machine/pmap.h, which on mac68k pulls
in /usr/include/machine/cpu.h, which contains the following:

int     astpending;     /* need to trap before returning to user mode */
int     want_resched;   /* resched() was called */

  Two different files (memmeter.cc and pagemeter.cc) in the
xosview-1.5.1 NetBSD tree pull in /usr/include/sys/sysctl.h, so
at link time, the linker sees multiple astpendings and want_rescheds.

  I have no idea what I'm talking about, but should those be
declared differently?  Under i386 and alpha, the declarations of
want_resched etc. are protected by #ifdef _KERNEL (in a
roundabout way under i386).  Should the mac version have similar
protections?  What about the other ports?  (I didn't check all of
them.)

  As a temporary workaround for any xosview users out there,
remove the include of <sys/sysctl.h> from
xosview-1.5.1/netbsd/pagemeter.cc -- it is no longer needed. 
(That'll teach me to copy code without examining the includes.)
I'll fix this in the next minor release of xosview.

  Thanks for any help.

  Brian
-- 
Brian Grayson (bgrayson@ece.utexas.edu)
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger bgrayson@orac.ece.utexas.edu for PGP key.