Subject: Re: pkg/10616: sparc/cpu.h includes non-installed kernel includes
To: John Hawkinson <jhawk@MIT.EDU>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 08/03/2000 09:15:40
>At this point, I think the right approach is to propose
>adding the requirement that include files in /usr/include
>should work in userlevel programs with _KERNEL defined to
>/usr/share/misc/style, by way of a discssion on tech-kern.
>
>Presence of a requirement in /usr/share/misc/style does not mean
>we must rototill the entire kernel to fix places where that requirement
>is nonexistant, but it gives us a good standard to strive for.
>
>Any objections to this approach?

only that i don't think it will work.  or that it will be very
difficult at the very least.  at one i needed to include sys/lockf.h
in a userland program.  that got me this warning:

/usr/include/sys/lockf.h:76: warning: `struct vop_advlock_args' declared inside parameter list
/usr/include/sys/lockf.h:76: warning: its scope is only this definition or declaration,
/usr/include/sys/lockf.h:76: warning: which is probably not what you want.
/usr/include/sys/lockf.h:82: warning: `struct flock' declared inside parameter list

struct vop_advlock_args is defined in sys/vnode_if.h, but including
that gives me this:

/usr/include/sys/vnode_if.h: In function `VOP_LOOKUP':
In file included from test.c:8:
/usr/include/sys/vnode_if.h:67: `vop_lookup' undeclared (first use in this function)
/usr/include/sys/vnode_if.h:67: (Each undeclared identifier is reported only once
/usr/include/sys/vnode_if.h:67: for each function it appears in.)
/usr/include/sys/vnode_if.h:67: warning: assignment makes pointer from integer without a cast
...

so it seems i need to include sys/vnode.h.  that didn't seem to help,
so i defined _KERNEL for sys/vnode.h.  that netted me:

In file included from /usr/include/sys/vnode.h:41,
                 from test.c:6:
/usr/include/sys/lock.h:86: opt_lockdebug.h: No such file or directory
/usr/include/sys/lock.h:87: opt_multiprocessor.h: No such file or directory
...

so i just threw in a stub declaration for the structure instead of
including those files.  i knew i wasn't going to find those files
anywhere very easily.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."