Re: how to add signal handler to kernel thread?

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

 



On Thu, May 30, 2002 at 11:55:52AM +0100, venugopal panchamukhi wrote:
> Hi,
>    Could anyone let me know the procedure to add a signal handler for a kernel thread which is created using kernel_thread().

AFAIK signals are delivered only on exit from kernel mode (which happens
either at the end of a syscall or after interrupt (which may have caused
the signal), scheduling being a special case of this. Since kernel
thread never leaves a kernel mode, the code to run signal handlers is
never executed. You have to check for current->signals every time you
wake up and if there is a signal, handle it. You will find all relevant
data about the signal somewhere in current. Of course you want to make
sure you sleep in TASK_INTPERRUPTIBLE state so you get scheduled when
signal arrives.

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
--
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