8 void invoke_atexit_functions(void);
10 static void terminate(int signum
)
12 invoke_atexit_functions();
13 fprintf(stderr
, "vlock: Killed by signal %d (%s)!\n", signum
, strsignal(signum
));
17 void install_signal_handlers(void)
21 /* Ignore some signals. */
22 (void) sigemptyset(&(sa
.sa_mask
));
23 sa
.sa_flags
= SA_RESTART
;
24 sa
.sa_handler
= SIG_IGN
;
25 (void) sigaction(SIGTSTP
, &sa
, NULL
);
27 /* Handle termination signals. None of these should be delivered in a normal
28 * run of the program because terminal signals (INT, QUIT) are disabled
30 sa
.sa_flags
= SA_RESETHAND
;
31 sa
.sa_handler
= terminate
;
32 (void) sigaction(SIGINT
, &sa
, NULL
);
33 (void) sigaction(SIGQUIT
, &sa
, NULL
);
34 (void) sigaction(SIGTERM
, &sa
, NULL
);
35 (void) sigaction(SIGHUP
, &sa
, NULL
);
36 (void) sigaction(SIGABRT
, &sa
, NULL
);
37 (void) sigaction(SIGSEGV
, &sa
, NULL
);