1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

debug: add more debug message for signal handling

Adding log_sys_debug for eventual logging of system errors.
(Using debug level, since currently signal handling functions
do not fail when any error is encoutered).
This commit is contained in:
Zdenek Kabelac 2014-05-02 17:34:22 +02:00
parent 04b29a3587
commit 31ac200a37

View File

@ -67,20 +67,26 @@ void sigint_allow(void)
}
/* Grab old sigaction for SIGINT: shall not fail. */
sigaction(SIGINT, NULL, &handler);
if (sigaction(SIGINT, NULL, &handler))
log_sys_debug("sigaction", "SIGINT");
handler.sa_flags &= ~SA_RESTART; /* Clear restart flag */
handler.sa_handler = _catch_sigint;
_handler_installed2 = 1;
/* Override the signal handler: shall not fail. */
sigaction(SIGINT, &handler, &_oldhandler2);
if (sigaction(SIGINT, &handler, &_oldhandler2))
log_sys_debug("sigaction", "SIGINT");
/* Unmask SIGINT. Remember to mask it again on restore. */
sigprocmask(0, NULL, &sigs);
if (sigprocmask(0, NULL, &sigs))
log_sys_debug("sigprocmask", "");
if ((_oldmasked = sigismember(&sigs, SIGINT))) {
sigdelset(&sigs, SIGINT);
sigprocmask(SIG_SETMASK, &sigs, NULL);
if (sigprocmask(SIG_SETMASK, &sigs, NULL))
log_sys_debug("sigprocmask", "SIG_SETMASK");
}
}
@ -101,10 +107,12 @@ void sigint_restore(void)
sigset_t sigs;
sigprocmask(0, NULL, &sigs);
sigaddset(&sigs, SIGINT);
sigprocmask(SIG_SETMASK, &sigs, NULL);
if (sigprocmask(SIG_SETMASK, &sigs, NULL))
log_sys_debug("sigprocmask", "SIG_SETMASK");
}
sigaction(SIGINT, &_oldhandler2, NULL);
if (sigaction(SIGINT, &_oldhandler2, NULL))
log_sys_debug("sigaction", "SIGINT restore");
}
void block_signals(uint32_t flags __attribute__((unused)))