Subject: sysctl(KERN_PROC2) implementation - take 2
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-kern
Date: 05/16/2000 00:02:51
Folks,

I've put another implementation of the new sysctl(KERN_PROC2) interface
at

	ftp://ftp.netbsd.org/pub/NetBSD/misc/simonb/sysctl-kproc2-diffs.tar.gz

The major changes are a new sysctl to get a process's argv/envp so that
/bin/ps now runs without any set{u,g}id priveledges.  Thanks to Matt
Green for suggesting that one, and Robert Elz for helping heaps with
debugging and fixing the procfs cmdline shortcomings on which the new
sysctl is based.  Also at Eduardo Horvath's suggestion all fields are
now fixed size intX_t or u_intX_t's - a 'struct kinfo_proc2' is now the
same size no matter what architecture or long/pointer size.

There's a couple of things that still need tidying up, including doco.
The final version also doesn't need the ps_strings info in struct
kinfo_proc2, nor the HW_KERNEL_BITS sysctl.  Also there's no support yet
for compat32 argv/envp processing - I'm trying to organise some local
hardware to get that done...


Also, this hasn't been tested (nor is support complete yet) for working
on kernel crash dumps.  That said, how does one force a crash dump these
days?  On an i386:

	login: ~Stopped at      cpu_Debugger+0x4:       leave
	db> sync
	syncing disks... panic: lockmgr: no context
	Stopped at      cpu_Debugger+0x4:       leave
	db> 

Simon.