Changeset 913 in Sophya for trunk/SophyaLib/SysTools/psighand.cc
- Timestamp:
- Apr 13, 2000, 5:58:41 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/psighand.cc
r706 r913 9 9 static bool sigprstate[6] = {false, false, false, false, false, false}; 10 10 11 void PeidaProcessSignal(int s);11 void SophyaProcessSignal(int s); 12 12 13 13 /* Nouvelle-Fonction */ 14 void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2) 14 /*!\ingroup SysTools 15 Configures signal handling. When the flag is true, an exception 16 \b CaughtSignalExc is thrown with the excpetion id set to the 17 signal id. With the flag is false, the default signal handling 18 is restored. 19 \param cfpe : Floating point exception \c SIGFPE 20 \param csegv : Segmentation fault \c SIGSEGV 21 \param cint : Interrupt signal \c SIGINT 22 \param cquit : Quit signal \c SIGINT 23 \param cusr1 : User signal 1 \c SIGUSR1 24 \param cusr2 : User signal 1 \c SIGUSR2 25 */ 26 void SOPHYA::SophyaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2) 15 27 { 16 28 struct sigaction ae, ad; 17 29 18 ae.sa_handler = PeidaProcessSignal;30 ae.sa_handler = SophyaProcessSignal; 19 31 ad.sa_handler = SIG_DFL; 20 32 memset( &(ae.sa_mask), 0, sizeof(sigset_t) ); … … 31 43 if (cfpe) { 32 44 sigaction(SIGFPE, &ae, NULL); 33 puts(" PeidaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ...");45 puts("SophyaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ..."); 34 46 } 35 47 else { 36 48 sigaction(SIGFPE, &ad, NULL); 37 puts(" PeidaConfigureSignalhandling(): Back to default SIGFPE handling ...");49 puts("SophyaConfigureSignalhandling(): Back to default SIGFPE handling ..."); 38 50 } 39 51 sigprstate[0] = cfpe; … … 43 55 if (csegv) { 44 56 sigaction(SIGSEGV, &ae, NULL); 45 puts(" PeidaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ...");57 puts("SophyaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ..."); 46 58 } 47 59 else { 48 60 sigaction(SIGSEGV, &ad, NULL); 49 puts(" PeidaConfigureSignalhandling(): Back to default SIGSEGV handling ...");61 puts("SophyaConfigureSignalhandling(): Back to default SIGSEGV handling ..."); 50 62 } 51 63 sigprstate[1] = csegv; … … 56 68 if (cint) { 57 69 sigaction(SIGINT, &ae, NULL); 58 puts(" PeidaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ...");70 puts("SophyaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ..."); 59 71 } 60 72 else { 61 73 sigaction(SIGINT, &ad, NULL); 62 puts(" PeidaConfigureSignalhandling(): Back to default SIGINT handling ...");74 puts("SophyaConfigureSignalhandling(): Back to default SIGINT handling ..."); 63 75 } 64 76 sigprstate[2] = cint; … … 69 81 if (cquit) { 70 82 sigaction(SIGQUIT, &ae, NULL); 71 puts(" PeidaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ...");83 puts("SophyaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ..."); 72 84 } 73 85 else { 74 86 sigaction(SIGQUIT, &ad, NULL); 75 puts(" PeidaConfigureSignalhandling(): Back to default SIGQUIT handling ...");87 puts("SophyaConfigureSignalhandling(): Back to default SIGQUIT handling ..."); 76 88 } 77 89 sigprstate[3] = cquit; … … 82 94 if (cusr1) { 83 95 sigaction(SIGUSR1, &ae, NULL); 84 puts(" PeidaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ...");96 puts("SophyaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ..."); 85 97 } 86 98 else { 87 99 sigaction(SIGUSR1, &ad, NULL); 88 puts(" PeidaConfigureSignalhandling(): Back to default SIGUSR1 handling ...");100 puts("SophyaConfigureSignalhandling(): Back to default SIGUSR1 handling ..."); 89 101 } 90 102 sigprstate[4] = cusr1; … … 94 106 if (cusr2) { 95 107 sigaction(SIGUSR2, &ae, NULL); 96 puts(" PeidaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ...");108 puts("SophyaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ..."); 97 109 } 98 110 else { 99 111 sigaction(SIGUSR2, &ad, NULL); 100 puts(" PeidaConfigureSignalhandling(): Back to default SIGUSR2 handling ...");112 puts("SophyaConfigureSignalhandling(): Back to default SIGUSR2 handling ..."); 101 113 } 102 114 sigprstate[5] = cusr2; … … 104 116 } 105 117 /* Nouvelle-Fonction */ 106 void PeidaProcessSignal(int s)118 void SophyaProcessSignal(int s) 107 119 { 108 120 string msg; … … 110 122 { 111 123 case SIGFPE : 112 puts(" PeidaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###");124 puts("SophyaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###"); 113 125 msg = "Caught SIGFPE"; 114 126 throw ( CaughtSignalExc(msg, s) ); 115 127 case SIGSEGV : 116 puts(" PeidaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###");128 puts("SophyaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###"); 117 129 msg = "Caught SIGSEGV"; 118 130 throw ( CaughtSignalExc(msg, s) ); 119 131 case SIGINT : 120 puts(" PeidaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###");132 puts("SophyaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###"); 121 133 msg = "Caught SIGINT"; 122 134 throw ( CaughtSignalExc(msg, s) ); 123 135 case SIGQUIT : 124 puts(" PeidaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###");136 puts("SophyaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###"); 125 137 msg = "Caught SIGQUIT"; 126 138 throw ( CaughtSignalExc(msg, s) ); 127 139 case SIGUSR1 : 128 puts(" PeidaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###");140 puts("SophyaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###"); 129 141 msg = "Caught SIGUSR1"; 130 142 throw ( CaughtSignalExc(msg, s) ); 131 143 case SIGUSR2 : 132 puts(" PeidaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###");144 puts("SophyaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###"); 133 145 msg = "Caught SIGUSR2"; 134 146 throw ( CaughtSignalExc(msg, s) ); 135 147 default : 136 printf(" PeidaProcessSignal: ###Signal %d catched, throw inconsistentErr ### \n", s);148 printf("SophyaProcessSignal: ###Signal %d catched, throw inconsistentErr ### \n", s); 137 149 msg = "Caught SIG???"; 138 150 throw ( CaughtSignalExc(msg, s) );
Note:
See TracChangeset
for help on using the changeset viewer.