The best tutorial is probably the /usr/src/bin/ps source code...
There's also /proc, but that isn't as portable, as not every system always mounts /proc (OK, most don't nowadays.)
Generally speaking, you'll need to hit the kvm_* calls, which are documented in man pages, but reading the ps source is probably the easiest way to figure out what's up and see it in action before diving into the man pages to make sure you get your implementation right.
|