On 8/5/06, Dinesh Ahuja <mdlinux7@xxxxxxxxxxx> wrote:
Hi All, I want to use Kernel thread in Kernel module. The purpose of Kernel thread is to access task list maintained by Kernel and see if any zombie exists. If zombie exists, it should notify a administrator about this. As per my understanding, I will be able to use kernel_thread in my module as it is exported by a static kernel. But to have an access to task list, I need to export this from kernel and recompile a kernel. Am I right in my understanding. Please let me know about my understanding. Regards Dinesh __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/
Hello Dinesh, First of all, this could be done easily from userspace (in fact, it _should_). You can detect zombies by looking at /proc and send a mail to admin for example, as an action. Notifying the admin from kernelspace is very tricky, since you can't send mails from kernelspace, for a start. If you still want to do this (for educational purposes), To an example on how to create kernel threads you can take a look on this: http://www.kernelnewbies.org/Simple_UDP_Server To iterate over the current tasks on the system: struct task_struct *task; for_each_process(task) { if (task->state == TASK_ZOMBIE) printk("%s[%d] -- HOLD YOUR BRAIN!\n", task->comm, task->pid); } -- What this world needs is a good five-dollar plasma weapon. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/