#include "interception/interception.h"
#include "sanitizer_common.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform_interceptors.h"
usingnamespace__sanitizer;
#if SANITIZER_NETBSD
#define sigaction_symname …
#else
#define sigaction_symname …
#endif
#ifndef SIGNAL_INTERCEPTOR_SIGNAL_IMPL
#define SIGNAL_INTERCEPTOR_SIGNAL_IMPL(func, signum, handler) …
#endif
#ifndef SIGNAL_INTERCEPTOR_SIGACTION_IMPL
#define SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact) …
#endif
#if SANITIZER_INTERCEPT_BSD_SIGNAL
INTERCEPTOR(uptr, bsd_signal, int signum, uptr handler) {
SIGNAL_INTERCEPTOR_ENTER();
if (GetHandleSignalMode(signum) == kHandleSignalExclusive) return 0;
SIGNAL_INTERCEPTOR_SIGNAL_IMPL(bsd_signal, signum, handler);
}
#define INIT_BSD_SIGNAL …
#else
#define INIT_BSD_SIGNAL
#endif
#if SANITIZER_INTERCEPT_SIGNAL_AND_SIGACTION
INTERCEPTOR(uptr, signal, int signum, uptr handler) { … }
#define INIT_SIGNAL …
INTERCEPTOR(int, sigaction_symname, int signum,
const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) { … }
#define INIT_SIGACTION …
namespace __sanitizer {
int real_sigaction(int signum, const void *act, void *oldact) { … }
}
#else
#define INIT_SIGNAL
#define INIT_SIGACTION
namespace __sanitizer {
struct __sanitizer_sigaction;
}
DEFINE_REAL(int, sigaction, int signum, const __sanitizer_sigaction *act,
__sanitizer_sigaction *oldact)
#endif
static void InitializeSignalInterceptors() { … }