On Sat, 2005-05-28 at 00:22, Nivedan Nigam wrote: > Sir, > > I have to call a kernel mode function. actually i have developed my > protocol in kernel mode. i m inserting a modeule through which my > protocol starts. I am not getting the idea of calling my function from > powerfail script. I would like to get an understanding of how your kernel module is organized. You say you are inserting a module through which your protocol starts. What does this protocol do, specifically? Are you starting a kernel thread out of the __init function, are you performing your work within __init, or are you performing work via requests from user space (either via syscall or special file)? Whichever way you are doing things, you will not be able to trap the SIGPWR signal in the kernel, as this signal is specifically directed to the init process (pid=1). Thus the best reliable way to process SIGPWR is to create a means of invoking the function call in your kernel module from user space, either by creating an entry in sysfs or /proc. Alternatively, you could call the function in your module's __exit function and amend the powerfail script to rmmod your module, or you could include a 'kill -PWR ' command to send the signal to your kernel thread, and in your kernel thread call your function. For an example of how to catch a signal in a kernel thread, look in the source file fs/jffs2/background.c at the function jffs2_garbage_collect_thread(). I hope this helps. Thanks, Bob Bennett > > pl help me. by giving a small example. > > Thanks > > Nivedan Nigam > > On Sat, 28 May 2005 Bob Bennett wrote : > > > >Isn't SIGPWR only sent to init? The proper thing to do as far as I > know > >would be to update the /etc/init.d/powerfail script to call a user > mode > >program that will broadcast the packet. You shouldn't need to do > that > > from a kernel module. > > > >Hope that helps, > > Bob Bennett > > > >>On Fri, 2005-05-27 at 08:37, Nivedan Nigam wrote: > > > > > > Hi all, > > > > > > i have written a kernel module to implement a new routing > protocol. it is working fine. i am facing a small problem in catching > signal in my module. > > > > > > Actually i have to catch SIGPWR signal in my module, so that if > this signal triggers then i'll get to know that POWER is gone and i > hv to broadcast a CONTROL PACKET in the network.. > > > > my problem is, how to catch the signal and process it. i want to > call a routine node_status_change(.....) when SIGPWR triggers... > > > can anybody will help me to come out from this problem.... > > > > > > ne suggestion is welcome > > > > > > Thanx in advance > > > > > > Nivedan Nigam > > > MTech CSE > > > IIT Guwahati > > > India > > > > > > > > > > > > > > > > > > > > > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/