getting pids on 2.6

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

 



Hi,

  I'm trying to list all of the tasks and their children.

  The code below does not list all of the code as compared to the /proc entries.

  Why does the following code not list all of the active pids in the system?

  -----------------------




void list_pids(void)
{
    struct task_struct *tp;
    struct list_head   *_p;
    struct list_head   *_n;
    struct task_struct *p;


    read_lock(&tasklist_lock);
    for (tp = &init_task;  (tp = next_task(tp)) != &init_task; ) {
         printk("[parent]  pid =%d    \n" ,tp->pid );
         list_for_each_safe(_p,_n, &tp->children ){
             p = list_entry(_p,struct task_struct,sibling);
             printk("   [child]  pid =%d   \n", p->pid );

         }
    }
    read_unlock(&tasklist_lock);
 return ;
}





		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

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