From 260e1d4c48244ee00d098e1d4aa22e737b7bf3ec Mon Sep 17 00:00:00 2001 From: Tim Pepper Date: Fri, 2 Nov 2012 15:27:24 -0700 Subject: [PATCH] Add journal log message with version on startup This journal message should show up on a 'systemctl status' for the service, aiding in debug by clearly identifying the running version. Signed-off-by: Tim Pepper --- configure.ac | 1 + src/Makefile.am | 2 +- src/corewatcher.c | 4 +++- src/corewatcher.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5f87c15..93fdc96 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,7 @@ AC_PROG_INSTALL # PkgConfig tests PKG_CHECK_MODULES([glib], [glib-2.0 gthread-2.0]) PKG_CHECK_MODULES([curl], [libcurl]) +PKG_CHECK_MODULES([systemd_journal], [libsystemd-journal]) # Checks for header files. AC_CHECK_HEADERS([stdio.h assert.h sys/types.h sys/stat.h dirent.h signal.h errno.h sched.h fcntl.h stdlib.h string.h sys/time.h syslog.h unistd.h asm/unistd.h]) diff --git a/src/Makefile.am b/src/Makefile.am index af9b2c2..1d612e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,4 +19,4 @@ noinst_HEADERS = \ corewatcher.h AM_CPPFLAGS = $(AM_CFLAGS) $(glib_CFLAGS) ${curl_CFLAGS} -corewatcher_LDADD = $(glib_LIBS) ${curl_LIBS} +corewatcher_LDADD = $(glib_LIBS) ${curl_LIBS} ${systemd_journal_LIBS} diff --git a/src/corewatcher.c b/src/corewatcher.c index f2cf25b..5061856 100644 --- a/src/corewatcher.c +++ b/src/corewatcher.c @@ -40,7 +40,7 @@ #include #include - +#include /* see linux kernel doc Documentation/block/ioprio.txt */ #define IOPRIO_WHO_PROCESS 1 @@ -197,6 +197,8 @@ int main(int argc, char**argv) return EXIT_SUCCESS; } + sd_journal_print(LOG_INFO, "Nitra corewatcher %s", VERSION); + inotify_thread = g_thread_new("corewatcher inotify", inotify_loop, NULL); if (inotify_thread == NULL) fprintf(stderr, "+ Unable to start inotify thread\n"); diff --git a/src/corewatcher.h b/src/corewatcher.h index 82412a1..fc18e90 100644 --- a/src/corewatcher.h +++ b/src/corewatcher.h @@ -24,6 +24,7 @@ * Tim Pepper */ +#include "config.h" #ifndef __INCLUDE_GUARD_KERNELOOPS_H_ #define __INCLUDE_GUARD_KERNELOOPS_H_ -- 2.7.4