Problem with signal loss in RH

"sakib mondal" <[email protected]> Thu, 03 Jul 2003 09:00:27 +0000
Newsgroups gmane.linux.application
Message-ID <[email protected]>
Hi,

I am facing the problem of intermittent signal loss in RH (2.4.18-3). The 
program runs in a loop, and is able to respond to individual signals 
(SIGUSR1 and SIGUSR2). I checked this through commands "kill -USR1 pid" or 
"kill -USR2 pid". Infact it works well with multiple occurence of the same 
signal. However, if SIGUSR2 is sent after SIGUSR1, the program responds to 
the SIGUSR1, but does not respond to SIGUSR2. I shall appreciate any pointer 
to why this is happening.

Regards
Sakib



The code snippet is given below.

static void signal_handler(int num)
{

    if (signal(num, signal_handler) == SIG_ERR) {
	syserr_quit("Unable to install signal handler");
    }

    switch(num) {
       case SIGUSR1:
	proc_USR1();
	break;
     case SIGUSR2:
	proc_USR1();
	break;
     default:
	log_err("Impossible signal received.");
	break;
    }
}




int main(int argc, char *argv[])
{
....

     if (signal(SIGUSR1, signal_handler) == SIG_ERR) {
	syserr_quit("Unable to install SIGUSR1 handler");
    }

    if (signal(SIGUSR2, signal_handler) == SIG_ERR) {
	syserr_quit("Unable to install SIGUSR2 handler");
    }

    while (1) {
	fd_set fd_read;

	FD_ZERO(&fd_read);
	FD_SET(a_socket, &fd_read);
	while (select(FD_SETSIZE, &fd_read, NULL, NULL, NULL) < 0) {
	    if (errno != EINTR) {
		syslog_err("Error in listening");
	    }
	}
	some_other_function();
    }
}

_________________________________________________________________
Design your holidays. At your convenience. 
http://www.flexihols.com/2003/index.php Click here.

-
To unsubscribe from this list: send the line "unsubscribe linux-apps" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html