Re: Why I could not catch the signals on HP_UX?

From: Sandy (whoknowsace_at_yahoo.com)
Date: 06/28/05


Date: 28 Jun 2005 10:11:19 -0700

Thanks for all your suggestions.

I have set the following signals in the main() :

void setSignals()
{
  int signum;
  struct sigaction vec;

  for (signum = 1; signum <= NSIG; signum++)
  {
     (void) signal(signum, SIG_IGN);
  }

  sigemptyset( &vec.sa_mask );
  sigaddset( &vec.sa_mask, SIGCHLD );
  vec.sa_flags = 0;
  vec.sa_handler = serverExitSignalHandler
  /** CAPTURE TERMINAL SIGNAL EVENTS **/
  if (sigaction(SIGTERM,&vec,NULL) == -1 ||
  #if defined(SIGEMT_SUPPORTED)
      sigaction(SIGEMT,&vec,NULL) == -1 ||
  #endif /* defined(SIGEMT_SUPPORTED) */
      sigaction(SIGFPE,&vec,NULL) == -1 ||
      sigaction(SIGILL,&vec,NULL) == -1 ||
      sigaction(SIGPIPE,&vec,NULL) == -1 ||
      sigaction(SIGALRM,&vec,NULL) == -1 ||
      sigaction(SIGINT,&vec,NULL) == -1 ||
      sigaction(SIGPOLL,&vec,NULL) == -1 ||
      sigaction(SIGPROF,&vec,NULL) == -1 ||
      sigaction(SIGUSR2,&vec,NULL) == -1 ||
      sigaction(SIGVTALRM,&vec,NULL) == -1 ||
      sigaction(SIGQUIT,&vec,NULL) == -1 ||
      //sigaction(SIGBUS,&vec,NULL) == -1 ||
      //sigaction(SIGSEGV,&vec,NULL) == -1 ||
      sigaction(SIGSYS,&vec,NULL) == -1)
      /*sigaction(SIGCHLD,&vec,NULL) == -1 )*/
  {
    exit (1);
  }

  // Handle special case of SIGSEGV and SIGBUS when it occurs in
NotifyObservers

    vec.sa_handler = notExitSigHandler;
    if ( sigaction(SIGBUS,&vec,NULL) == -1 ||
         sigaction(SIGSEGV, &vec, NULL) == -1 ||
         sigaction(SIGABRT, &vec, NULL) == -1 ||
         sigaction(SIGHUP, &vec, NULL) == -1)
    {
       exit(1);
    }

  vec.sa_handler=dbgHandler;
  if (sigaction(SIGUSR1,&vec,NULL) == -1)
  {
    exit (1);
  }
}

The callback is on anther thread, but I tried to do a raise(SIGSEGV) in
the server's call back function just to test if the server can catch
the signal. I found it get and the notExitSigHandler() is called. But
in real case, which mean when I call the callback using the client's
invalid object, the server is terminated without catching any signal
first.

The callback is a CORBA callback, Sometimes, I got a CORBA exception,
but not always. (I think it is a bug in CORBA.), other times, I have
the problem that I described above. I am trying to cover that problem
in my code by catching the signal and redirect it to my handler instead
of the system default handler. I want the code to continue to do
callback to other clients in the list instead of just terminates the
process. So the notExitSigHandler is to throw an exception to the
server's callback function... But since I can not catch this signal, I
can not do anything about it.

Thanks
Sandy



Relevant Pages

  • Re: Why I could not catch the signals on HP_UX?
    ... In thread 2, the server ... > callback, the object that the server uses to make callback is invalid. ... > possible signals in my signal handler, but I did not catch anything, ...
    (comp.sys.hp.hpux)
  • Re: cn_queue.c
    ... >> What on earth are all these barriers for? ... signals which that task might have had pending. ... > from irq context, which may race with the callback adding/removing. ...
    (Linux-Kernel)
  • Signal callback
    ... I understand that this callback is done independent of the process state ... That means that signals create a kind of PID internal multitasking. ...
    (comp.os.linux.embedded)
  • Re: Why I could not catch the signals on HP_UX?
    ... The two privates threads are spawned internaly, Private thread ... >registered with the server. ... HPUX is strictly POSIX compilant when it comes to signals and threads, ... >callback, the object that the server uses to make callback is invalid. ...
    (comp.sys.hp.hpux)
  • Re: Why I could not catch the signals on HP_UX?
    ... >The callback is on anther thread, but I tried to do a raisein ... >the server's call back function just to test if the server can catch ... which mean when I call the callback using the client's ... Catching signals like SIGSEGV or SIGBUS is of limited value, ...
    (comp.sys.hp.hpux)