Need help regarding kernel threads
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
Quoted 2 lines · vinay hegde
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.