Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: None <erh@nimenees.com>
From: Aidan Cully <aidan@kublai.com>
List: tech-kern
Date: 04/16/2000 00:34:09
So I said I'd said my bit.  Oh, well.

On Sat, Apr 15, 2000 at 11:18:55PM -0500, erh@nimenees.com wrote:
> 	Hey.  I think I just convinced myself that this should use a 
> special type of socket.  (argh, I wish I could remember who suggested
> that, or what list it was on.)  make socket with domain of KINFO, protocol
> PROC_INFO, write the size of your struct kinfo_proc2, read the total
> size, then read the kinfo_proc2 table.  When you're done, close or
> write the size again, repeat.

Make socket with domain AF_KINFO, connect to address
int address[] = { PROC_INFO, op, arg, elemsize };
The connect() makes the snapshot, socket options could allow for the
filtering I was keen on before, and the data is copied out as it's read.
Close the socket to free the snapshot.

Where this doesn't work perfectly is where there are dependancies
between different KINFO addresses, such as an interface list, then
addresses on the interfaces...  I don't know a good solution to that
problem.

--aidan