|
Well, there are a few things to consider...I mean, do you just want to write a shell-script, or do you want to actually write your own program, and what language?
If you are using C/C++ and libc, there are a few ways to do nearly what you want, but there is no magic function that will tell you what you want to know. The easiest ways is to read in the appropriate "files" in /proc. There's probably something much like you want in /proc/net, and also in /proc/sys/net, and other places. However, it's not a bad idea to just pipe to ps, since it's just scanning all of the processes that you're interested in anyway out of /proc, and then interpret the info it returns and format it for your own uses.
All of that should also be very straight forward. But no matter what you're going to have to do some scanning and formatting on your own to get the info you want.
--Xagafinelle
|