called as signal() handler, so sent at least one arg */ ARGUSED*/
| 597 | /* called as signal() handler, so sent at least one arg */ |
| 598 | /*ARGUSED*/ |
| 599 | void |
| 600 | panictrace_handler(int sig_unused UNUSED) |
| 601 | { |
| 602 | #define SIG_MSG "\nSignal received.\n" |
| 603 | int f2; |
| 604 | |
| 605 | # ifdef CURSES_GRAPHICS |
| 606 | if (iflags.window_inited && WINDOWPORT(curses)) { |
| 607 | extern void curses_uncurse_terminal(void); /* wincurs.h */ |
| 608 | |
| 609 | /* it is risky calling this during a program-terminating signal, |
| 610 | but without it the subsequent backtrace is useless because |
| 611 | that ends up being scrawled all over the screen; call is |
| 612 | here rather than in NH_abort() because panic() calls both |
| 613 | exit_nhwindows(), which makes this same call under curses, |
| 614 | then NH_abort() and we don't want to call this twice */ |
| 615 | curses_uncurse_terminal(); |
| 616 | } |
| 617 | # endif |
| 618 | |
| 619 | f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1); |
| 620 | nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */ |
| 621 | NH_abort(NULL); /* ... and we're already in the process of quitting? */ |
| 622 | } |
| 623 | |
| 624 | void |
| 625 | panictrace_setsignals(boolean set) |
nothing calls this directly
no test coverage detected