Subject: Re: kernel sysctl support for vmstat/iostat
To: matthew green <mrg@eterna.com.au>
From: Simon Burge <simonb@netbsd.org>
List: tech-kern
Date: 06/18/2000 16:45:29
matthew green wrote:

>    I also plan to remove the "#ifndef _KERNEL" around sysctl.h's inclusion
>    of
>    
>    	#include <sys/time.h>
>    	#include <sys/ucred.h>
>    	#include <sys/proc.h>
>    	#include <vm/vm.h>
>    
>    It's a pain to have to remember to include these files (especially
>    <vm/vm.h> just to include <sys/sysctl.h>.
> 
> 
> i don't care about the first 3, but i definately wouldn't mind seeing
                                                   would mind ??
> <vm/vm.h> going into <sys/sysctl.h> for now.  after 1.5 branch, i am
> planning on removing <vm/*.h>.  if you make this change, please update
> the documentation as such.

The problem is that 'struct kinfo_proc' includes a 'struct vmspace',
so we need to include _something_ to get that structure definition.
Because non-kernel source always includes those 4 headers, sysctl(3)
just says include include <sys/param.h> and <sys/sysctl.h>.  It's kernel
source that need to explicity include <vm/vm.h>.  If we localise the
inclusion to <sys/sysctl.h> now that's less kernel source to fix later
when you do remove <vm/*.h>...

Given hindsight, it might have been better to put 'struct kinfo_proc'
into <sys/proc.h> but it's perhaps too late for that now, or is it?

Simon.