if (bStackBelowHeap) return ptr < &a; else return ptr > &a; } /* (declare this list here, so it may be used in signal handlers in addition to main()) * A list of signals available in ISO C * Check out http://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html * For now we only want to detect abnormal behaviour for a few selected signals: */ #define DECLARE_SIGNAL(x) << std::make_pair(x, #x) typedef std::map<int, std::string> Signalmap_t; static const Signalmap_t listofsignals = make_container< Signalmap_t > () DECLARE_SIGNAL(SIGABRT) DECLARE_SIGNAL(SIGBUS) DECLARE_SIGNAL(SIGFPE) DECLARE_SIGNAL(SIGILL) DECLARE_SIGNAL(SIGINT) DECLARE_SIGNAL(SIGQUIT) DECLARE_SIGNAL(SIGSEGV) DECLARE_SIGNAL(SIGSYS) // don't care: SIGTERM DECLARE_SIGNAL(SIGUSR1) DECLARE_SIGNAL(SIGUSR2) ; #undef DECLARE_SIGNAL /* * Entry pointer for signal handlers * It uses functions which are not safe to be called from a signal handler,
#if defined(USE_UNIX_SIGNAL_HANDLING) /* (declare this list here, so it may be used in signal handlers in addition to main()) * A list of signals available in ISO C * Check out http://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html * For now we only want to detect abnormal behaviour for a few selected signals: */ struct Signaltype { int signalnumber; const char *signalname; }; #define DECLARE_SIGNAL(x) {x, #x} static const Signaltype listofsignals[] = { // don't care: SIGABRT, DECLARE_SIGNAL(SIGBUS), DECLARE_SIGNAL(SIGFPE), DECLARE_SIGNAL(SIGILL), DECLARE_SIGNAL(SIGINT), DECLARE_SIGNAL(SIGSEGV), // don't care: SIGTERM }; /* * Simple mapping */ static const char *signal_name(int signo) { for (size_t s=0; s<GetArrayLength(listofsignals); ++s) { if (listofsignals[s].signalnumber==signo) return listofsignals[s].signalname;