Changeset 480 in Sophya for trunk/SophyaLib/SysTools/psighand.cc


Ignore:
Timestamp:
Oct 20, 1999, 12:25:32 PM (26 years ago)
Author:
ansari
Message:

MAJ / PEIDA 3.8 , Reza 20/10/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SysTools/psighand.cc

    r245 r480  
    55#include <signal.h>
    66#include "psighand.h"
    7 #include "pexceptions.h" 
     7#include "pexceptions.h"
    88
    9 using namespace PlanckDPC;
    10 
    11 static bool sigprstate[5] = {false, false, false, false};
     9static bool sigprstate[6] = {false, false, false, false, false, false};
    1210
    1311void PeidaProcessSignal(int s);
    1412
    1513/* Nouvelle-Fonction */
    16 void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool cquit, bool cusr1, bool cusr2)
     14void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2)
    1715{
    1816  struct sigaction ae, ad;
     
    5351    sigprstate[1] = csegv;
    5452    }
     53
     54// SIGINT
     55  if (sigprstate[2] != cint) {
     56    if (cquit)   {
     57      sigaction(SIGINT, &ae, NULL);
     58      puts("PeidaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ...");
     59      }
     60    else  {
     61      sigaction(SIGINT, &ad, NULL);
     62      puts("PeidaConfigureSignalhandling(): Back to default SIGINT handling ...");
     63      }
     64    sigprstate[2] = cint;
     65    }
     66 
    5567// SIGQUIT
    56   if (sigprstate[2] != cquit) {
     68  if (sigprstate[3] != cquit) {
    5769    if (cquit)   {
    5870      sigaction(SIGQUIT, &ae, NULL);
     
    6375      puts("PeidaConfigureSignalhandling(): Back to default SIGQUIT handling ...");
    6476      }
    65     sigprstate[2] = cquit;
     77    sigprstate[3] = cquit;
    6678    }
    6779 
    6880// SIGUSR1
    69   if (sigprstate[3] != cusr1) {
     81  if (sigprstate[4] != cusr1) {
    7082    if (cusr1)   {
    7183      sigaction(SIGUSR1, &ae, NULL);
     
    7688      puts("PeidaConfigureSignalhandling(): Back to default SIGUSR1 handling ...");
    7789      }
    78     sigprstate[3] = cusr1;
     90    sigprstate[4] = cusr1;
    7991    }
    80 // SIGUSR1
    81   if (sigprstate[4] != cusr2) {
     92// SIGUSR2
     93  if (sigprstate[5] != cusr2) {
    8294    if (cusr2)   {
    8395      sigaction(SIGUSR2, &ae, NULL);
     
    88100      puts("PeidaConfigureSignalhandling(): Back to default SIGUSR2 handling ...");
    89101      }
    90     sigprstate[4] = cusr2;
     102    sigprstate[5] = cusr2;
    91103    }   
    92104}
     
    94106void PeidaProcessSignal(int s)
    95107{
     108string msg;
    96109switch(s)
    97110  {
    98111  case SIGFPE :
    99112    puts("PeidaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###");
    100     throw CaughtSignalExc("SIGFPE");
     113    msg = "Caught SIGFPE";
     114    throw ( CaughtSignalExc(msg, s) );
    101115  case SIGSEGV :
    102116    puts("PeidaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###");
    103     throw CaughtSignalExc("SIGSEGV");
     117    msg = "Caught SIGSEGV";
     118    throw ( CaughtSignalExc(msg, s) );
    104119  case SIGINT :
    105120    puts("PeidaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###");
    106     throw CaughtSignalExc("SIGINT");
     121    msg = "Caught SIGINT";
     122    throw ( CaughtSignalExc(msg, s) );
    107123  case SIGQUIT :
    108124    puts("PeidaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###");
    109     throw CaughtSignalExc("SIGQUIT");
     125    msg = "Caught SIGQUIT";
     126    throw ( CaughtSignalExc(msg, s) );
    110127  case SIGUSR1 :
    111128    puts("PeidaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###");
    112     throw CaughtSignalExc("SIGUSR1");
     129    msg = "Caught SIGUSR1";
     130    throw ( CaughtSignalExc(msg, s) );
    113131  case SIGUSR2 :
    114132    puts("PeidaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###");
    115     throw CaughtSignalExc("SIGUSR2");
     133    msg = "Caught SIGUSR2";
     134    throw ( CaughtSignalExc(msg, s) );
    116135  default :
    117136    printf("PeidaProcessSignal: ###Signal %d catched, throw  inconsistentErr ### \n", s);
    118     throw CaughtSignalExc("???");
     137    msg = "Caught SIG???";
     138    throw ( CaughtSignalExc(msg, s) );
    119139  }
     140
     141// return;
    120142}
Note: See TracChangeset for help on using the changeset viewer.