+static inline void dumpstack(int crop, int signum) {}
+
+#else
+
+#include <execinfo.h>
+
+/*
+ * Dumps the current stack
+ */
+static void dumpstack(int crop, int signum)
+{
+ int idx, count, rc;
+ void *addresses[100];
+ char **locations;
+ char buffer[8000];
+ size_t pos, length;
+
+ count = backtrace(addresses, sizeof addresses / sizeof *addresses);
+ if (count <= crop)
+ crop = 0;
+ count -= crop;
+ locations = backtrace_symbols(&addresses[crop], count);
+ if (locations == NULL)
+ ERROR("can't get the backtrace (returned %d addresses)", count);
+ else {
+ length = sizeof buffer - 1;
+ pos = 0;
+ idx = 0;
+ while (pos < length && idx < count) {
+ rc = snprintf(&buffer[pos], length - pos, " [%d/%d] %s\n", idx + 1, count, locations[idx]);
+ pos += rc >= 0 ? rc : 0;
+ idx++;
+ }
+ buffer[length] = 0;
+ if (signum)
+ ERROR("BACKTRACE due to signal %s/%d:\n%s", strsignal(signum), signum, buffer);
+ else
+ ERROR("BACKTRACE:\n%s", buffer);
+ free(locations);
+ }
+}
+
+#endif
+/******************************************************************************/
+#if !WITH_SIG_MONITOR_TIMERS
+
+static inline int timeout_create() { return 0; }
+static inline int timeout_arm(int timeout) { return 0; }
+static inline void timeout_disarm() {}
+static inline void timeout_delete() {}
+
+#define SIG_FOR_TIMER 0
+
+#else