Commit 20470f5b authored by Geoff Simmons's avatar Geoff Simmons

restore handler.c -- no compatibility mode, and hence no stack traces,

if execinfo.h is not present
parent dafd20fd
...@@ -22,9 +22,8 @@ varnishevent_SOURCES = \ ...@@ -22,9 +22,8 @@ varnishevent_SOURCES = \
monitor.c \ monitor.c \
strfTIM.h \ strfTIM.h \
strfTIM.c \ strfTIM.c \
format.c format.c \
handler.c
# handler.c
varnishevent_LDADD = \ varnishevent_LDADD = \
${PTHREAD_LIBS} ${RT_LIBS} ${LIBM} @VARNISH_LIBS@ \ ${PTHREAD_LIBS} ${RT_LIBS} ${LIBM} @VARNISH_LIBS@ \
......
...@@ -42,10 +42,9 @@ ...@@ -42,10 +42,9 @@
#include <syslog.h> #include <syslog.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#ifndef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#include "compat/execinfo.h"
#else
#include <execinfo.h> #include <execinfo.h>
#endif #endif
...@@ -67,6 +66,8 @@ ...@@ -67,6 +66,8 @@
* +1 to phk's rant in varnishd.c about the lack of a standard for this. * +1 to phk's rant in varnishd.c about the lack of a standard for this.
*/ */
#ifdef HAVE_EXECINFO_H
struct symbols { struct symbols {
uintptr_t a; uintptr_t a;
char *n; char *n;
...@@ -165,19 +166,27 @@ stacktrace(void) ...@@ -165,19 +166,27 @@ stacktrace(void)
} }
} }
#endif
void void
HNDL_Init(const char *a0) HNDL_Init(const char *a0)
{ {
#ifdef HAVE_EXECINFO_H
symbol_hack(a0); symbol_hack(a0);
#else
(void) a0;
#endif
} }
void void
HNDL_Abort(int sig) HNDL_Abort(int sig)
{ {
AZ(sigaction(SIGABRT, &default_action, NULL)); AZ(sigaction(SIGABRT, &default_action, NULL));
LOG_Log(LOG_ALERT, "Received signal %d (%s), stacktrace follows", sig, LOG_Log(LOG_ALERT, "Received signal %d (%s)", sig, strsignal(sig));
strsignal(sig)); #ifdef HAVE_EXECINFO_H
LOG_Log0(LOG_NOTICE, "Stacktrace follows");
stacktrace(); stacktrace();
#endif
CONF_Dump(); CONF_Dump();
DATA_Dump(); DATA_Dump();
MON_Output(); MON_Output();
......
...@@ -562,16 +562,12 @@ main(int argc, char *argv[]) ...@@ -562,16 +562,12 @@ main(int argc, char *argv[])
AZ(sigemptyset(&reopen_action.sa_mask)); AZ(sigemptyset(&reopen_action.sa_mask));
reopen_action.sa_flags |= SA_RESTART; reopen_action.sa_flags |= SA_RESTART;
#if 0
stacktrace_action.sa_handler = HNDL_Abort; stacktrace_action.sa_handler = HNDL_Abort;
#endif
ignore_action.sa_handler = SIG_IGN; ignore_action.sa_handler = SIG_IGN;
default_action.sa_handler = SIG_DFL; default_action.sa_handler = SIG_DFL;
#if 0
HNDL_Init(argv[0]); HNDL_Init(argv[0]);
#endif
/* Install signal handlers */ /* Install signal handlers */
#include "signals.h" #include "signals.h"
......
...@@ -296,10 +296,8 @@ int FMT_Estimate_RecsPerTx(void); ...@@ -296,10 +296,8 @@ int FMT_Estimate_RecsPerTx(void);
void FMT_Format(tx_t *tx, struct vsb *os); void FMT_Format(tx_t *tx, struct vsb *os);
void FMT_Fini(void); void FMT_Fini(void);
#if 0
/* handler.c */ /* handler.c */
void HNDL_Init(const char *a0); void HNDL_Init(const char *a0);
void HNDL_Abort(int sig); void HNDL_Abort(int sig);
#endif
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment