Changeset 480 in Sophya for trunk/SophyaLib/SysTools/psighand.cc
- Timestamp:
- Oct 20, 1999, 12:25:32 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/psighand.cc
r245 r480 5 5 #include <signal.h> 6 6 #include "psighand.h" 7 #include "pexceptions.h" 7 #include "pexceptions.h" 8 8 9 using namespace PlanckDPC; 10 11 static bool sigprstate[5] = {false, false, false, false}; 9 static bool sigprstate[6] = {false, false, false, false, false, false}; 12 10 13 11 void PeidaProcessSignal(int s); 14 12 15 13 /* Nouvelle-Fonction */ 16 void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool c quit, bool cusr1, bool cusr2)14 void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2) 17 15 { 18 16 struct sigaction ae, ad; … … 53 51 sigprstate[1] = csegv; 54 52 } 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 55 67 // SIGQUIT 56 if (sigprstate[ 2] != cquit) {68 if (sigprstate[3] != cquit) { 57 69 if (cquit) { 58 70 sigaction(SIGQUIT, &ae, NULL); … … 63 75 puts("PeidaConfigureSignalhandling(): Back to default SIGQUIT handling ..."); 64 76 } 65 sigprstate[ 2] = cquit;77 sigprstate[3] = cquit; 66 78 } 67 79 68 80 // SIGUSR1 69 if (sigprstate[ 3] != cusr1) {81 if (sigprstate[4] != cusr1) { 70 82 if (cusr1) { 71 83 sigaction(SIGUSR1, &ae, NULL); … … 76 88 puts("PeidaConfigureSignalhandling(): Back to default SIGUSR1 handling ..."); 77 89 } 78 sigprstate[ 3] = cusr1;90 sigprstate[4] = cusr1; 79 91 } 80 // SIGUSR 181 if (sigprstate[ 4] != cusr2) {92 // SIGUSR2 93 if (sigprstate[5] != cusr2) { 82 94 if (cusr2) { 83 95 sigaction(SIGUSR2, &ae, NULL); … … 88 100 puts("PeidaConfigureSignalhandling(): Back to default SIGUSR2 handling ..."); 89 101 } 90 sigprstate[ 4] = cusr2;102 sigprstate[5] = cusr2; 91 103 } 92 104 } … … 94 106 void PeidaProcessSignal(int s) 95 107 { 108 string msg; 96 109 switch(s) 97 110 { 98 111 case SIGFPE : 99 112 puts("PeidaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###"); 100 throw CaughtSignalExc("SIGFPE"); 113 msg = "Caught SIGFPE"; 114 throw ( CaughtSignalExc(msg, s) ); 101 115 case SIGSEGV : 102 116 puts("PeidaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###"); 103 throw CaughtSignalExc("SIGSEGV"); 117 msg = "Caught SIGSEGV"; 118 throw ( CaughtSignalExc(msg, s) ); 104 119 case SIGINT : 105 120 puts("PeidaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###"); 106 throw CaughtSignalExc("SIGINT"); 121 msg = "Caught SIGINT"; 122 throw ( CaughtSignalExc(msg, s) ); 107 123 case SIGQUIT : 108 124 puts("PeidaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###"); 109 throw CaughtSignalExc("SIGQUIT"); 125 msg = "Caught SIGQUIT"; 126 throw ( CaughtSignalExc(msg, s) ); 110 127 case SIGUSR1 : 111 128 puts("PeidaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###"); 112 throw CaughtSignalExc("SIGUSR1"); 129 msg = "Caught SIGUSR1"; 130 throw ( CaughtSignalExc(msg, s) ); 113 131 case SIGUSR2 : 114 132 puts("PeidaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###"); 115 throw CaughtSignalExc("SIGUSR2"); 133 msg = "Caught SIGUSR2"; 134 throw ( CaughtSignalExc(msg, s) ); 116 135 default : 117 136 printf("PeidaProcessSignal: ###Signal %d catched, throw inconsistentErr ### \n", s); 118 throw CaughtSignalExc("???"); 137 msg = "Caught SIG???"; 138 throw ( CaughtSignalExc(msg, s) ); 119 139 } 140 141 // return; 120 142 }
Note:
See TracChangeset
for help on using the changeset viewer.