dear sir
i want to get the information when a thread gets exited from the system .so i wrote some printk at the beginning of do_exit in kernel/exit.c like of tsk->pid.
now as i have to check over there that it is kernel thread or user thread so i am putting a if statement like
if(tsk->flags & CLONE_VM) //for the checking of threads
{
if(tsk->mm==NULL) //for the checking of kernel threads
printk(kernel thread exiting);
else
printk(user thread exiting);
}
but here aises the problem when i have finished compilling the output shows every thread as user.i.e "user thread exiting
that means in somewhere after do_fork in /kernel/fork.c
the p->mm is getting filled in case of kernel thread.
so is there any other way so that i can distinguish between
the user level and kernel level in do_exit()in /kernel/exit.c
or i have to place my sample code in somewhere else
so that i can find the values while terminating the threads with the proper distinction between user level threads and kernel level threads.
if the exit(2) system call uses the do_exit function then we will never be able to know whereabouts the kernel threads so is there any other function which the kernel threads calls before dying
thanks in advance
sounak