Subject: kernel sysctl support for vmstat/iostat
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-kern
Date: 06/18/2000 15:15:41
I've make some sysctls to return the data that vmstat and iostat
display, and diffs for these are at

	ftp://ftp.netbsd.org/pub/NetBSD/misc/simonb/vmstat-sysctl-diffs

When the sysctls that chase lists, only the pool sysctl uses the
(existing) lock to make sure that it doesn't chase pointers off into
lala land (if the structures get modified underneath by something at a
higher spl).  Should:

  + the pool structures be locked as I've done (ie, could locking them
    at the syscall level block something higher up)?
  + any of the other list-structures (the event counters and the disk
    statistics) be locked to stop them being modified?


While on queues, FreeBSD has things like

	#define TAILQ_FOREACH(var, head, field) \
		for (var = TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field))

in <sys/queue.h> - these could make life a little easier in the general
case...


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>.

Simon.