View Single Post
  #2   (View Single Post)  
Old 22nd October 2008
mdh's Avatar
mdh mdh is offline
Real Name: Matt D. Harris
FreeBSD 2.2.6 User
 
Join Date: Oct 2008
Location: West Virginia
Posts: 139
Default

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.
Reply With Quote