The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Identifying and grouping OS processes and APP processes wilsonee SUN Solaris 2 1 Week Ago 06:26 AM
du from list with du of list total Movomito Shell Programming and Scripting 3 05-04-2008 06:33 PM
Monitoring Processes - Killing hung processes ukndoit UNIX for Advanced & Expert Users 4 01-17-2008 12:30 AM
how to generate a random list from a given list mskcc Shell Programming and Scripting 3 05-30-2006 12:30 AM
Comparing a distinct value in 1 list with another list manualvin Shell Programming and Scripting 6 06-22-2004 03:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-30-2008
Registered User
 

Join Date: Mar 2008
Posts: 4
Stumble this Post!
how to get list of processes

Hi,

How can I get a list of all the running processes, in C?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-30-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Short answer, depends on platform and a bunch of other things.

The full, unadorned ugly truth is the source for ps(1) for your computer.

Linux: procps - Home Page
FreeBSD (some version): http://ftp.nl.freebsd.org/os/FreeBSD.../bin/ps/ps.c,v
(sorry, that's the raw CVS file, but you can cope)
Reply With Quote
  #3 (permalink)  
Old 03-30-2008
Registered User
 

Join Date: Mar 2008
Posts: 4
Stumble this Post!
really? no cross-unix way to do it? I thought it was pretty fundamental...

Thanx anyway.
Reply With Quote
  #4 (permalink)  
Old 03-30-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Linux is not Unix. I guess the kvm_* stuff in BSD is pretty much portable to other "real" Unices.
Reply With Quote
  #5 (permalink)  
Old 03-30-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,961
Stumble this Post!
You can use the popen function to get the output of the ps command.

Regards
Reply With Quote
  #6 (permalink)  
Old 03-30-2008
Registered User
 

Join Date: Mar 2008
Posts: 4
Stumble this Post!
era,

whats "kvm_*" stuff?
Reply With Quote
  #7 (permalink)  
Old 03-30-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Hmm, you didn't look at the code? It's the FreeBSD link up there; click click.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0