- Timestamp:
- Aug 27, 2012, 9:08:06 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/sh_unix.h
r408 r409 375 375 #endif 376 376 void sh_set_save_tv(); 377 void sh_set_untraced(int val); 378 int sh_get_untraced(); 377 379 #endif 378 380 … … 394 396 int sh_derr(void) 395 397 { 396 sh_ not_traced = 0;398 sh_set_untraced(0); 397 399 398 400 #ifdef HAVE_GETTIMEOFDAY … … 404 406 raise(SIGTRAP); 405 407 406 if (sh_ not_traced== 0)408 if (sh_get_untraced() == 0) 407 409 _exit(5); 408 410 409 sh_ not_traced = 0;411 sh_set_untraced(0); 410 412 return (0); 411 413 } -
trunk/src/sh_unix.c
r408 r409 5398 5398 */ 5399 5399 #if defined(SCREW_IT_UP) 5400 volatile int sh_not_traced = 0; 5401 5400 struct screw_it_up { 5401 int not_traced; 5402 5402 #ifdef HAVE_GETTIMEOFDAY 5403 struct timeval save_tv; 5404 #endif 5405 }; 5403 5406 5404 5407 #if defined(HAVE_PTHREAD) … … 5412 5415 } 5413 5416 5414 static inline struct timeval * sh_get_save_tv()5417 static inline struct screw_it_up * sh_get_screw_it_up() 5415 5418 { 5416 5419 void * ptr; 5417 struct timeval * save_tv;5420 struct screw_it_up * screw; 5418 5421 5419 5422 (void) pthread_once(&gSaveTv_key_once, make_gSaveTv_key); … … 5421 5424 if ((ptr = pthread_getspecific(gSaveTv_key)) == NULL) 5422 5425 { 5423 ptr = malloc(sizeof(struct timeval));5426 ptr = malloc(sizeof(struct screw_it_up)); 5424 5427 if (ptr) 5425 5428 { 5426 s ave_tv = (struct timeval*) ptr;5429 screw = (struct screw_it_up *) ptr; 5427 5430 (void) pthread_setspecific(gSaveTv_key, ptr); 5428 5431 } … … 5434 5437 else 5435 5438 { 5436 save_tv = (struct timeval*) ptr; 5437 } 5438 return save_tv; 5439 } 5440 5439 screw = (struct screw_it_up *) ptr; 5440 } 5441 return screw; 5442 } 5443 5444 #ifdef HAVE_GETTIMEOFDAY 5441 5445 void sh_set_save_tv() 5442 5446 { 5443 struct timeval * save_tv = sh_get_save_tv(); 5447 struct screw_it_up * screw = sh_get_screw_it_up(); 5448 struct timeval * save_tv = &(screw->save_tv); 5444 5449 if (save_tv) 5445 5450 gettimeofday(save_tv, NULL); 5446 5451 return; 5447 5452 } 5453 struct timeval * sh_get_save_tv() 5454 { 5455 struct screw_it_up * screw = sh_get_screw_it_up(); 5456 struct timeval * save_tv = &(screw->save_tv); 5457 return save_tv; 5458 } 5459 /* #ifdef HAVE_GETTIMEOFDAY */ 5460 #endif 5461 5462 void sh_set_untraced(int val) 5463 { 5464 struct screw_it_up * screw = sh_get_screw_it_up(); 5465 5466 screw->not_traced = val; 5467 return; 5468 } 5469 int sh_get_untraced() 5470 { 5471 struct screw_it_up * screw = sh_get_screw_it_up(); 5472 5473 return screw->not_traced; 5474 } 5448 5475 5449 5476 /* !defined(HAVE_PTHREAD) */ 5450 5477 #else 5451 5478 5479 #ifdef HAVE_GETTIMEOFDAY 5452 5480 static struct timeval * sSaveTv = NULL; 5453 5454 5481 static inline struct timeval * sh_get_save_tv() 5455 5482 { … … 5460 5487 gettimeofday(sSaveTv, NULL); 5461 5488 } 5462 #endif5463 5464 5489 /* #ifdef HAVE_GETTIMEOFDAY */ 5465 5490 #endif 5491 5492 volatile int sh_not_traced = 0; 5493 void sh_set_untraced(int val) 5494 { 5495 sh_not_traced = val; 5496 return; 5497 } 5498 int sh_get_untraced() 5499 { 5500 return sh_not_traced; 5501 } 5502 5503 #endif 5504 5466 5505 5467 5506 void sh_sigtrap_handler (int signum) … … 5479 5518 raise(SIGKILL); 5480 5519 #endif 5481 sh_ not_traced += signum;5520 sh_set_untraced(signum); 5482 5521 return; 5483 5522 }
Note:
See TracChangeset
for help on using the changeset viewer.