Changeset 1e8e9c in git
- Timestamp:
- Apr 22, 2005, 10:36:51 AM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 511c38c15926b98d83960bcfb7caea8f43aad986
- Parents:
- 571fd10a7ece4806fc608f75612b18cdd3879808
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/cntrlc.cc
r571fd1 r1e8e9c 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: cntrlc.cc,v 1.4 2 2004-11-09 14:54:21 Singular Exp $ */4 /* $Id: cntrlc.cc,v 1.43 2005-04-22 08:36:51 krueger Exp $ */ 5 5 /* 6 6 * ABSTRACT - interupt handling … … 41 41 42 42 #ifdef unix 43 #ifndef hpux 44 #include <unistd.h> 45 #include <sys/types.h> 46 47 #ifdef TIME_WITH_SYS_TIME 48 # include <time.h> 49 # ifdef HAVE_SYS_TIME_H 50 # include <sys/time.h> 51 # endif 52 #else 53 # ifdef HAVE_SYS_TIME_H 54 # include <sys/time.h> 55 # else 43 # ifndef hpux 44 # include <unistd.h> 45 # include <sys/types.h> 46 47 # ifdef TIME_WITH_SYS_TIME 56 48 # include <time.h> 57 # endif 58 #endif 59 #ifdef HAVE_SYS_TIMES_H 60 #include <sys/times.h> 61 #endif 62 63 #define INTERACTIVE 0 64 #define STACK_TRACE 1 65 #ifdef CALL_GDB 49 # ifdef HAVE_SYS_TIME_H 50 # include <sys/time.h> 51 # endif 52 # else 53 # ifdef HAVE_SYS_TIME_H 54 # include <sys/time.h> 55 # else 56 # include <time.h> 57 # endif 58 # endif 59 # ifdef HAVE_SYS_TIMES_H 60 # include <sys/times.h> 61 # endif 62 63 # define INTERACTIVE 0 64 # define STACK_TRACE 1 65 # ifdef CALL_GDB 66 66 static void debug (int); 67 67 static void debug_stop (char **); 68 # endif69 # ifndef __OPTIMIZE__68 # endif 69 # ifndef __OPTIMIZE__ 70 70 static void stack_trace (char **); 71 71 static void stack_trace_sigchld (int); 72 # endif73 # endif74 #endif 72 # endif 73 # endif /* !hpux */ 74 #endif /* unix */ 75 75 76 76 /* data */ … … 85 85 #ifndef MSDOS 86 86 /* signals are not implemented in DJGCC */ 87 # ifndef macintosh87 # ifndef macintosh 88 88 /* signals are not right implemented in macintosh */ 89 89 void sigint_handler(int sig); 90 # endif90 # endif /* !macintosh */ 91 91 #endif 92 92 93 93 #if defined(linux) && defined(__i386__) 94 # if defined(HAVE_SIGCONTEXT) || defined(HAVE_ASM_SIGCONTEXT_H)95 # include <asm/sigcontext.h>96 # else94 # if defined(HAVE_SIGCONTEXT) || defined(HAVE_ASM_SIGCONTEXT_H) 95 # include <asm/sigcontext.h> 96 # else 97 97 struct sigcontext_struct { 98 98 unsigned short gs, __gsh; … … 119 119 unsigned long cr2; 120 120 }; 121 # endif121 # endif 122 122 typedef struct sigcontext_struct sigcontext; 123 123 … … 134 134 (int)s.eip,(int)s.cr2,siRandomStart); 135 135 } 136 # ifdef __OPTIMIZE__136 # ifdef __OPTIMIZE__ 137 137 if(si_restart<3) 138 138 { … … 142 142 longjmp(si_start_jmpbuf,1); 143 143 } 144 # endif145 # ifdef CALL_GDB144 # endif 145 # ifdef CALL_GDB 146 146 if (sig!=SIGINT) debug(INTERACTIVE); 147 # endif147 # endif 148 148 exit(0); 149 149 } … … 158 158 } 159 159 160 # ifdef PAGE_TEST161 # ifndef PAGE_INTERRUPT_TIME162 # define PAGE_INTERRUPT_TIME 1163 # endif160 # ifdef PAGE_TEST 161 # ifndef PAGE_INTERRUPT_TIME 162 # define PAGE_INTERRUPT_TIME 1 163 # endif 164 164 void sig11_handler(int sig, sigcontext s) 165 165 { … … 191 191 signal(SIGVTALRM,(si_hdl_typ)sigalarm_handler); 192 192 } 193 # endif193 # endif /* PAGE_TEST */ 194 194 195 195 /*2 … … 199 199 { 200 200 /*4 signal handler: linux*/ 201 # ifdef PAGE_TEST201 # ifdef PAGE_TEST 202 202 signal(SIGSEGV,(si_hdl_typ)sig11_handler); 203 203 struct itimerval t,o; … … 209 209 setitimer(ITIMER_VIRTUAL,&t,&o); 210 210 signal(SIGVTALRM,(si_hdl_typ)sigalarm_handler); 211 # else211 # else /* PAGE_TEST */ 212 212 if (SIG_ERR==signal(SIGSEGV,(si_hdl_typ)sigsegv_handler)) 213 213 { 214 214 PrintS("cannot set signal handler for SEGV\n"); 215 215 } 216 # endif216 # endif /* PAGE_TEST */ 217 217 if (SIG_ERR==signal(SIGFPE, (si_hdl_typ)sigsegv_handler)) 218 218 { … … 235 235 } 236 236 237 #else 238 # ifdef SPARC_SUNOS_4237 #else /* linux && __i386__ */ 238 # ifdef SPARC_SUNOS_4 239 239 /*2 240 240 * signal handler for run time errors, sparc sunos 4 version … … 250 250 (int)addr,siRandomStart); 251 251 } 252 # ifdef __OPTIMIZE__252 # ifdef __OPTIMIZE__ 253 253 if(si_restart<3) 254 254 { … … 258 258 longjmp(si_start_jmpbuf,1); 259 259 } 260 # endif261 # ifdef CALL_GDB260 # endif /* __OPTIMIZE__ */ 261 # ifdef CALL_GDB 262 262 if (sig!=SIGINT) debug(STACK_TRACE); 263 # endif263 # endif /* CALL_GDB */ 264 264 exit(0); 265 265 } … … 279 279 signal(SIGCHLD, (void (*)(int))SIG_IGN); 280 280 } 281 # else281 # else /* SPARC_SUNOS_4 */ 282 282 283 283 /*2 284 284 * signal handler for run time errors, general version 285 285 */ 286 # ifndef macintosh286 # ifndef macintosh 287 287 void sigsegv_handler(int sig) 288 288 { … … 295 295 siRandomStart); 296 296 } 297 # ifdef __OPTIMIZE__297 # ifdef __OPTIMIZE__ 298 298 if(si_restart<3) 299 299 { … … 303 303 longjmp(si_start_jmpbuf,1); 304 304 } 305 # endif306 # ifdef unix307 # ifndef hpux305 # endif /* __OPTIMIZE__ */ 306 # ifdef unix 307 # ifndef hpux 308 308 /* debug(..) does not work under HPUX (because ptrace does not work..) */ 309 # ifdef CALL_GDB310 # ifndef MSDOS309 # ifdef CALL_GDB 310 # ifndef MSDOS 311 311 if (sig!=SIGINT) debug(STACK_TRACE); 312 # endif313 # endif314 # endif315 # endif312 # endif /* MSDOS */ 313 # endif /* CALL_GDB */ 314 # endif /* !hpux */ 315 # endif /* unix */ 316 316 exit(0); 317 317 } 318 # endif318 # endif /* !macintosh */ 319 319 320 320 /*2 … … 323 323 void init_signals() 324 324 { 325 # ifndef MSDOS325 # ifndef MSDOS 326 326 /* signals are not implemented in DJGCC */ 327 # ifndef macintosh327 # ifndef macintosh 328 328 /* signals are temporaliy removed for macs. */ 329 329 /*4 signal handler:*/ 330 330 signal(SIGSEGV,(void (*) (int))sigsegv_handler); 331 # ifdef SIGBUS331 # ifdef SIGBUS 332 332 signal(SIGBUS, sigsegv_handler); 333 # endif334 # ifdef SIGFPE333 # endif 334 # ifdef SIGFPE 335 335 signal(SIGFPE, sigsegv_handler); 336 # endif337 # ifdef SIGILL336 # endif 337 # ifdef SIGILL 338 338 signal(SIGILL, sigsegv_handler); 339 # endif340 # ifdef SIGIOT339 # endif 340 # ifdef SIGIOT 341 341 signal(SIGIOT, sigsegv_handler); 342 # endif343 # ifdef SIGXCPU342 # endif 343 # ifdef SIGXCPU 344 344 signal(SIGXCPU, (void (*)(int))SIG_IGN); 345 # endif345 # endif 346 346 signal(SIGINT ,sigint_handler); 347 347 signal(SIGCHLD, (void (*)(int))SIG_IGN); 348 # endif349 # endif348 # endif 349 # endif 350 350 } 351 351 #endif
Note: See TracChangeset
for help on using the changeset viewer.