View Full Version : Process Structure?

09-04-2003, 07:59 AM
Is there a function/structure to handle storing the system process information on a linux-based system?

For example, with utmp.h, you're able to grab user information from the utmp file and store it in a structure -- trying to do to the same thing with processes.

Any help is appreciated.

09-13-2003, 01:55 AM
Um... I don't think there is any way to get the process by a header file, I haven't found one. There _might_ be a folder which you can get the processes from, like /var/run or something, but if you look at the source for 'top' you'll see it has a lot of magic numbers so to speak. There is a tihng on the <a href="http://cboard.cprogramming.com/misc.php?s=&action=faq">FAQ</a> on this site that has something to do with what you are looking for :)

09-16-2003, 09:01 AM
I would either call ps with popen, or figure out what ps does on your particular operating system. If you are on linux you can possibly use procfs.