Skip to content

Commit 199e4ef

Browse files
authored
Merge pull request #508 from MrAnno/stackdump-fixes
Stackdump fixes
2 parents 686750c + 4083a39 commit 199e4ef

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

cmake/syslog-ng-config.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@
107107
#cmakedefine01 SYSLOG_NG_ENABLE_AFSOCKET_MEMINFO_METRICS
108108
#cmakedefine01 SYSLOG_NG_HAVE_IV_WORK_POOL_SUBMIT_CONTINUATION
109109
#cmakedefine01 SYSLOG_NG_ENABLE_PERF
110-
#cmakedefine01 SYSLOG_NG_ENABLE_LIBUNWIND
110+
#cmakedefine01 SYSLOG_NG_ENABLE_STACKDUMP

configure.ac

+20-2
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ AC_ARG_ENABLE(native,
417417

418418
AC_ARG_ENABLE(afsnmp, [ --enable-afsnmp Enable afsnmp module (default: auto)],, enable_afsnmp="auto")
419419

420+
AC_ARG_ENABLE(stackdump,
421+
[ --disable-stackdump Disable stackdump support]
422+
,,enable_stackdump="auto")
423+
420424
AC_ARG_ENABLE(all-modules,
421425
[ --enable-all-modules Forcibly enable all modules. (default: auto)]
422426
,,enable_all_modules="auto")
@@ -1407,6 +1411,10 @@ dnl ***************************************************************************
14071411

14081412
PKG_CHECK_MODULES(LIBUNWIND, libunwind >= 1.6.2, enable_libunwind="yes", enable_libunwind="no")
14091413

1414+
if test "$enable_stackdump" = "yes" && test "$enable_libunwind" = "no"; then
1415+
AC_MSG_ERROR([Could not find libunwind, and stackdump support was explicitly enabled.])
1416+
fi
1417+
14101418
dnl ***************************************************************************
14111419
dnl libesmtp headers/libraries
14121420
dnl ***************************************************************************
@@ -2001,6 +2009,16 @@ if test "x$enable_kafka" = "xauto"; then
20012009
AC_MSG_RESULT([$enable_kafka])
20022010
fi
20032011

2012+
if test "x$enable_stackdump" = "xauto"; then
2013+
AC_MSG_CHECKING(whether to enable stackdump support)
2014+
if test "x$enable_libunwind" != "xno"; then
2015+
enable_stackdump="yes"
2016+
else
2017+
enable_stackdump="no"
2018+
fi
2019+
AC_MSG_RESULT([$enable_stackdump])
2020+
fi
2021+
20042022
if test "x$enable_systemd" = "xauto"; then
20052023
if test "$ostype" = "Linux" -a "$have_libsystemd" = "yes"; then
20062024
enable_systemd=yes
@@ -2269,7 +2287,7 @@ AC_DEFINE_UNQUOTED(ENABLE_ENV_WRAPPER, `enable_value $enable_env_wrapper`, [Enab
22692287
AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable systemd support])
22702288
AC_DEFINE_UNQUOTED(ENABLE_KAFKA, `enable_value $enable_kafka`, [Enable kafka support])
22712289
AC_DEFINE_UNQUOTED(ENABLE_CPP, `enable_value $enable_cpp`, [Enable C++ support])
2272-
AC_DEFINE_UNQUOTED(ENABLE_LIBUNWIND, `enable_value $enable_libunwind`, [Enable stackdump using libunwind])
2290+
AC_DEFINE_UNQUOTED(ENABLE_STACKDUMP, `enable_value $enable_stackdump`, [Enable stackdump using libunwind])
22732291
AC_DEFINE_UNQUOTED(SYSTEMD_JOURNAL_MODE, `journald_mode`, [Systemd-journal support mode])
22742292
AC_DEFINE_UNQUOTED(HAVE_INOTIFY, `enable_value $ac_cv_func_inotify_init`, [Have inotify])
22752293
AC_DEFINE_UNQUOTED(USE_CONST_IVYKIS_MOCK, `enable_value $IVYKIS_VERSION_UPDATED`, [ivykis version is greater than $IVYKIS_UPDATED_VERSION])
@@ -2439,7 +2457,7 @@ echo " systemd support : ${enable_systemd:=no} (unit dir: ${systemd
24392457
echo " systemd-journal support : ${with_systemd_journal:=no}"
24402458
echo " JSON support : $with_jsonc"
24412459
echo " perf support : ${enable_perf:=no}"
2442-
echo " unwind support : ${enable_libunwind:=no}"
2460+
echo " stackdump support : ${enable_stackdump:=no}"
24432461
echo " Build options:"
24442462
echo " Generate manual pages : ${enable_manpages:=no}"
24452463
echo " Install manual pages : ${enable_manpages_install:=no}"

docker/apkbuild/axoflow/axosyslog/APKBUILD

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ makedepends="
3030
libnet-dev
3131
librdkafka-dev
3232
libtool
33+
libunwind-dev
3334
libxml2-utils
3435
mongo-c-driver-dev
3536
net-snmp-dev
@@ -97,6 +98,7 @@ build() {
9798
\
9899
--enable-all-modules \
99100
--enable-ebpf \
101+
--disable-stackdump \
100102
--disable-linux-caps \
101103
--disable-smtp \
102104
--disable-systemd \

lib/filterx/expr-getattr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ filterx_getattr_new(FilterXExpr *operand, FilterXObject *attr_name)
147147
self->super.free_fn = _free;
148148
self->operand = operand;
149149

150-
filterx_object_is_type(attr_name, &FILTERX_TYPE_NAME(string));
150+
g_assert(filterx_object_is_type(attr_name, &FILTERX_TYPE_NAME(string)));
151151
self->attr = attr_name;
152152
/* NOTE: name borrows the string value from the string object */
153153
self->super.name = filterx_string_get_value_ref(self->attr, NULL);
154154
return &self->super;
155155
}
156156

157-
FILTERX_EXPR_DEFINE_TYPE(getattr);
157+
FILTERX_EXPR_DEFINE_TYPE(getattr);

lib/stackdump.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
#include <fcntl.h>
2929
#include <unistd.h>
3030

31-
#if SYSLOG_NG_ENABLE_LIBUNWIND
31+
#if SYSLOG_NG_ENABLE_STACKDUMP
3232

3333
#define UNW_LOCAL_ONLY
3434
#include <libunwind.h>
3535
#include <dlfcn.h>
36+
#include <link.h>
3637

3738
/* this is Linux only for now */
3839

0 commit comments

Comments
 (0)