11 static const char *termination_blurb
=
13 "*******************************************************************************\n"
14 "*** vlock caught a fatal signal and will now terminate. The reason for ***\n"
15 "*** this is very likely an error in the program. Please notify the author ***\n"
16 "*** about this problem by sending an email to the address below. Include ***\n"
17 "*** all messages leading up to this one and as much information as possible ***\n"
18 "*** about your system and configuration. ***\n"
19 "*** Please include the word \"vlock\" in the subject of your email. Sorry ***\n"
20 "*** for any inconvenience. ***\n"
22 "*** Frank Benkstein <frank-vlock@benkstein.net> ***\n"
23 "*******************************************************************************\n"
27 static void terminate(int signum
)
29 vlock_invoke_atexit();
31 fprintf(stderr
, "vlock: Killed by signal %d (%s)!\n", signum
,
34 if (signum
!= SIGTERM
)
35 fputs(termination_blurb
, stderr
);
40 void install_signal_handlers(void)
44 /* Ignore some signals. */
45 (void) sigemptyset(&(sa
.sa_mask
));
46 sa
.sa_flags
= SA_RESTART
;
47 sa
.sa_handler
= SIG_IGN
;
48 (void) sigaction(SIGTSTP
, &sa
, NULL
);
50 /* Handle termination signals. None of these should be delivered in a normal
51 * run of the program because terminal signals (INT, QUIT) are disabled
53 sa
.sa_flags
= SA_RESETHAND
;
54 sa
.sa_handler
= terminate
;
55 (void) sigaction(SIGINT
, &sa
, NULL
);
56 (void) sigaction(SIGQUIT
, &sa
, NULL
);
57 (void) sigaction(SIGTERM
, &sa
, NULL
);
58 (void) sigaction(SIGHUP
, &sa
, NULL
);
59 (void) sigaction(SIGABRT
, &sa
, NULL
);
60 (void) sigaction(SIGSEGV
, &sa
, NULL
);