LinuxQuestions.org
Review your favorite Linux distribution.
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 04-27-2010, 01:49 AM   #1
cjohn124
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
sem_wait() interrupted by unknown signal


Hi, all:

I have hit a strange problem recently. One server application (nps_linux) exits when the printer (run in WindRiver OS) enters deep sleep mode.

Inspection shows it is due to sem_wait() returns EINTR, which means it is interrupted by some system signal, right?

A simple fix is to put sem_wait() into a loop, and ignore errno EINTR. That works. Still, I want to go one step further, to find out what signal is sent to the service app and ignore it. However, I can't find the signal.

Here is the code snippet and the log:
--------
/* code snippet */
static void signal_handle(int signal_number)
{
LOGINFO("%s(): receive %d\n", __func__, signal_number);
return;
}

int
main( int argc, char *argv[] )
{
...
sigterm_action.sa_handler = &signal_handle;

for(i=1; i<100; i++)
{
sigaction(i, &sigterm_action, NULL);
}
...
if (sem_wait(&gTerminateSemaphore) != 0)
{
LOGERROR("%s(): sem_wait() failed, errno = %i.", __func__, errno);
}

close_down_nest();
...
}

/* log */
<nps_linux> (Mon Apr 26 2010 23:21:57.753) <p3685,t808678736,nps_main.c,716>
ERROR>> main(): sem_wait() failed, errno = 4.
<nps_linux> (Mon Apr 26 2010 23:21:57.753) <p3685,t808678736,nps_main.c,345>
ENTER>> close_down_nest()
--------
What is strange is, when sem_wait() returns with EINTR, no signal is received.

Is it possible? If the service doesn't receive any signal when the system is entering deep sleep, what else can make sem_wait() returns with EINTR?

Confused and looking forward to help,
cjohn124

Last edited by cjohn124; 04-27-2010 at 01:53 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
Is there a bug on sem_wait in 2.6.10 kernel? archieval Linux - Kernel 3 10-15-2007 01:14 AM
system call sem_wait() interrupted uckl_lyk Programming 3 04-22-2006 04:27 PM
Signal 6: Unknown Signal <=> Error with MAYA4.X under Linux SOLVED!!!! Faeroon Linux - Software 9 05-09-2003 01:57 PM
Signal: 6 (Unknown Signal) - Problems running a program Faeroon Linux - Software 86 01-14-2003 12:08 AM

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

All times are GMT -5. The time now is 07:18 PM.

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