What was the signal?

Howard the Hacker howard at ukpoit.co.uk
Wed Mar 20 21:36:57 AEST 1991


I have a C program doing a msgrcv(2) which may be interrupted by a SIGALRM. This
is processed by a handler function. On return a failure of msgrcv is found
and found to be due to an interrupt. The question is, will any ignored signal
(ignored by default) also interrupt the msgrcv, and if so is it possible to find
out what the actual signal was? If the signal was not SIGALRM, the msgrcv should
not be tried again, but how can I tell?
  The machine is an NCR Tower 400 running SVR2. The relevant code is:

 while (amountReceived != scrnCtrlSize)
  {
   amountReceived = msgrcv(queueId,&scrnCtrlMessage,scrnCtrlSize, TO_CHILD,0);

   if ((amountReceived == -1) && (errno == EINTR) )
     /* a signal (probably alarm) was received and handled, so try again */
     continue;

   if (amountReceived != scrnCtrlSize)
   /* something went wrong  */
    {
     perror("<screenOp.c>:<156> message receive failed");
     exit(1);
    }
  }

Thanks in advance,
Howard March
howard at ukpoit.co.uk 
Sorry, no .signature, this is my first attempt to send anything.



More information about the Comp.unix.questions mailing list