Changeset 751785e in git


Ignore:
Timestamp:
Jan 14, 2013, 8:16:56 PM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
d9947d272d574a169450505d43dc8ad3a5b4d0f0
Parents:
c251308665e937dc7f552d6681c2010dcdf1debb
Message:
chg: signal handlers, p1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/cntrlc.cc

    rc25130 r751785e  
    2525#include <kernel/polys.h>
    2626#include <kernel/febase.h>
     27void sig_chld_hdl(int sig); /*#include <Singular/links/ssiLink.h>*/
    2728
    2829#include "tok.h"
     
    3536/* undef, if you don't want GDB to come up on error */
    3637
    37 #if !defined(__alpha)
    38 #define CALL_GDB
    39 #endif
    40 
    4138#if defined(__OPTIMIZE__) && defined(CALL_GDB)
    4239#undef CALL_GDB
    4340#endif
    4441
    45 #if defined(unix) && !defined(hpux)
     42#if defined(unix)
    4643 #include <unistd.h>
    4744 #include <sys/types.h>
     
    231228}
    232229
    233 /*2
    234 * init signal handlers, linux/i386 version
    235 */
    236 void init_signals()
    237 {
    238 /*4 signal handler: linux*/
    239   if (SIG_ERR==si_set_signal(SIGSEGV,(si_hdl_typ)sigsegv_handler))
    240   {
    241     PrintS("cannot set signal handler for SEGV\n");
    242   }
    243   if (SIG_ERR==si_set_signal(SIGFPE, (si_hdl_typ)sigsegv_handler))
    244   {
    245     PrintS("cannot set signal handler for FPE\n");
    246   }
    247   if (SIG_ERR==si_set_signal(SIGILL, (si_hdl_typ)sigsegv_handler))
    248   {
    249     PrintS("cannot set signal handler for ILL\n");
    250   }
    251   if (SIG_ERR==si_set_signal(SIGIOT, (si_hdl_typ)sigsegv_handler))
    252   {
    253     PrintS("cannot set signal handler for IOT\n");
    254   }
    255   if (SIG_ERR==si_set_signal(SIGINT ,(si_hdl_typ)sigint_handler))
    256   {
    257     PrintS("cannot set signal handler for INT\n");
    258   }
    259   si_set_signal(SIGCHLD, (si_hdl_typ)sig_chld_hdl);
    260   si_set_signal(SIGPIPE, (si_hdl_typ)sig_pipe_hdl);
    261   si_set_signal(SIGTERM, (si_hdl_typ)sig_term_hdl);
    262 }
    263 
    264230/*---------------------------------------------------------------------*/
    265231#elif defined(SunOS) /*SPARC_SUNOS*/
     
    292258  exit(0);
    293259}
    294 
    295 /*2
    296 * init signal handlers, sparc sunos 4 version
    297 */
    298 void init_signals()
    299 {
    300 /*4 signal handler:*/
    301   si_set_signal(SIGSEGV,sigsegv_handler);
    302   si_set_signal(SIGBUS, sigsegv_handler);
    303   si_set_signal(SIGFPE, sigsegv_handler);
    304   si_set_signal(SIGILL, sigsegv_handler);
    305   si_set_signal(SIGIOT, sigsegv_handler);
    306   si_set_signal(SIGINT ,sigint_handler);
    307   si_set_signal(SIGCHLD, (void (*)(int))SIG_IGN);
    308   si_set_signal(SIGPIPE, (si_hdl_typ)sig_pipe_hdl);
    309 }
    310260#else
    311261
     
    334284  }
    335285  #endif /* __OPTIMIZE__ */
    336   #if defined(unix) && !defined(hpux)
     286  #if defined(unix)
    337287  /* debug(..) does not work under HPUX (because ptrace does not work..) */
    338288  #ifdef CALL_GDB
     
    341291  #endif /* unix */
    342292  exit(0);
    343 }
    344 
    345 /*2
    346 * init signal handlers, general version
    347 */
    348 void init_signals()
    349 {
    350 /*4 signal handler:*/
    351   si_set_signal(SIGSEGV,(void (*) (int))sigsegv_handler);
    352   #ifdef SIGBUS
    353   si_set_signal(SIGBUS, sigsegv_handler);
    354   #endif /* SIGBUS */
    355   #ifdef SIGFPE
    356   si_set_signal(SIGFPE, sigsegv_handler);
    357   #endif /* SIGFPE */
    358   #ifdef SIGILL
    359   si_set_signal(SIGILL, sigsegv_handler);
    360   #endif /* SIGILL */
    361   #ifdef SIGIOT
    362   si_set_signal(SIGIOT, sigsegv_handler);
    363   #endif /* SIGIOT */
    364   #ifdef SIGXCPU
    365   si_set_signal(SIGXCPU, (void (*)(int))SIG_IGN);
    366   #endif /* SIGIOT */
    367   si_set_signal(SIGINT ,sigint_handler);
    368   #if defined(HPUX_9) || defined(HPUX_10)
    369   si_set_signal(SIGCHLD, (void (*)(int))SIG_IGN);
    370   #endif
    371   si_set_signal(SIGPIPE, (si_hdl_typ)sig_pipe_hdl);
    372293}
    373294#endif
     
    468389
    469390#ifdef unix
    470 # ifndef hpux
    471391#  ifndef __OPTIMIZE__
    472392int si_stop_stack_trace_x;
     
    586506    tv.tv_usec = 0;
    587507
    588 #    ifdef hpux
    589     sel = select (FD_SETSIZE, (int *)readset.fds_bits, NULL, NULL, &tv);
    590 #    else /* hpux */
    591508    sel = select (FD_SETSIZE, &readset, NULL, NULL, &tv);
    592 #    endif /* hpux */
    593509    if (sel == -1)
    594510      break;
     
    640556
    641557#  endif /* !__OPTIMIZE__ */
    642 # endif /* !hpux */
    643558#endif /* unix */
    644559
    645 /* Under HPUX 9, system(...) returns -1 if SIGCHLD does not equal
    646    SIG_DFL. However, if it stays at SIG_DFL we get zombie processes
    647    for terminated childs generated by fork. Therefors some special treatment
    648    is necessary */
    649 #ifdef HPUX_9
    650 # undef system
    651 extern "C" {
    652   int  hpux9_system(const char* call)
    653   {
    654     int ret;
    655     si_set_signal(SIGCHLD, (void (*)(int))SIG_DFL);
    656     ret = system(call);
    657     si_set_signal(SIGCHLD, (void (*)(int))SIG_IGN);
    658     return ret;
    659   }
    660 }
    661 #endif /* HPUX_9 */
     560/*2
     561* init signal handlers
     562*/
     563void init_signals()
     564{
     565  si_set_signal(SIGSEGV,(si_hdl_typ)sigsegv_handler);
     566  si_set_signal(SIGFPE, (si_hdl_typ)sigsegv_handler);
     567  si_set_signal(SIGILL, (si_hdl_typ)sigsegv_handler);
     568  si_set_signal(SIGIOT, (si_hdl_typ)sigsegv_handler);
     569  si_set_signal(SIGINT ,(si_hdl_typ)sigint_handler);
     570  si_set_signal(SIGCHLD, (si_hdl_typ)sig_chld_hdl);
     571  si_set_signal(SIGPIPE, (si_hdl_typ)sig_pipe_hdl);
     572  si_set_signal(SIGTERM, (si_hdl_typ)sig_term_hdl);
     573}
     574
Note: See TracChangeset for help on using the changeset viewer.