LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-24-2014, 04:56 PM   #1
XDimensioN
Member
 
Registered: Dec 2013
Posts: 34

Rep: Reputation: Disabled
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.
 
Old 10-27-2014, 05:34 AM   #2
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
You want wait_event_interruptible, e.g.:

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

Last edited by mina86; 10-27-2014 at 05:37 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Kernel space time and compare to userspace to calculate difference? sindhu4sind Programming 1 06-05-2012 12:09 PM
[SOLVED] copy_from/to_user how to use it simply to get pid into kernel space from userspace? sindhu4sind Linux - Newbie 3 05-24-2012 04:10 AM
Taking keyboard driver from userspace to kernel space. sunr2007 Linux - Kernel 0 05-15-2009 04:25 AM
Can we register a userspace funtion as a callback to kernel space? duyuyang Linux - Kernel 0 12-20-2008 12:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration