Added option for journal-style logging
Signed-off-by: Andrej Manduch <amanduch@gmail.com> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
d97006c50c
commit
95b72fb9c9
|
@ -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.])],
|
||||
|
|
|
@ -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:
|
||||
|
|
21
irqbalance.c
21
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 <off> | <n>] [--banirq= | -i <n>] [--policyscript=<script>] [--pid= | -s <file>] [--deepestcache= | -c <n>]\n");
|
||||
}
|
||||
|
||||
|
@ -99,7 +103,7 @@ static void parse_command_line(int argc, char **argv)
|
|||
unsigned long val;
|
||||
|
||||
while ((opt = getopt_long(argc, argv,
|
||||
"odfh:i:p:s:c:b:l:",
|
||||
"odfjh:i:p:s:c:b:l:",
|
||||
lopts, &longind)) != -1) {
|
||||
|
||||
switch(opt) {
|
||||
|
@ -173,6 +177,11 @@ static void parse_command_line(int argc, char **argv)
|
|||
case 's':
|
||||
pidfile = optarg;
|
||||
break;
|
||||
#ifdef HAVE_SYSTEMD
|
||||
case 'j':
|
||||
journal_logging=1;
|
||||
break;
|
||||
#endif /* HAVE_SYSTEMD */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +259,7 @@ int main(int argc, char** argv)
|
|||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
parse_command_line(argc, argv);
|
||||
#else
|
||||
#else /* ! HAVE_GETOPT_LONG */
|
||||
if (argc>1 && strstr(argv[1],"--debug")) {
|
||||
debug_mode=1;
|
||||
foreground_mode=1;
|
||||
|
@ -259,7 +268,11 @@ int main(int argc, char** argv)
|
|||
foreground_mode=1;
|
||||
if (argc>1 && strstr(argv[1],"--oneshot"))
|
||||
one_shot_mode=1;
|
||||
#endif
|
||||
# ifdef HAVE_SYSTEMD
|
||||
if (argc>1 && strstr(argv[1],"--journal"))
|
||||
journal_logging=1;
|
||||
# endif /* HAVE_SYSTEMD */
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
|
||||
/*
|
||||
* Open the syslog connection
|
||||
|
|
Loading…
Reference in New Issue