Thread: Process Structure?

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    1

    Process Structure?

    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.

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    52
    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
    - Daniel Wallace

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  2. Replies: 13
    Last Post: 12-14-2007, 03:34 PM
  3. passing structure arrays to functions?
    By bem82 in forum C Programming
    Replies: 3
    Last Post: 10-30-2006, 06:17 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM