From 95b72fb9c9c2e3a1ff6f92d8c323bdc3947e540d Mon Sep 17 00:00:00 2001 From: Andrej Manduch Date: Tue, 3 Mar 2015 12:51:42 -0500 Subject: [PATCH] Added option for journal-style logging Signed-off-by: Andrej Manduch Signed-off-by: Neil Horman --- configure.ac | 8 ++++++++ irqbalance.1 | 4 ++++ irqbalance.c | 21 +++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 885f10b..b054ebd 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,14 @@ AC_C_CONST AC_C_INLINE AM_PROG_CC_C_O +AC_ARG_WITH([systemd], + [ AS_HELP_STRING([--with-systemd],[Add systemd logging support])], +) +AS_IF( + [test "x$with_systemd" = xyes], + [AC_DEFINE(HAVE_SYSTEMD, 1, [systemd support])] +) + AC_ARG_WITH([glib2], [AS_HELP_STRING([--without-glib2], [Don't use system glib2 library. Use local implementation instead.])], diff --git a/irqbalance.1 b/irqbalance.1 index b6f451a..14d5d98 100644 --- a/irqbalance.1 +++ b/irqbalance.1 @@ -45,6 +45,10 @@ Causes irqbalance to print extra debug information. Implies --foreground. .B -f, --foreground Causes irqbalance to run in the foreground (without --debug). +.TP +.B -j, --journal +Enables log output optimized for systemd-journal. + .TP .B -h, --hintpolicy=[exact | subset | ignore] Set the policy for how IRQ kernel affinity hinting is treated. Can be one of: diff --git a/irqbalance.c b/irqbalance.c index bb8c3da..4059ef5 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -46,6 +46,7 @@ int one_shot_mode; int debug_mode; int foreground_mode; int numa_avail; +int journal_logging = 0; int need_rescan; unsigned int log_mask = TO_ALL; enum hp_e global_hint_policy = HINT_POLICY_IGNORE; @@ -83,12 +84,15 @@ struct option lopts[] = { {"deepestcache", 1, NULL, 'c'}, {"policyscript", 1, NULL, 'l'}, {"pid", 1, NULL, 's'}, +#ifdef HAVE_SYSTEMD + {"journal", 0, NULL, 'j'}, +#endif /* HAVE_SYSTEMD */ {0, 0, 0, 0} }; static void usage(void) { - log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--hintpolicy= | -h [exact|subset|ignore]]\n"); + log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j] [--hintpolicy= | -h [exact|subset|ignore]]\n"); log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p | ] [--banirq= | -i ] [--policyscript=