LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Catch signal from userspace to kernel space (https://www.linuxquestions.org/questions/programming-9/catch-signal-from-userspace-to-kernel-space-4175523269/)

XDimensioN 10-24-2014 04:56 PM

Catch signal from userspace to kernel space
 
Hi

I am a newbie and I was wondering how to handle a signal send to a process using my kernel module driver. I programmed a char driver, so to test it, I used both the commands echo and cat, this works fine but the problem is that when the cat command blocks (for this case I used the wait_queue)waiting for new data to read. The problem is that I can't kill the process (I used kill command and Ctrl-C). So how can I handle a signal in my module ?

Thanks in advance.

mina86 10-27-2014 05:34 AM

You want wait_event_interruptible, e.g.:

Code:

if (wait_event_interruptible(wq, condition))
        return -EINTR;



All times are GMT -5. The time now is 03:09 PM.