RE: List of Processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In sched.h file the macro "for_each_process(p)" is defined as follws:

#define for_each_process(p) \
	for (p = &init_task; (p = next_task(p)) != &init_task; )

Kernel maintaines the single linked list of "tast_struct" structures to keep track of all running processes, the first element of that is init_task structure which is of task_struct type.

The above defined macro starts from first process and goes through the linked list of all process and ends at the last process in list.

Regards,
Gaurav Dhiman



-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Anupam Kapoor
Sent: Thursday, July 01, 2004 11:01 AM
To: so usp
Cc: kernelnewbies@nl.linux.org
Subject: Re: List of Processes

iirc there is a macro defined already "for_each_process" that you can
use to get all the processes

struct task_struct  *p;

for_each_process (p) {
   ....
}

hth
kind regards
anupam


On Wed, 30 Jun 2004 14:34:00 -0300 (ART), so usp <so_usp@yahoo.com.br> wrote:
> 
> Hi....
> 
> I would like to know which file i can find the struct
> that list  all processes executing in linux...
> 
> Thanks,
> Luis Henrique.
> 
> ______________________________________________________________________
> 
> Yahoo! Mail - agora com 100MB de espaço, anti-spam e antivírus grátis!
> http://br.info.mail.yahoo.com/
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux