made backtrace() calls optional to support uClibc
This commit is contained in:
parent
f87e5dd98c
commit
e696757c47
|
@ -96,6 +96,8 @@ dnl ==========================
|
||||||
dnl check required libraries
|
dnl check required libraries
|
||||||
dnl ==========================
|
dnl ==========================
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(backtrace getifaddrs)
|
||||||
|
|
||||||
AC_HAVE_LIBRARY([gmp],[LIBS="$LIBS"],[AC_MSG_ERROR([GNU Multi Precision library gmp not found])])
|
AC_HAVE_LIBRARY([gmp],[LIBS="$LIBS"],[AC_MSG_ERROR([GNU Multi Precision library gmp not found])])
|
||||||
if test "$ldap" = "true"; then
|
if test "$ldap" = "true"; then
|
||||||
AC_HAVE_LIBRARY([ldap],[LIBS="$LIBS"],[AC_MSG_ERROR([LDAP enabled, but library ldap not found])])
|
AC_HAVE_LIBRARY([ldap],[LIBS="$LIBS"],[AC_MSG_ERROR([LDAP enabled, but library ldap not found])])
|
||||||
|
|
|
@ -285,6 +285,7 @@ static void initialize(private_daemon_t *this, bool strict, bool syslog,
|
||||||
*/
|
*/
|
||||||
void signal_handler(int signal)
|
void signal_handler(int signal)
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_BACKTRACE
|
||||||
void *array[20];
|
void *array[20];
|
||||||
size_t size;
|
size_t size;
|
||||||
char **strings;
|
char **strings;
|
||||||
|
@ -294,13 +295,17 @@ void signal_handler(int signal)
|
||||||
strings = backtrace_symbols(array, size);
|
strings = backtrace_symbols(array, size);
|
||||||
|
|
||||||
DBG1(DBG_DMN, "thread %u received %s. Dumping %d frames from stack:",
|
DBG1(DBG_DMN, "thread %u received %s. Dumping %d frames from stack:",
|
||||||
signal == SIGSEGV ? "SIGSEGV" : "SIGILL", pthread_self(), size);
|
pthread_self(), signal == SIGSEGV ? "SIGSEGV" : "SIGILL", size);
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, " %s", strings[i]);
|
DBG1(DBG_DMN, " %s", strings[i]);
|
||||||
}
|
}
|
||||||
free (strings);
|
free (strings);
|
||||||
|
#else /* !HAVE_BACKTRACE */
|
||||||
|
DBG1(DBG_DMN, "thread %u received %s",
|
||||||
|
pthread_self(), signal == SIGSEGV ? "SIGSEGV" : "SIGILL");
|
||||||
|
#endif /* HAVE_BACKTRACE */
|
||||||
DBG1(DBG_DMN, "killing ourself hard after SIGSEGV");
|
DBG1(DBG_DMN, "killing ourself hard after SIGSEGV");
|
||||||
raise(SIGKILL);
|
raise(SIGKILL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
*/
|
*/
|
||||||
static void log_stack_frames(void **stack_frames, int stack_frame_count)
|
static void log_stack_frames(void **stack_frames, int stack_frame_count)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_BACKTRACE
|
||||||
char **strings;
|
char **strings;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -152,6 +153,7 @@ static void log_stack_frames(void **stack_frames, int stack_frame_count)
|
||||||
DBG1(" %s", strings[i]);
|
DBG1(" %s", strings[i]);
|
||||||
}
|
}
|
||||||
free (strings);
|
free (strings);
|
||||||
|
#endif /* HAVE_BACKTRACE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue