sysd_monitor: Initial application framework
This sets the base for a sequence of commits which will enable the
functionality defined within this design document:
https://github.com/openbmc/docs/blob/master/designs/target-fail-monitoring.md
All TODO comments will be complete by the end of this patch set
sequence.
Change-Id: Ifb263ad5e4db6f07fe0b1a4638fb052e5d8beaa5
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/Makefile.am b/Makefile.am
index 03c452b..1be2555 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,8 @@
phosphor-chassis-state-manager \
phosphor-bmc-state-manager \
phosphor-discover-system-state \
- phosphor-host-check
+ phosphor-host-check \
+ phosphor-systemd-target-monitor
dist_bin_SCRIPTS = \
obmcutil
@@ -30,6 +31,9 @@
phosphor_host_check_SOURCES = \
host_check_main.cpp
+phosphor_systemd_target_monitor_SOURCES = \
+ systemd_target_monitor.cpp
+
generic_cxxflags = \
$(SYSTEMD_CFLAGS) \
$(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
@@ -61,3 +65,11 @@
phosphor_host_check_CXXFLAGS = $(generic_cxxflags)
phosphor_host_check_LDFLAGS = $(generic_ldflags)
+
+phosphor_systemd_target_monitor_CXXFLAGS = \
+ $(generic_cxxflags) \
+ $(SDEVENTPLUS_CFLAGS)
+phosphor_systemd_target_monitor_LDFLAGS = \
+ $(generic_ldflags) \
+ $(SDEVENTPLUS_LIBS) \
+ -lstdc++fs
diff --git a/systemd_target_monitor.cpp b/systemd_target_monitor.cpp
new file mode 100644
index 0000000..b9af29f
--- /dev/null
+++ b/systemd_target_monitor.cpp
@@ -0,0 +1,18 @@
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
+int main(int argc, char* argv[])
+{
+ auto bus = sdbusplus::bus::new_default();
+ auto event = sdeventplus::Event::get_default();
+ bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
+
+ // TODO - Process input parameters
+
+ // TODO - Load in json config file(s)
+
+ // TODO - Begin monitoring for systemd unit changes and logging appropriate
+ // errors
+
+ return event.loop();
+}