Skip to content

Commit

Permalink
Merge pull request #508 from MrAnno/stackdump-fixes
Browse files Browse the repository at this point in the history
Stackdump fixes
  • Loading branch information
OverOrion authored Feb 13, 2025
2 parents 686750c + 4083a39 commit 199e4ef
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmake/syslog-ng-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@
#cmakedefine01 SYSLOG_NG_ENABLE_AFSOCKET_MEMINFO_METRICS
#cmakedefine01 SYSLOG_NG_HAVE_IV_WORK_POOL_SUBMIT_CONTINUATION
#cmakedefine01 SYSLOG_NG_ENABLE_PERF
#cmakedefine01 SYSLOG_NG_ENABLE_LIBUNWIND
#cmakedefine01 SYSLOG_NG_ENABLE_STACKDUMP
22 changes: 20 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ AC_ARG_ENABLE(native,

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

AC_ARG_ENABLE(stackdump,
[ --disable-stackdump Disable stackdump support]
,,enable_stackdump="auto")

AC_ARG_ENABLE(all-modules,
[ --enable-all-modules Forcibly enable all modules. (default: auto)]
,,enable_all_modules="auto")
Expand Down Expand Up @@ -1407,6 +1411,10 @@ dnl ***************************************************************************

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

if test "$enable_stackdump" = "yes" && test "$enable_libunwind" = "no"; then
AC_MSG_ERROR([Could not find libunwind, and stackdump support was explicitly enabled.])
fi

dnl ***************************************************************************
dnl libesmtp headers/libraries
dnl ***************************************************************************
Expand Down Expand Up @@ -2001,6 +2009,16 @@ if test "x$enable_kafka" = "xauto"; then
AC_MSG_RESULT([$enable_kafka])
fi

if test "x$enable_stackdump" = "xauto"; then
AC_MSG_CHECKING(whether to enable stackdump support)
if test "x$enable_libunwind" != "xno"; then
enable_stackdump="yes"
else
enable_stackdump="no"
fi
AC_MSG_RESULT([$enable_stackdump])
fi

if test "x$enable_systemd" = "xauto"; then
if test "$ostype" = "Linux" -a "$have_libsystemd" = "yes"; then
enable_systemd=yes
Expand Down Expand Up @@ -2269,7 +2287,7 @@ AC_DEFINE_UNQUOTED(ENABLE_ENV_WRAPPER, `enable_value $enable_env_wrapper`, [Enab
AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable systemd support])
AC_DEFINE_UNQUOTED(ENABLE_KAFKA, `enable_value $enable_kafka`, [Enable kafka support])
AC_DEFINE_UNQUOTED(ENABLE_CPP, `enable_value $enable_cpp`, [Enable C++ support])
AC_DEFINE_UNQUOTED(ENABLE_LIBUNWIND, `enable_value $enable_libunwind`, [Enable stackdump using libunwind])
AC_DEFINE_UNQUOTED(ENABLE_STACKDUMP, `enable_value $enable_stackdump`, [Enable stackdump using libunwind])
AC_DEFINE_UNQUOTED(SYSTEMD_JOURNAL_MODE, `journald_mode`, [Systemd-journal support mode])
AC_DEFINE_UNQUOTED(HAVE_INOTIFY, `enable_value $ac_cv_func_inotify_init`, [Have inotify])
AC_DEFINE_UNQUOTED(USE_CONST_IVYKIS_MOCK, `enable_value $IVYKIS_VERSION_UPDATED`, [ivykis version is greater than $IVYKIS_UPDATED_VERSION])
Expand Down Expand Up @@ -2439,7 +2457,7 @@ echo " systemd support : ${enable_systemd:=no} (unit dir: ${systemd
echo " systemd-journal support : ${with_systemd_journal:=no}"
echo " JSON support : $with_jsonc"
echo " perf support : ${enable_perf:=no}"
echo " unwind support : ${enable_libunwind:=no}"
echo " stackdump support : ${enable_stackdump:=no}"
echo " Build options:"
echo " Generate manual pages : ${enable_manpages:=no}"
echo " Install manual pages : ${enable_manpages_install:=no}"
Expand Down
2 changes: 2 additions & 0 deletions docker/apkbuild/axoflow/axosyslog/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ makedepends="
libnet-dev
librdkafka-dev
libtool
libunwind-dev
libxml2-utils
mongo-c-driver-dev
net-snmp-dev
Expand Down Expand Up @@ -97,6 +98,7 @@ build() {
\
--enable-all-modules \
--enable-ebpf \
--disable-stackdump \
--disable-linux-caps \
--disable-smtp \
--disable-systemd \
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-getattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ filterx_getattr_new(FilterXExpr *operand, FilterXObject *attr_name)
self->super.free_fn = _free;
self->operand = operand;

filterx_object_is_type(attr_name, &FILTERX_TYPE_NAME(string));
g_assert(filterx_object_is_type(attr_name, &FILTERX_TYPE_NAME(string)));
self->attr = attr_name;
/* NOTE: name borrows the string value from the string object */
self->super.name = filterx_string_get_value_ref(self->attr, NULL);
return &self->super;
}

FILTERX_EXPR_DEFINE_TYPE(getattr);
FILTERX_EXPR_DEFINE_TYPE(getattr);
3 changes: 2 additions & 1 deletion lib/stackdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
#include <fcntl.h>
#include <unistd.h>

#if SYSLOG_NG_ENABLE_LIBUNWIND
#if SYSLOG_NG_ENABLE_STACKDUMP

#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <dlfcn.h>
#include <link.h>

/* this is Linux only for now */

Expand Down

0 comments on commit 199e4ef

Please sign in to comment.