[ILUG] Getting PID's in C

Caolan McNamara cmc at stardivision.de
Fri Apr 14 14:58:25 IST 2000


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 14.04.00, 15:44:54, "Vinayak Risbud" <vinayak_risbud at asiansonly.net> 
wrote regarding [ILUG] Getting PID's in C:


> Hi Friends

> How can I get the PID's of all the processes currently running
> in Linux Machine, using 'C'.

While you said Linux in particular you should be aware that this differs 
considerably from platform to platform as how to do this...

Unix programming faq is a good place to start for this sort of queries
http://www.whitefang.com/unix/faq_2.html#SEC17

There is a gnome library 
http://www.gnome.org/applist/view.phtml?name=LibGTop
Which is an attempt to be a cross platform interface for this sort of 
issue.

I would recommend one of those two approaches, If that still does not 
appeal to you then you can look at the /proc file system. A simple ls 
shows you all the running processes, each dir is a process. Check out the 
source to numerous programs for exact parsing details. Again libgtop is 
probably a good place to start.

C.

> Vinayak



> ------------------------------------------------------------
> Do you have YOUR free e-mail address? Get it now! http://asiansonly.net
> Free web sites... discussion forums... more! Click here -> 
http://asiansinc.com

> --
> Irish Linux Users' Group: ilug at linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription 
information.
> List maintainer: listmaster at linux.ie




More information about the ILUG mailing list