18 # define SigHandler SIG_PF
20 # define SigHandler __sighandler_t
26 #ifndef _GLIBCXX_CSTDIO
29 #ifndef _GLIBCXX_CERRNO
34 #error missing include to arb_assert.h
38 return sh == SIG_DFL || sh == SIG_IGN;
48 #if defined(TRACE_SIGNAL_HANDLERS)
49 fprintf(stderr,
"> sighandler[%s] changed (%p->%p)\n", signame, old_handler, handler);
51 #endif // TRACE_SIGNAL_HANDLERS
52 if (old_handler == SIG_ERR) {
53 fprintf(stderr,
"%s: failed to install %s handler (Reason: %s)\n",
54 context, signame, strerror(errno));
62 if (old_handler != SIG_ERR) {
65 if (uninstalled_handler != SIG_IGN) {
73 #define INSTALL_SIGHANDLER(sig, handler, context) install_SigHandler(sig, handler, context, #sig)
74 #define UNINSTALL_SIGHANDLER(sig, handler, old_handler, context) uninstall_SigHandler(sig, handler, old_handler, context, #sig)
79 return signal(sig, handler);
82 if (old_handler != SIG_ERR) {
87 #define INSTALL_SIGHANDLER(sig, handler, context) install_SigHandler(sig, handler)
88 #define UNINSTALL_SIGHANDLER(sig, handler, old_handler, context) uninstall_SigHandler(sig, handler, old_handler)
93 #error SigHandler.h included twice
94 #endif // SIGHANDLER_H
SigHandler install_SigHandler(int sig, SigHandler handler)
#define ASSERT_RESULT(Type, Expected, Expr)
bool is_default_or_ignore_sighandler(SigHandler sh)
#define IF_ASSERTION_USED(x)
void uninstall_SigHandler(int sig, SigHandler IF_ASSERTION_USED(handler), SigHandler old_handler)