Ignore:
Timestamp:
Jan 30, 2020, 10:59:12 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6f302cd
Parents:
052dfc3
Message:

restructure errors invoking signal handlers and handled by abort

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/signal.hfa

    r052dfc3 r8a13c47  
    4040        sigaddset( &act.sa_mask, SIGALRM );             // disabled during signal handler
    4141        sigaddset( &act.sa_mask, SIGUSR1 );
     42        sigaddset( &act.sa_mask, SIGSEGV );
     43        sigaddset( &act.sa_mask, SIGBUS );
     44        sigaddset( &act.sa_mask, SIGILL );
     45        sigaddset( &act.sa_mask, SIGFPE );
     46        sigaddset( &act.sa_mask, SIGHUP );              // revert to default on second delivery
     47        sigaddset( &act.sa_mask, SIGTERM );
     48        sigaddset( &act.sa_mask, SIGINT );
    4249        act.sa_flags = flags;
    4350
    44         if ( sigaction( sig, &act, NULL ) == -1 ) {
     51        if ( sigaction( sig, &act, 0p ) == -1 ) {
    4552                __cfaabi_dbg_print_buffer_decl(
    4653                        " __cfaabi_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
     
    4855                );
    4956                _exit( EXIT_FAILURE );
    50         }
     57        } // if
    5158}
    52 
    53 // Sigaction wrapper : restore default handler
    54 static void __cfaabi_sigdefault( int sig ) {
    55         struct sigaction act;
    56 
    57         act.sa_handler = SIG_DFL;
    58         act.sa_flags = 0;
    59         sigemptyset( &act.sa_mask );
    60 
    61         if ( sigaction( sig, &act, NULL ) == -1 ) {
    62                 __cfaabi_dbg_print_buffer_decl(
    63                         " __cfaabi_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
    64                         sig, errno, strerror( errno )
    65                 );
    66                 _exit( EXIT_FAILURE );
    67         }
    68 }
Note: See TracChangeset for help on using the changeset viewer.