Re: Need help regarding kernel threads

2005-08-02 Thread Keith Owens
On Tue, 2 Aug 2005 09:57:51 +0100 (BST), 
vinay hegde <[EMAIL PROTECTED]> wrote:
>How to differentiate kernel threads from normal
>processes inside the Linux kernel code? 

The Linux Kernel Debugger (ftp://oss.sgi.com/projects/kdb/download/v4.4)
distinguishes between idle tasks, sleeping system daemons and the rest
(typically user tasks).  An idle task has pid 0, a sleeping system
daemon has a NULL mm field and is in S state, everything else is
treated as a normal task.

Download the latest kdb common patch and look at function
kdb_task_state_char.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Need help regarding kernel threads

2005-08-02 Thread vinay hegde
Hi,

Can sombody help me with the following:

How to differentiate kernel threads from normal
processes inside the Linux kernel code? 

I want to handle all the processes headed by "init_ 
task", in such a way that kernel threads are excluded
in the special processing. But , I am not able to find
out a kernel data structure which helps me in
identifying whether the "task_struct" is a normal
process or a kernel thread.

For ex, if i use the following snippet of code,

 for(p=_task; (p=next_task(p)) != _task;)
 {
printk("%s\n", p->comm);
 } 

it prints all the processes running including kernel
threads(init, keventd, kswapd etc etc). Now, I want to
check whether the "task_struct" is a process or a
kernel thread? 

How do I handle processes seperately from kernel
threads??

Thank you,
Vinay.



___
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for 
FREE! http://in.mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Need help regarding kernel threads

2005-08-02 Thread vinay hegde
Hi,

Can sombody help me with the following:

How to differentiate kernel threads from normal
processes inside the Linux kernel code? 

I want to handle all the processes headed by init_ 
task, in such a way that kernel threads are excluded
in the special processing. But , I am not able to find
out a kernel data structure which helps me in
identifying whether the task_struct is a normal
process or a kernel thread.

For ex, if i use the following snippet of code,

 for(p=init_task; (p=next_task(p)) != init_task;)
 {
printk(%s\n, p-comm);
 } 

it prints all the processes running including kernel
threads(init, keventd, kswapd etc etc). Now, I want to
check whether the task_struct is a process or a
kernel thread? 

How do I handle processes seperately from kernel
threads??

Thank you,
Vinay.



___
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for 
FREE! http://in.mail.yahoo.com
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Need help regarding kernel threads

2005-08-02 Thread Keith Owens
On Tue, 2 Aug 2005 09:57:51 +0100 (BST), 
vinay hegde [EMAIL PROTECTED] wrote:
How to differentiate kernel threads from normal
processes inside the Linux kernel code? 

The Linux Kernel Debugger (ftp://oss.sgi.com/projects/kdb/download/v4.4)
distinguishes between idle tasks, sleeping system daemons and the rest
(typically user tasks).  An idle task has pid 0, a sleeping system
daemon has a NULL mm field and is in S state, everything else is
treated as a normal task.

Download the latest kdb common patch and look at function
kdb_task_state_char.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/