Re: Kernel Thread and Kernel Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

Thanks for your reply. 

>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.

I fully agree that this can be achieved very easily
from user space. But I want to get into kernel
programming and example which I have taken doesnot
suits much but for begineer, it will be good fun.

>To iterate over the current tasks on the system:
> struct task_struct *task;

Thanks for you link. It is very nice and effective.

Regards
Dinesh


--- Daniel Bonekeeper <thehazard@xxxxxxxxx> wrote:

> 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.
> 



		
__________________________________________________________
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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux