LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-22-2005, 04:39 PM   #1
lordofring
Member
 
Registered: Feb 2005
Posts: 91

Rep: Reputation: 15
Smile signal in the kernel for wait_event_interruptible()


Hello,

My device driver will sleep on wait_event_interruptible() function. With testing, I noticed that it is waked up by a signal.
Code:
if (wait_event_interruptible(my_queue, myCondition) == -ERESTARTSYS)
{
	printk(KERN_ERR "sig[0] is 0x%08x, sig[1] is 0x%08x\n", 
			current->pending.signal.sig[0], 
			current->pending.signal.sig[1]);
	return -ERESTARTSYS;
}
I know that the sig[0] is the normal signal, for example 0x02 is SIGINT for Ctrl-C. In my case, I get: "sig[0] is 0x00000000, sig[1] is 0x00000001" I'm wondering what's in sig[1]? And why are there 2 signals?

The background of my driver:
The driver is for the i2c device which works with interrupt. It's works fine in most time. When I testing it with multithread, very frequency i2c access functions, it receives the unknown (for me ) signal.
The driver is in an embedded system. I debug it through serial port. So only one console for it. And I didn't press any key when it received the unknown signal.

Thanks,

lordofring
 
Old 08-23-2005, 10:11 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Looking at kernel/signal.c, asm/signal.h, and include/signal.h, it appears that this is a bitset stored in multiple words. (See the macro: sigaddset.) There is one bit in this mask for each signal.

There are numerous routines in signal.c that handle it.

Last edited by sundialsvcs; 08-23-2005 at 10:15 AM.
 
Old 08-23-2005, 10:18 AM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"it receives the unknown (for me ) signal"

Here are the signals available in Linux.

http://www.comptechdoc.org/os/linux/...pgsignals.html

------------------------
Steve Stites
 
Old 08-23-2005, 03:14 PM   #4
lordofring
Member
 
Registered: Feb 2005
Posts: 91

Original Poster
Rep: Reputation: 15
I read more about the linux signal. I believe sig[1] is the real time signal. But I still don't know, where and when is the signal sent?
 
  


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
kernel thread and signal handling oriate Linux - General 3 10-18-2005 12:41 PM
question about wait_event_interruptible lordofring Programming 5 08-26-2005 03:04 AM
wait_event_interruptible with timeout lordofring Programming 1 08-17-2005 10:10 PM
wait_event_interruptible - invalid lvalue in unary `&' 7.e.Q Programming 4 11-08-2004 02:00 AM
Signal 6: Unknown Signal <=> Error with MAYA4.X under Linux SOLVED!!!! Faeroon Linux - Software 9 05-09-2003 01:57 PM

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

All times are GMT -5. The time now is 04:40 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