> I am currently going through the netstat code, and I see it makes a lot of use
> of kvm.

It is terrifying.

> I take it that the preferred method for looking up kernel data would
> be sysctl.

Yes.

> Now, I am stuck in the kvm code.  I have no idea where I can find a list of
> kernel symbols that can be placed into nl struct.  Is there is man page or
> header file that lists the kernel symbols and what they represent?  

We have already done the simple changes.  The ones that remain are much
more difficult, and will require design of actual in-kernel sysctl data
structures that collect information.

The larger problem with netstat of course is that it is racing against
the kernel memory image.  It reads a pointer, reads where it points to,
etc etc etc.  It is walking lists.

A number of similar problems have been solved in some other programs, for
instance, dkstat, vmstat, and systat.

Other similar areas to do work are fstat and pstat etc..

> sysctl has very good documentation and makes finding sysctl symbols easy.

Note that I am not a fan of procfs for a variety of similar reasons.
It is not just racey, but it supplies partial snapshots of memory.

At least sysctl interfaces, once designed, are atomic.

Reply via email to