Пример #1
0
/**
 * sim_debug_sim_debug_on_signal:
 * @signum:
 *
 */
static void
sim_debug_on_signal (gint signum, siginfo_t * siginfo, gpointer context)
{
  (void)context;
  g_message ("Received signal %d from PID %d, UID %d",
             signum, (gint)siginfo->si_pid, (gint)siginfo->si_uid);

  switch (signum)
  {
	case SIGHUP: //FIXME: reload directives, policy, and so on.
		// reopen log file
		sim_log_reopen();
		break;
	case SIGPIPE:
		g_message ("Error: SIGPIPE in comms");
		break;
	case SIGFPE:
	case SIGILL:
	case SIGABRT:
	case SIGSEGV:
		sim_debug_print_bt ();
		sim_debug_terminate (signum, TRUE);
		break;
	case SIGQUIT:
		sim_debug_terminate (signum, TRUE);
		break;
	case SIGTERM:
      (void)signum; /* Gcc stupidy workaround*/
      (void)siginfo;
      g_main_loop_quit (ossim.main_loop);
	case SIGINT:
		sim_debug_terminate (signum, FALSE);
		break;
	case SIGBUS:
		break;
	case 45: //devel signal! (debug on)
		simCmdArgs.dvl = 666;
		ossim_log_flag = 1;
		break;
	case 46: //devel signal! (debug off)
		simCmdArgs.dvl = 0;
		ossim_log_flag = 0;
		break;
	case 47: //debug on (-D6)
		ossim.log.level = G_LOG_LEVEL_DEBUG;
		ossim_log_flag = 1;
		break;
	case 48: //-D6 off
		ossim.log.level = G_LOG_LEVEL_MESSAGE;
		ossim_log_flag = 0;
		break;
  }
}
Пример #2
0
/**
 * sim_debug_sim_debug_on_signal:
 * @signum:
 *
 */
void 
sim_debug_on_signal (gint signum)
{
	g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: process %d got signal %d", __func__, getpid(), signum);

  switch (signum)
  {
    case SIGHUP: //FIXME: reload directives, policy, and so on.
      // reopen log file
      sim_log_reopen();
      break;
    case SIGPIPE:
      g_message("Error: SIGPIPE in comms");
      break;
    case SIGFPE:
    case SIGILL:
    case SIGABRT:
    case SIGSEGV:
      sim_debug_print_bt();
      sim_debug_terminate(signum, TRUE);
      break;
    case SIGQUIT:
      sim_debug_terminate(signum, TRUE);
      break;
    case SIGTERM:
    case SIGINT:
      sim_debug_terminate(signum, FALSE);
      break;
    case SIGBUS:
      break;
    case SIM_SIGNAL_DEBUG_ON:
      g_message("DEBUG signal on!");
      ossim.log.level = G_LOG_LEVEL_DEBUG;
      break;
    case SIM_SIGNAL_DEBUG_OFF:
      g_message("DEBUG signal off!");
      ossim.log.level = G_LOG_LEVEL_MESSAGE;
      break;
    case SIM_SIGNAL_STATS_ON:
      g_message("STATS signal on!");
      simCmdArgs.dvl = SIM_SHOW_STATS_ON;
      break;
    case SIM_SIGNAL_STATS_OFF:
      g_message("STATS signal off!");
      simCmdArgs.dvl = SIM_SHOW_STATS_OFF;
      break;

    case SIM_SIGNAL_SHOW_RESOURCE_USAGE:
      sim_debug_show_resources();
      break;
  }
}