Subject: sysctl(KERN_PROC2) implementation
To: None <email@example.com>
From: Simon Burge <firstname.lastname@example.org>
Date: 04/17/2000 01:18:32
I've put an unpolished, mostly undocumented implementation of
with changes to the kernel, libkvm and ps(1) to use the new mechanism.
The big changes are to lib/libkvm/kvm_proc.c, sys/kern/kern_sysctl.c
and sys/sys/sysctl.h. There's currently no support for reading
kinfo_proc2's from a kernel crashdump, but that should be a SMOP based
on the existing code for kinfo_proc's.
Nothing has been done as far as snapshots or sockets - it uses the
existing mechanism of getting the current number of processes, adding
some slop (the existing 5 process value) and then reading in the whole
lot. I appreciate that what I have so far is not the direction in which
some others would like to head, but this is simple and doesn't have the
associated problems of tying up kernel memory.
Cleanups I still need to do include using local defines for things like
NGROUPS, MAXCOMLEN and MAXLOGNAME so that these can change without
affecting the structure size.
fstat, systat, top, w and ipf's iptest are also users of kvm_getprocs().
I'd like to check out if any of these are suitable for conversion to the
new interface. At a guess fstat and systat probably use too many other
kernel structures, but top and especially w should be easy.
This works ok on an alpha - I'll test it on an i386 and a pmax tomorrow
(they're slower, and thus less fun for testing :-)
Any comments, suggestions, criticisms or flames on the work so far would
be much appreciated.