Problem of signal loss

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,


Of the existing active mailing lists, I thought this is the list where I can get help on my problem.

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). In fact, 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. It is to be noted that if a SIGUSR1 is raised before SIGUSR2, the behaviour is normal. 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_USR2();
       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();
   }
}

_________________________________________________________________
Mobile, masti, magic! Cool ringtones & logos. http://www.msn.co.in/mobile/ Get noticed.


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux