OC Systems

Home | Contact | Advanced Search 

Technology

Using Solaris GNAT, I want to send a signal to the program to control my probes. But the signal seems to get lost. Why?

It turns out that GNAT blocks this signal with a call to thr_sigsetmask. The following probe can be added to your existing probes to unmask this signal. This works by intercepting the thr_sigsetmask function, and, if the caller is requesting to add or set the signals, removing the SIGUSR1 from the mask they provide.

#include <signal.h>
#include <thread.h>
probe thread
{
  probe "thr_sigsetmask()" in "libthread.so"
  {
    on_entry
    {
      sigset_t *NewSigset;

      // Do we have new signals or
      // is this just a request for info?
      NewSigset = (sigset_t *) $2;
      if (NewSigset)
      {
        // What sort?
        if ($1 == SIG_BLOCK || $1 == SIG_SETMASK)
        {
          // Remove SIGUSR1
          sigdelset (NewSigset, SIGUSR1);
        }
      }
    }
  }
}

Aprobe Technology Overview

Schedule a web demo

Contact us