Add journal log message with version on startup
authorTim Pepper <timothy.c.pepper@linux.intel.com>
Fri, 2 Nov 2012 22:27:24 +0000 (15:27 -0700)
committerTim Pepper <timothy.c.pepper@linux.intel.com>
Fri, 2 Nov 2012 22:27:24 +0000 (15:27 -0700)
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 <timothy.c.pepper@linux.intel.com>
configure.ac
src/Makefile.am
src/corewatcher.c
src/corewatcher.h

index 5f87c15..93fdc96 100644 (file)
@@ -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])
index af9b2c2..1d612e2 100644 (file)
@@ -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}
index f2cf25b..5061856 100644 (file)
@@ -40,7 +40,7 @@
 #include <errno.h>
 
 #include <glib.h>
-
+#include <systemd/sd-journal.h>
 
 /* 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");
index 82412a1..fc18e90 100644 (file)
@@ -24,6 +24,7 @@
  *     Tim Pepper <timothy.c.pepper@linux.intel.com>
  */
 
+#include "config.h"
 
 #ifndef __INCLUDE_GUARD_KERNELOOPS_H_
 #define __INCLUDE_GUARD_KERNELOOPS_H_