version 1.27, 2003/03/09 15:17:03
|
version 1.31, 2006/10/21 22:13:49
|
Line 95 graceful_exit (int sig)
|
Line 95 graceful_exit (int sig)
|
|
|
jmp_buf throw_jmp_buf; |
jmp_buf throw_jmp_buf; |
|
|
|
void throw(int code) |
|
{ |
|
longjmp(throw_jmp_buf,code); /* !! or use siglongjmp ? */ |
|
} |
|
|
static void |
static void |
signal_throw(int sig) |
signal_throw(int sig) |
{ |
{ |
Line 120 signal_throw(int sig)
|
Line 125 signal_throw(int sig)
|
sigprocmask(SIG_SETMASK, &emptyset, NULL); |
sigprocmask(SIG_SETMASK, &emptyset, NULL); |
} |
} |
#endif |
#endif |
longjmp(throw_jmp_buf,code); /* !! or use siglongjmp ? */ |
throw(code); |
} |
} |
|
|
#ifdef SA_SIGINFO |
#ifdef SA_SIGINFO |
Line 142 static void fpe_handler(int sig, siginfo
|
Line 147 static void fpe_handler(int sig, siginfo
|
#ifdef FPE_INTOVF |
#ifdef FPE_INTOVF |
case FPE_INTOVF: code=-11; break; /* integer overflow */ |
case FPE_INTOVF: code=-11; break; /* integer overflow */ |
#endif |
#endif |
|
#ifdef FPE_FLTDIV |
case FPE_FLTDIV: code=-42; break; /* floating point divide by zero */ |
case FPE_FLTDIV: code=-42; break; /* floating point divide by zero */ |
|
#endif |
|
#ifdef FPE_FLTOVF |
case FPE_FLTOVF: code=-43; break; /* floating point overflow */ |
case FPE_FLTOVF: code=-43; break; /* floating point overflow */ |
|
#endif |
|
#ifdef FPE_FLTUND |
case FPE_FLTUND: code=-54; break; /* floating point underflow */ |
case FPE_FLTUND: code=-54; break; /* floating point underflow */ |
|
#endif |
|
#ifdef FPE_FLTRES |
case FPE_FLTRES: code=-41; break; /* floating point inexact result */ |
case FPE_FLTRES: code=-41; break; /* floating point inexact result */ |
|
#endif |
#if 0 /* defined by Unix95, but unnecessary */ |
#if 0 /* defined by Unix95, but unnecessary */ |
case FPE_FLTINV: /* invalid floating point operation */ |
case FPE_FLTINV: /* invalid floating point operation */ |
case FPE_FLTSUB: /* subscript out of range */ |
case FPE_FLTSUB: /* subscript out of range */ |
#endif |
#endif |
default: code=-55; break; |
default: code=-55; break; |
} |
} |
longjmp(throw_jmp_buf,code); |
throw(code); |
} |
} |
|
|
|
|
Line 185 static void segv_handler(int sig, siginf
|
Line 198 static void segv_handler(int sig, siginf
|
code=-44; |
code=-44; |
else if (JUSTOVER(addr, NEXTPAGE(h->fp_stack_base+h->fp_stack_size))) |
else if (JUSTOVER(addr, NEXTPAGE(h->fp_stack_base+h->fp_stack_size))) |
code=-45; |
code=-45; |
longjmp(throw_jmp_buf,code); |
throw(code); |
} |
} |
|
|
#endif /* defined(SA_SIGINFO) */ |
#endif /* defined(SA_SIGINFO) */ |
Line 306 void install_signal_handlers(void)
|
Line 319 void install_signal_handlers(void)
|
}; |
}; |
#endif |
#endif |
|
|
|
static short async_sigs_to_throw [] = { |
|
#ifdef SIGINT |
|
SIGINT, |
|
#endif |
|
#ifdef SIGALRM |
|
SIGALRM, |
|
#endif |
|
#ifdef SIGPOLL |
|
SIGPOLL, |
|
#endif |
|
#ifdef SIGPROF |
|
SIGPROF, |
|
#endif |
|
#ifdef SIGURG |
|
SIGURG, |
|
#endif |
|
#ifdef SIGPIPE |
|
SIGPIPE, |
|
#endif |
|
#ifdef SIGUSR1 |
|
SIGUSR1, |
|
#endif |
|
#ifdef SIGUSR2 |
|
SIGUSR2, |
|
#endif |
|
#ifdef SIGVTALRM |
|
SIGVTALRM, |
|
#endif |
|
#ifdef SIGXFSZ |
|
SIGXFSZ, |
|
#endif |
|
}; |
|
|
static short sigs_to_throw [] = { |
static short sigs_to_throw [] = { |
#ifdef SIGBREAK |
#ifdef SIGBREAK |
SIGBREAK, |
SIGBREAK, |
#endif |
#endif |
#ifdef SIGINT |
|
SIGINT, |
|
#endif |
|
#ifdef SIGILL |
#ifdef SIGILL |
SIGILL, |
SIGILL, |
#endif |
#endif |
Line 328 void install_signal_handlers(void)
|
Line 371 void install_signal_handlers(void)
|
#ifdef SIGSEGV |
#ifdef SIGSEGV |
SIGSEGV, |
SIGSEGV, |
#endif |
#endif |
#ifdef SIGALRM |
|
SIGALRM, |
|
#endif |
|
#ifdef SIGPIPE |
|
SIGPIPE, |
|
#endif |
|
#ifdef SIGPOLL |
|
SIGPOLL, |
|
#endif |
|
#ifdef SIGPROF |
|
SIGPROF, |
|
#endif |
|
#ifdef SIGBUS |
#ifdef SIGBUS |
SIGBUS, |
SIGBUS, |
#endif |
#endif |
Line 349 void install_signal_handlers(void)
|
Line 380 void install_signal_handlers(void)
|
#ifdef SIGTRAP |
#ifdef SIGTRAP |
SIGTRAP, |
SIGTRAP, |
#endif |
#endif |
#ifdef SIGURG |
|
SIGURG, |
|
#endif |
|
#ifdef SIGUSR1 |
|
SIGUSR1, |
|
#endif |
|
#ifdef SIGUSR2 |
|
SIGUSR2, |
|
#endif |
|
#ifdef SIGVTALRM |
|
SIGVTALRM, |
|
#endif |
|
#ifdef SIGXFSZ |
|
SIGXFSZ, |
|
#endif |
|
}; |
}; |
|
|
static short sigs_to_quit [] = { |
static short sigs_to_quit [] = { |
#ifdef SIGQUIT |
#ifdef SIGQUIT |
SIGQUIT, |
SIGQUIT, |
Line 393 void install_signal_handlers(void)
|
Line 410 void install_signal_handlers(void)
|
SUSv2 ss_sp should point to the start of the stack, but |
SUSv2 ss_sp should point to the start of the stack, but |
unfortunately Irix 6.5 (at least) expects ss_sp to point to the |
unfortunately Irix 6.5 (at least) expects ss_sp to point to the |
end, so we work around this issue by accomodating everyone. */ |
end, so we work around this issue by accomodating everyone. */ |
if ((sigstack.ss_sp = my_alloc(sigstack.ss_size*2)) != NULL) { |
if ((sigstack.ss_sp = gforth_alloc(sigstack.ss_size*2)) != NULL) { |
sigstack.ss_sp += sigstack.ss_size; |
sigstack.ss_sp += sigstack.ss_size; |
sigstack.ss_flags=0; |
sigstack.ss_flags=0; |
sas_retval=sigaltstack(&sigstack,(stack_t *)0); |
sas_retval=sigaltstack(&sigstack,(stack_t *)0); |
Line 409 void install_signal_handlers(void)
|
Line 426 void install_signal_handlers(void)
|
*/ |
*/ |
for (i = 0; i < DIM (sigs_to_throw); i++) |
for (i = 0; i < DIM (sigs_to_throw); i++) |
bsd_signal(sigs_to_throw[i], throw_handler); |
bsd_signal(sigs_to_throw[i], throw_handler); |
|
for (i = 0; i < DIM (async_sigs_to_throw); i++) |
|
bsd_signal(async_sigs_to_throw[i], |
|
ignore_async_signals ? SIG_IGN : throw_handler); |
for (i = 0; i < DIM (sigs_to_quit); i++) |
for (i = 0; i < DIM (sigs_to_quit); i++) |
bsd_signal(sigs_to_quit [i], graceful_exit); |
bsd_signal(sigs_to_quit [i], graceful_exit); |
#ifdef SA_SIGINFO |
#ifdef SA_SIGINFO |