summaryrefslogtreecommitdiff
path: root/src/system/dlt-system.c
diff options
context:
space:
mode:
authorChristian Muck <christian.muck@bmw.de>2012-06-04 09:08:52 +0200
committerChristian Muck <christian.muck@bmw.de>2012-06-13 23:52:51 +0200
commit85f564f2b4c580bc151d05559e6ed0614919da8a (patch)
tree96c41c00f70fb5545862cea3e62b26867117e33b /src/system/dlt-system.c
parentde0b686c504886187aa1e8ba4373daeff66283e5 (diff)
downloadDLT-daemon-85f564f2b4c580bc151d05559e6ed0614919da8a.tar.gz
[GDLT-90] Implemented systemd watchdog concept in dlt-system
Signed-off-by: Christian Muck <christian.muck@bmw.de>
Diffstat (limited to 'src/system/dlt-system.c')
-rw-r--r--src/system/dlt-system.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/system/dlt-system.c b/src/system/dlt-system.c
index 6e1d22e..93e0873 100644
--- a/src/system/dlt-system.c
+++ b/src/system/dlt-system.c
@@ -48,12 +48,19 @@
#include <errno.h>
#include <signal.h>
+#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE) || defined(DLT_SYSTEMD_ENABLE)
+#include "sd-daemon.h"
+#endif
+
DLT_DECLARE_CONTEXT(dltsystem)
int main(int argc, char* argv[])
{
DltSystemCliOptions options;
DltSystemConfiguration config;
+#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE) || defined(DLT_SYSTEMD_ENABLE)
+ int ret;
+#endif
if(read_command_line(&options, argc, argv) < 0)
{
@@ -68,7 +75,24 @@ int main(int argc, char* argv[])
}
DLT_REGISTER_APP(config.ApplicationId, "DLT System Manager");
DLT_REGISTER_CONTEXT(dltsystem,"MGR", "Context of main dlt system manager");
- sleep(1);
+
+#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE) || defined(DLT_SYSTEMD_ENABLE)
+ ret = sd_booted();
+
+ if(ret == 0){
+ DLT_LOG(dltsystem, DLT_LOG_INFO, DLT_STRING("system not booted with systemd!\n"));
+ }
+ else if(ret < 0)
+ {
+ DLT_LOG(dltsystem, DLT_LOG_ERROR, DLT_STRING("sd_booted failed!\n"));
+ return -1;
+ }
+ else
+ {
+ DLT_LOG(dltsystem, DLT_LOG_INFO, DLT_STRING("system booted with systemd\n"));
+ }
+#endif
+
DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("Configuration loaded."));
if(options.Daemonize > 0)