how to get list of processes


 
Thread Tools Search this Thread
Top Forums Programming how to get list of processes
# 1  
Old 03-30-2008
how to get list of processes

Hi,

How can I get a list of all the running processes, in C?
# 2  
Old 03-30-2008
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)
# 3  
Old 03-30-2008
really? no cross-unix way to do it? I thought it was pretty fundamental...

Thanx anyway.
# 4  
Old 03-30-2008
Linux is not Unix. I guess the kvm_* stuff in BSD is pretty much portable to other "real" Unices.
# 5  
Old 03-30-2008
You can use the popen function to get the output of the ps command.

Regards
# 6  
Old 03-30-2008
era,

whats "kvm_*" stuff?
# 7  
Old 03-31-2008
Hmm, you didn't look at the code? It's the FreeBSD link up there; click click.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List processes using my memory

Here is the output of top command So you see 99% of memory is in use -> Mem: 66005468k total, 65662548k used, How can I find out all processes consuming this 99% memory in descending order of consumption i.e. starting with processes eating more memory. I need the total of the output to... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. UNIX for Advanced & Expert Users

List all background processes

How do I list the process in a Unix based system which are running in background? The following are options that I'm aware of, but they may not be appropiate. a. using ps -ef , and getting records of processes for which STATUS='S'(uninterruptible sleep) b. using jobs -l, and filtering... (5 Replies)
Discussion started by: kumarjt
5 Replies

3. UNIX for Advanced & Expert Users

Kill a list of processes

I am trying to kill a list of processes. I have found these two ways to list a group of process id's on a single line. How would I go about killing all of these processes all on one line? $ ps aux | grep 6243 | grep "a.out" | awk '{printf "%s ",$2}'ps aux | grep 6243 | grep "a.out" | awk... (8 Replies)
Discussion started by: cokedude
8 Replies

4. Solaris

Get list of running network processes

Hello All I am trying to get a list of process or applications runninging on the network only. I should emphasize that im not interested in the application or process if its not using the network. I tried the good old netstat comand, but im not able to figure out how to list the running... (8 Replies)
Discussion started by: busi386
8 Replies

5. UNIX for Dummies Questions & Answers

List processes that are running on other hosts

Hi: How to list processes from all hosts, as opposed to the one you are working at? "ps ux" appears to list processes of the user on a single host only. Thanks. N.B Phil (5 Replies)
Discussion started by: phil518
5 Replies

6. UNIX for Dummies Questions & Answers

What are these different tty processes(tty1,tty2..) running as root mentioned n the list below.

Hi, I need your help to understand about different processes(tty1,tty2,tty3...) running as root as shown below .What exactly these processes do? root@bisu-desktop:~# ps -eaf | grep -e tty -e UID UID PID PPID C STIME TTY TIME CMD root 761 1 0 10:30 tty5 ... (4 Replies)
Discussion started by: crazybisu
4 Replies

7. Shell Programming and Scripting

Preparing a list of spawned processes

Hi All I'm currently trying to develop a script which will find the child processes of a process ID already passed to the script. I then need the script to look for spawned processes of these child processes and so on until it can't find any more. For example At the moment, I have to... (6 Replies)
Discussion started by: huskie69
6 Replies

8. Shell Programming and Scripting

Need to list 3 days old processes

ps -xfu <user name> this command line will list all the process currently running for <user name>. I need to filter this output. I need all the process which are running for more than 3 days(excluding demon/sys process) . The list should include PID, PPID, STIME, process/command. I am using... (20 Replies)
Discussion started by: Sriranga
20 Replies

9. SuSE

List of processes/ which ones to stop

Hi there, I've install a testserver with SLES 11.0! I'll install/test XEN + WebServer not all things at the moment! In a first time, I'd like to stop all unuse processes... but I don't understand all processes! As someone a list of all processes with his signification and which should/could... (3 Replies)
Discussion started by: hiddenshadow
3 Replies

10. AIX

Need a list of top 10 CPU using processes (also top 10 memory hogs, separately)

Okay, I am trying to come up with a multi-platform script to report top ten CPU and memory hog processes, which will be run by our enterprise monitoring application as an auto-action item when the CPU and Memory utilization gets reported as higher than a certain threshold I use top on other... (5 Replies)
Discussion started by: thenomad
5 Replies
Login or Register to Ask a Question