Move listeners to separate dir
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 24 Apr 2017 19:44:37 +0000 (21:44 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 24 Apr 2017 19:44:37 +0000 (21:44 +0200)
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
src/audit.c [deleted file]
src/audit.h [deleted file]
src/listeners/audit.c [new file with mode: 0644]
src/listeners/audit.h [new file with mode: 0644]
src/listeners/systemd.c [new file with mode: 0644]
src/listeners/systemd.h [new file with mode: 0644]
src/systemd.c [deleted file]
src/systemd.h [deleted file]

diff --git a/src/audit.c b/src/audit.c
deleted file mode 100644 (file)
index 23acfa4..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * This file is a part of faultd.
- *
- * Copyright © 2017 Samsung Electronics
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define _GNU_SOURCE 1
-
-#include <errno.h>
-#include <libaudit.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <systemd/sd-event.h>
-#include <unistd.h>
-
-#include "audit.h"
-#include "log.h"
-
-static struct audit_rule_data rule_data = {
-       .flags = AUDIT_FILTER_EXIT, /* trigger on exit from syscall */
-       .action = AUDIT_ALWAYS, /* always catch matching syscall */
-       .field_count = 1,
-       .fields = {AUDIT_EXIT}, /* watch exit code */
-       .values = {-EMFILE},
-       .fieldflags = {AUDIT_EQUAL}, /* trigger if equal to value*/
-};
-
-static int audit_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata);
-
-enum {
-       KEY_PID,
-       KEY_UNKNOWN,
-};
-
-struct event {
-       time_t timestamp;
-       int pid;
-};
-
-static int str2key(char *p, int len)
-{
-       if (strncmp(p, "pid", len) == 0)
-               return KEY_PID;
-
-       return KEY_UNKNOWN;
-}
-
-static int parse_event(char *message, int len, struct event *event)
-{
-       char *p = message;
-       char *e;
-       int key;
-
-       p = strchr(p, '(');
-       if (!p)
-               return -1;
-
-       ++p;
-       event->timestamp = strtol(p, &p, 10);
-        event->pid = 0;
-
-       while ((p = strchr(p, ' ')) != 0) {
-               ++p;
-               e = strchr(p, '=');
-               key = str2key(p, e - p);
-
-               p = e + 1;
-               e = strchrnul(p, ' ');
-
-               switch (key) {
-               case KEY_PID:
-                       event->pid = strtol(p, &p, 10);
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       return 0;
-}
-
-static int audit_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata)
-{
-       struct audit_reply reply;
-       int ret;
-       struct event ev;
-
-       ret = audit_get_reply(fd, &reply, GET_REPLY_NONBLOCKING, 0);
-       if (ret < 0) {
-               log_error("Could not get reply.\n");
-               return ret;
-       }
-
-       if (reply.type != AUDIT_SYSCALL)
-               return 0;
-
-       reply.message[reply.len] = '\0';
-       ret = parse_event(reply.message, reply.len, &ev);
-       if (ret < 0) {
-               log_error("Could not parse event\n");
-               return ret;
-       }
-
-       log_debug("timestamp = %ld, pid = %d\n", ev.timestamp, ev.pid);
-
-       return 0;
-}
-
-int faultd_audit_init(sd_event *event)
-{
-       int fd;
-       int ret;
-
-       fd = audit_open();
-       if (fd < 0) {
-          log_error("Could not open audit socket: %m\n");
-               return fd;
-       }
-
-       ret = audit_set_pid(fd, getpid(), WAIT_YES);
-       if (ret < 0) {
-               log_error("Could not set pid (%d)\n", ret);
-               return ret;
-       }
-
-       ret = sd_event_add_io(event, NULL, fd, EPOLLIN, audit_handler, NULL);
-       if (ret < 0) {
-                log_error_errno(ret, "Could not add io event: %m");
-               return ret;
-       }
-
-       /* TODO: select only relevant syscalls */
-       audit_rule_syscallbyname_data(&rule_data, "all");
-
-       ret = audit_add_rule_data(fd, &rule_data, AUDIT_FILTER_EXIT, AUDIT_ALWAYS);
-       if (ret <= 0 && ret != -EEXIST) {
-                log_error("Could not add rule (%d).", ret);
-               return ret;
-       }
-
-       return fd;
-}
-
-int faultd_audit_close(int fd)
-{
-       int ret;
-
-       ret = audit_delete_rule_data(fd, &rule_data, AUDIT_FILTER_EXIT, AUDIT_ALWAYS);
-       if (ret < 0 && ret != -EEXIST) {
-               log_error("Could not add rule (%d)", ret);
-               return ret;
-       }
-
-       ret = audit_set_pid(fd, 0, WAIT_YES);
-       if (ret < 0) {
-               log_error("Could not set pid (%d)", ret);
-               return ret;
-       }
-
-       audit_close(fd);
-       return 0;
-}
diff --git a/src/audit.h b/src/audit.h
deleted file mode 100644 (file)
index 3e46812..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef FAULTD_AUDIT_H
-#define FAULTD_AUDIT_H
-
-/** Initialize communication with audit and set the rules
- * @return audit fd */
-int faultd_audit_init(sd_event *event);
-
-/** Close audit and remove added rules */
-int faultd_audit_close(int fd);
-
-#endif /* FAULT_AUDIT_H */
diff --git a/src/listeners/audit.c b/src/listeners/audit.c
new file mode 100644 (file)
index 0000000..23acfa4
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * This file is a part of faultd.
+ *
+ * Copyright © 2017 Samsung Electronics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE 1
+
+#include <errno.h>
+#include <libaudit.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <systemd/sd-event.h>
+#include <unistd.h>
+
+#include "audit.h"
+#include "log.h"
+
+static struct audit_rule_data rule_data = {
+       .flags = AUDIT_FILTER_EXIT, /* trigger on exit from syscall */
+       .action = AUDIT_ALWAYS, /* always catch matching syscall */
+       .field_count = 1,
+       .fields = {AUDIT_EXIT}, /* watch exit code */
+       .values = {-EMFILE},
+       .fieldflags = {AUDIT_EQUAL}, /* trigger if equal to value*/
+};
+
+static int audit_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata);
+
+enum {
+       KEY_PID,
+       KEY_UNKNOWN,
+};
+
+struct event {
+       time_t timestamp;
+       int pid;
+};
+
+static int str2key(char *p, int len)
+{
+       if (strncmp(p, "pid", len) == 0)
+               return KEY_PID;
+
+       return KEY_UNKNOWN;
+}
+
+static int parse_event(char *message, int len, struct event *event)
+{
+       char *p = message;
+       char *e;
+       int key;
+
+       p = strchr(p, '(');
+       if (!p)
+               return -1;
+
+       ++p;
+       event->timestamp = strtol(p, &p, 10);
+        event->pid = 0;
+
+       while ((p = strchr(p, ' ')) != 0) {
+               ++p;
+               e = strchr(p, '=');
+               key = str2key(p, e - p);
+
+               p = e + 1;
+               e = strchrnul(p, ' ');
+
+               switch (key) {
+               case KEY_PID:
+                       event->pid = strtol(p, &p, 10);
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static int audit_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata)
+{
+       struct audit_reply reply;
+       int ret;
+       struct event ev;
+
+       ret = audit_get_reply(fd, &reply, GET_REPLY_NONBLOCKING, 0);
+       if (ret < 0) {
+               log_error("Could not get reply.\n");
+               return ret;
+       }
+
+       if (reply.type != AUDIT_SYSCALL)
+               return 0;
+
+       reply.message[reply.len] = '\0';
+       ret = parse_event(reply.message, reply.len, &ev);
+       if (ret < 0) {
+               log_error("Could not parse event\n");
+               return ret;
+       }
+
+       log_debug("timestamp = %ld, pid = %d\n", ev.timestamp, ev.pid);
+
+       return 0;
+}
+
+int faultd_audit_init(sd_event *event)
+{
+       int fd;
+       int ret;
+
+       fd = audit_open();
+       if (fd < 0) {
+          log_error("Could not open audit socket: %m\n");
+               return fd;
+       }
+
+       ret = audit_set_pid(fd, getpid(), WAIT_YES);
+       if (ret < 0) {
+               log_error("Could not set pid (%d)\n", ret);
+               return ret;
+       }
+
+       ret = sd_event_add_io(event, NULL, fd, EPOLLIN, audit_handler, NULL);
+       if (ret < 0) {
+                log_error_errno(ret, "Could not add io event: %m");
+               return ret;
+       }
+
+       /* TODO: select only relevant syscalls */
+       audit_rule_syscallbyname_data(&rule_data, "all");
+
+       ret = audit_add_rule_data(fd, &rule_data, AUDIT_FILTER_EXIT, AUDIT_ALWAYS);
+       if (ret <= 0 && ret != -EEXIST) {
+                log_error("Could not add rule (%d).", ret);
+               return ret;
+       }
+
+       return fd;
+}
+
+int faultd_audit_close(int fd)
+{
+       int ret;
+
+       ret = audit_delete_rule_data(fd, &rule_data, AUDIT_FILTER_EXIT, AUDIT_ALWAYS);
+       if (ret < 0 && ret != -EEXIST) {
+               log_error("Could not add rule (%d)", ret);
+               return ret;
+       }
+
+       ret = audit_set_pid(fd, 0, WAIT_YES);
+       if (ret < 0) {
+               log_error("Could not set pid (%d)", ret);
+               return ret;
+       }
+
+       audit_close(fd);
+       return 0;
+}
diff --git a/src/listeners/audit.h b/src/listeners/audit.h
new file mode 100644 (file)
index 0000000..3e46812
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef FAULTD_AUDIT_H
+#define FAULTD_AUDIT_H
+
+/** Initialize communication with audit and set the rules
+ * @return audit fd */
+int faultd_audit_init(sd_event *event);
+
+/** Close audit and remove added rules */
+int faultd_audit_close(int fd);
+
+#endif /* FAULT_AUDIT_H */
diff --git a/src/listeners/systemd.c b/src/listeners/systemd.c
new file mode 100644 (file)
index 0000000..f53ab4c
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * This file is part of faultd.
+ *
+ * Copyright © 2017 Samsung Electronics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <poll.h>
+#include <systemd/sd-bus.h>
+#include <systemd/sd-event.h>
+
+#include "systemd.h"
+#include "log.h"
+
+static int on_unit_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error);
+
+int  faultd_systemd_init(sd_event* loop) {
+  sd_bus_error error = SD_BUS_ERROR_NULL;
+  sd_bus *bus = NULL;
+  int rc;
+
+  rc = sd_bus_default_system(&bus);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to acquire the defult system bus connection.");
+    return -1;
+  }
+
+  rc = sd_bus_attach_event(bus, loop, SD_EVENT_PRIORITY_NORMAL);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to attach the bus to the event loop.");
+    return -1;
+  }
+
+  rc = sd_bus_add_match(bus,
+                        NULL,
+                        "type='signal',sender='org.freedesktop.systemd1',"
+                        "interface='org.freedesktop.DBus.Properties',"
+                        "member='PropertiesChanged',"
+                        "path_namespace='/org/freedesktop/systemd1/unit'",
+                        on_unit_properties_changed,
+                        NULL);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to add match.");
+    return -1;
+  }
+
+  rc = sd_bus_call_method(bus,
+                         "org.freedesktop.systemd1",
+                         "/org/freedesktop/systemd1",
+                         "org.freedesktop.systemd1.Manager",
+                         "Subscribe",
+                         &error,
+                         NULL, NULL);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to subscribe.");
+    return -1;
+  }
+
+  return 0;
+}
+
+int faultd_systemd_close() {
+  sd_bus_error error = SD_BUS_ERROR_NULL;
+  sd_bus *bus = NULL;
+  int rc;
+
+  rc = sd_bus_default_system(&bus);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to acquire the defult system bus connection.");
+    return -1;
+  }
+
+  rc = sd_bus_call_method(bus,
+                         "org.freedesktop.systemd1",
+                         "/org/freedesktop/systemd1",
+                         "org.freedesktop.systemd1.Manager",
+                         "Unsubscribe",
+                         &error,
+                         NULL, NULL);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to unsubscribe.");
+    return -1;
+  }
+  return 0;
+}
+
+static int on_unit_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+  int rc = 1;
+  const char *interface;
+  /* const char* path; */
+  /* path = NULL; */
+  uint8_t type;
+
+  rc = sd_bus_message_read(m, "s", &interface);
+  if (rc < 0) {
+    log_error_errno(rc, "Invalid message format.");
+    goto finish;
+  }
+  if (strcmp("org.freedesktop.systemd1.Unit", interface) != 0) {
+    rc = 0;
+    goto finish;
+  }
+
+  fprintf(stdout,"'");
+  fflush(stdout);
+  rc = sd_bus_message_get_type(m, &type);
+  if (rc < 0) {
+    log_error_errno(rc, "Failed to get message type.");
+    goto finish;
+  }
+
+  log_debug("Received a message!");
+  log_debug("    Type: %s",
+            type ==  SD_BUS_MESSAGE_METHOD_CALL ? "method call" :
+            (type ==  SD_BUS_MESSAGE_METHOD_RETURN ? "method return" :
+             (type ==  SD_BUS_MESSAGE_METHOD_ERROR ? "method error" :
+              (type ==  SD_BUS_MESSAGE_SIGNAL ? "signal" : "INVALID"))));
+  log_debug("    Interface:  %s", sd_bus_message_get_interface(m));
+  log_debug("    Member:     %s", sd_bus_message_get_member(m));
+  log_debug("    Path:       %s", sd_bus_message_get_path(m));
+  log_debug("    Message If: %s", interface);
+
+  rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "{sv}");
+  if (rc < 0) {
+    rc = 0;
+  }
+  log_debug("    Message dictionary:");
+  while((rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) {
+    const char *key;
+
+    rc = sd_bus_message_read(m, "s", &key);
+    if (rc < 0) {
+      log_error_errno(rc, "Failed to read a DICT_ENTRY: %m.");
+      rc = 0;
+      goto finish;
+    }
+
+    if (strcmp("ActiveState", key) == 0) {
+      const char *value;
+
+      rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_VARIANT, "s");
+      if (rc < 0) {
+        /* XXX */
+        rc = 0;
+        goto finish;
+      }
+      rc = sd_bus_message_read(m, "s", &value);
+      if (rc < 0) {
+        log_error_errno(rc, "Failed to read the AciveSate value: %m.");
+        rc = 0;
+        goto finish;
+      }
+      rc = sd_bus_message_exit_container(m);
+      log_debug("        %s:%s", key, value);
+
+    } else {
+      log_debug("        %s", key);
+      rc = sd_bus_message_skip(m, "v");
+      if (rc < 0) {
+        fprintf(stderr, "Failed to skip a value.");
+        rc = 0;
+        goto finish;
+      }
+    }
+
+    rc = sd_bus_message_exit_container(m);
+    if (rc < 0) {
+      log_error_errno(rc, "Failed to exit a container: %s.", strerror(-rc));
+      rc = 0;
+      goto finish;
+    }
+  }
+
+  rc = sd_bus_message_exit_container(m);
+  if (rc < 0) {
+    rc = 0;
+  }
+finish:
+  return rc;
+}
diff --git a/src/listeners/systemd.h b/src/listeners/systemd.h
new file mode 100644 (file)
index 0000000..64ec722
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef FAULTD_SYSTEMD_H
+#define FAULTD_SYSTEMD_H
+
+/** Initialize communication with DBus and subscribe for systemd signals
+ * @return status */
+int faultd_systemd_init(sd_event *loop);
+
+/** Unsubscribe from systemd signals
+ * @reurn  status */
+int faultd_systemd_close(void);
+
+#endif /* FAULT_SYSTEMD_H */
diff --git a/src/systemd.c b/src/systemd.c
deleted file mode 100644 (file)
index f53ab4c..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * This file is part of faultd.
- *
- * Copyright © 2017 Samsung Electronics
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <poll.h>
-#include <systemd/sd-bus.h>
-#include <systemd/sd-event.h>
-
-#include "systemd.h"
-#include "log.h"
-
-static int on_unit_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error);
-
-int  faultd_systemd_init(sd_event* loop) {
-  sd_bus_error error = SD_BUS_ERROR_NULL;
-  sd_bus *bus = NULL;
-  int rc;
-
-  rc = sd_bus_default_system(&bus);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to acquire the defult system bus connection.");
-    return -1;
-  }
-
-  rc = sd_bus_attach_event(bus, loop, SD_EVENT_PRIORITY_NORMAL);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to attach the bus to the event loop.");
-    return -1;
-  }
-
-  rc = sd_bus_add_match(bus,
-                        NULL,
-                        "type='signal',sender='org.freedesktop.systemd1',"
-                        "interface='org.freedesktop.DBus.Properties',"
-                        "member='PropertiesChanged',"
-                        "path_namespace='/org/freedesktop/systemd1/unit'",
-                        on_unit_properties_changed,
-                        NULL);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to add match.");
-    return -1;
-  }
-
-  rc = sd_bus_call_method(bus,
-                         "org.freedesktop.systemd1",
-                         "/org/freedesktop/systemd1",
-                         "org.freedesktop.systemd1.Manager",
-                         "Subscribe",
-                         &error,
-                         NULL, NULL);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to subscribe.");
-    return -1;
-  }
-
-  return 0;
-}
-
-int faultd_systemd_close() {
-  sd_bus_error error = SD_BUS_ERROR_NULL;
-  sd_bus *bus = NULL;
-  int rc;
-
-  rc = sd_bus_default_system(&bus);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to acquire the defult system bus connection.");
-    return -1;
-  }
-
-  rc = sd_bus_call_method(bus,
-                         "org.freedesktop.systemd1",
-                         "/org/freedesktop/systemd1",
-                         "org.freedesktop.systemd1.Manager",
-                         "Unsubscribe",
-                         &error,
-                         NULL, NULL);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to unsubscribe.");
-    return -1;
-  }
-  return 0;
-}
-
-static int on_unit_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
-  int rc = 1;
-  const char *interface;
-  /* const char* path; */
-  /* path = NULL; */
-  uint8_t type;
-
-  rc = sd_bus_message_read(m, "s", &interface);
-  if (rc < 0) {
-    log_error_errno(rc, "Invalid message format.");
-    goto finish;
-  }
-  if (strcmp("org.freedesktop.systemd1.Unit", interface) != 0) {
-    rc = 0;
-    goto finish;
-  }
-
-  fprintf(stdout,"'");
-  fflush(stdout);
-  rc = sd_bus_message_get_type(m, &type);
-  if (rc < 0) {
-    log_error_errno(rc, "Failed to get message type.");
-    goto finish;
-  }
-
-  log_debug("Received a message!");
-  log_debug("    Type: %s",
-            type ==  SD_BUS_MESSAGE_METHOD_CALL ? "method call" :
-            (type ==  SD_BUS_MESSAGE_METHOD_RETURN ? "method return" :
-             (type ==  SD_BUS_MESSAGE_METHOD_ERROR ? "method error" :
-              (type ==  SD_BUS_MESSAGE_SIGNAL ? "signal" : "INVALID"))));
-  log_debug("    Interface:  %s", sd_bus_message_get_interface(m));
-  log_debug("    Member:     %s", sd_bus_message_get_member(m));
-  log_debug("    Path:       %s", sd_bus_message_get_path(m));
-  log_debug("    Message If: %s", interface);
-
-  rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "{sv}");
-  if (rc < 0) {
-    rc = 0;
-  }
-  log_debug("    Message dictionary:");
-  while((rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) {
-    const char *key;
-
-    rc = sd_bus_message_read(m, "s", &key);
-    if (rc < 0) {
-      log_error_errno(rc, "Failed to read a DICT_ENTRY: %m.");
-      rc = 0;
-      goto finish;
-    }
-
-    if (strcmp("ActiveState", key) == 0) {
-      const char *value;
-
-      rc = sd_bus_message_enter_container(m, SD_BUS_TYPE_VARIANT, "s");
-      if (rc < 0) {
-        /* XXX */
-        rc = 0;
-        goto finish;
-      }
-      rc = sd_bus_message_read(m, "s", &value);
-      if (rc < 0) {
-        log_error_errno(rc, "Failed to read the AciveSate value: %m.");
-        rc = 0;
-        goto finish;
-      }
-      rc = sd_bus_message_exit_container(m);
-      log_debug("        %s:%s", key, value);
-
-    } else {
-      log_debug("        %s", key);
-      rc = sd_bus_message_skip(m, "v");
-      if (rc < 0) {
-        fprintf(stderr, "Failed to skip a value.");
-        rc = 0;
-        goto finish;
-      }
-    }
-
-    rc = sd_bus_message_exit_container(m);
-    if (rc < 0) {
-      log_error_errno(rc, "Failed to exit a container: %s.", strerror(-rc));
-      rc = 0;
-      goto finish;
-    }
-  }
-
-  rc = sd_bus_message_exit_container(m);
-  if (rc < 0) {
-    rc = 0;
-  }
-finish:
-  return rc;
-}
diff --git a/src/systemd.h b/src/systemd.h
deleted file mode 100644 (file)
index 64ec722..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef FAULTD_SYSTEMD_H
-#define FAULTD_SYSTEMD_H
-
-/** Initialize communication with DBus and subscribe for systemd signals
- * @return status */
-int faultd_systemd_init(sd_event *loop);
-
-/** Unsubscribe from systemd signals
- * @reurn  status */
-int faultd_systemd_close(void);
-
-#endif /* FAULT_SYSTEMD_H */