From 6c153dc8de71f204cd03deaf4fb1bdbe2d3aa6a9 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Mar 2016 08:15:03 +0100 Subject: move signal handling out of fb code --- fbtools.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'fbtools.c') diff --git a/fbtools.c b/fbtools.c index 708dbe4..ef0e160 100644 --- a/fbtools.c +++ b/fbtools.c @@ -540,43 +540,3 @@ gfxstate* fb_init(char *device, char *mode, int vt) fb_cleanup_display(); exit(1); } - -/* -------------------------------------------------------------------- */ -/* handle fatal errors */ - -static jmp_buf fb_fatal_cleanup; - -static void -fb_catch_exit_signal(int signal) -{ - siglongjmp(fb_fatal_cleanup,signal); -} - -void -fb_catch_exit_signals(void) -{ - struct sigaction act,old; - int termsig; - - memset(&act,0,sizeof(act)); - act.sa_handler = fb_catch_exit_signal; - sigemptyset(&act.sa_mask); - sigaction(SIGINT, &act,&old); - sigaction(SIGQUIT,&act,&old); - sigaction(SIGTERM,&act,&old); - - sigaction(SIGABRT,&act,&old); - sigaction(SIGTSTP,&act,&old); - - sigaction(SIGBUS, &act,&old); - sigaction(SIGILL, &act,&old); - sigaction(SIGSEGV,&act,&old); - - if (0 == (termsig = sigsetjmp(fb_fatal_cleanup,0))) - return; - - /* cleanup */ - fb_cleanup_display(); - fprintf(stderr,"Oops: %s\n",strsignal(termsig)); - exit(42); -} -- cgit