mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* How do I  get a list of all pids on 2.6? (what's wrong with this code)
@ 2005-01-29 19:13 Jed Brazos
  0 siblings, 0 replies; only message in thread
From: Jed Brazos @ 2005-01-29 19:13 UTC (permalink / raw)
  To: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 960 bytes --]

Hi,

  I'm trying to list all of the tasks and their
children. (Im using a 2.6.5-7 kernel)

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

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

please cc this id.

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




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!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-29 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-29 19:13 How do I get a list of all pids on 2.6? (what's wrong with this code) Jed Brazos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®