Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, Can anyone tell me an alternative for getting the process details other than reading the system file /proc/<pidlist>/. Regards, Ranganathan...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2004
    Posts
    11

    API for collecting process details


    Hi,

    Can anyone tell me an alternative for getting the process details other than reading the system file /proc/<pidlist>/.

    Regards,
    Ranganathan

  2. #2
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    are you wanting the PID for a program you're writing or for another running application?
    if it's for a program you're writing, use getpid() or getppid() (the second one gets the parent process's PID)

    you can use ps to find out the PID of currently running programs.
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  3. #3
    Just Joined!
    Join Date
    Sep 2004
    Posts
    11

    Re:: API for collecting process details

    Thanks for the reply , I want all the informations not just the PID. For example in /proc/<pidlist/cmdline I get the process name, in /proc/<pidlist>/status I get the process status like running or sleeping.
    What is the alternative other than reading the files under /proc/<pidlist>

    Regards,
    Ranganathan

  4. #4
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    read the manpage for 'ps'... you can use it to display just about anything about running processes, IIRC.... (i only use it for finding PID's and seeing if something is still running so i can kill it)...
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  5. #5
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    Also, the /proc/$PID/* stuff is kernel level, so that is where ps, top, and many other programs get their information. I suggest you learn how to use proc efficiently, as it is the "right" place to look for this information.

    Best,

    Samuel
    I respectfully decline the invitation to join your delusion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •