From b0eee73d593b0d8c884b01d5691857506f24daba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Tue, 26 Apr 2016 16:50:50 +0200 Subject: [PATCH 5/6] Feature: allow skipping "coredump nursing" phase This effectively eliminates the last dependency on glue libraries. --- configure.ac | 11 +++++++++++ src/Makefile.am | 6 +++++- src/main.c | 12 +++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index bb2e3a8..cb4eeb1 100644 --- a/configure.ac +++ b/configure.ac @@ -289,6 +289,16 @@ libsystemd) esac AM_CONDITIONAL([NAMETAG_LIBSYSTEMD], [test "x$nametag_provider" = "xlibsystemd"]) +# figure out if "coredump nursing" supported and desired +coredump_nursing="no" +if test "x$with_glue" != "xno"; then + AC_CHECK_LIB([plumb], [cl_enable_coredumps], [coredump_nursing="libplumb"]) +fi +if test "x$coredump_nursing" != "xno"; then + AC_DEFINE(COREDUMP_NURSING, [], [eligible for coredump nursing]) +fi +AM_CONDITIONAL([COREDUMP_NURSING], [test "x$coredump_nursing" != "xno"]) + # OS detection # THIS SECTION MUST DIE! CP=cp @@ -520,6 +530,7 @@ AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}]) AC_MSG_RESULT([ Logging provider = ${logging_provider}]) AC_MSG_RESULT([ Range2random provider = ${range2random_provider}]) AC_MSG_RESULT([ Nametag provider = ${nametag_provider}]) +AC_MSG_RESULT([ Coredump nursing = ${coredump_nursing}]) AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE build info:]) AC_MSG_RESULT([ Library SONAME = ${SONAME}]) diff --git a/src/Makefile.am b/src/Makefile.am index 69b7b48..2a985ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,7 +22,7 @@ boothd_SOURCES += auth.c endif boothd_LDFLAGS = $(OS_DYFLAGS) -L./ -boothd_LDADD = -lplumb -lm $(GLIB_LIBS) $(ZLIB_LIBS) +boothd_LDADD = -lm $(GLIB_LIBS) $(ZLIB_LIBS) boothd_CFLAGS = $(GLIB_CFLAGS) if !LOGGING_LIBQB @@ -49,5 +49,9 @@ boothd_SOURCES += alt/nametag_libsystemd.c noinst_HEADERS += alt/nametag_libsystemd.h endif +if COREDUMP_NURSING +boothd_LDADD += -lplumb +endif + lint: -splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c diff --git a/src/main.c b/src/main.c index 27d285c..0693f18 100644 --- a/src/main.c +++ b/src/main.c @@ -33,9 +33,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -47,12 +44,19 @@ #include #include #include + +#include + #include "b_config.h" #ifndef NAMETAG_LIBSYSTEMD #include #else #include "alt/nametag_libsystemd.h" #endif +#ifdef COREDUMP_NURSING +#include +#include +#endif #include "log.h" #include "booth.h" #include "config.h" @@ -1457,11 +1461,13 @@ static int do_server(int type) if (rv) return rv; +#ifdef COREDUMP_NURSING if (cl_enable_coredumps(TRUE) < 0){ log_error("enabling core dump failed"); } cl_cdtocoredir(); prctl(PR_SET_DUMPABLE, (unsigned long)TRUE, 0UL, 0UL, 0UL); +#endif signal(SIGCHLD, (__sighandler_t)wait_child); rv = loop(lock_fd); -- 2.4.11