signals handling in kernel
Jeff Haran
Jeff.Haran at citrix.com
Fri Aug 14 12:40:48 EDT 2015
From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of KASHISH BHATIA
Sent: Friday, August 14, 2015 6:09 AM
To: Pranay Srivastava
Cc: kernelnewbies
Subject: Re: signals handling in kernel
I want to write a module which will spawn two kthreads where kthread-1 will send signal X to kthread-2 and kthread-2 has registered a signal handler to catch signal X. When the signal X is caught by kthread-2, it will execute its signal handler.
Just am exploring signal handing and its intricacies, so thought of this exercise. Is it possible ?
I think signal handlers of the sort you describe are a feature of user space. If a process (kthread or user space) that is blocked on a call to wait_event_interruptible() is sent a signal, the call to wait_event_interruptible() will return with an –ERESTARTSYS so you can add “signal handler” code there. But I don’t think it’s possible to register a signal handler from kernel space like you can using the signal() or sigaction() systems calls that you can use from user space.
If somebody else thinks different, please do pipe up. This signal stuff in the kernel has always been a bit mysterious to me.
Jeff Haran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150814/0c7cbf3d/attachment.html
More information about the Kernelnewbies
mailing list