From: [email protected] 
[mailto:[email protected]] 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

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to