Re: List of Processes

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

 



one small doubt, shouldn't we be acquiring a lock while iterating over
all the tasks ?

anupam

On Thu, 01 Jul 2004 07:20:25 +0000, manish regmi
<manish_regmi@hotmail.com> wrote:
> 
> 
> 
> >>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
> 
> /* sched.h */
> 
> for_each_task(p){
> ...
> }
> 
> :)
> 
> 
> > > Hi....
> > >
> > > I would like to know which file i can find the struct
> > > that list  all processes executing in linux...
> > >
> > > Thanks,
> > > Luis Henrique.
> 
> for_each_task(p)
> {
> ...
> }
> 
> You will each task's descriptor on p on each loop. The first one will be
> that of init. You will automatically break from loop when you finish
> traverse through all tasks.
> Actually a circular list.
> 
> #define for_each_task(p) \
>         for (p = &init_task ; (p = p->next_task) != &init_task ; )
> 
> regards manish
> 
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
> 
>

--
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