Initial commit for the Dump core file monitor infrastructure.

Add an inotify watch to the known core dump location.

Resolves openbmc/openbmc#1504

Change-Id: I0093c9f601d82917ca2efb53a4d47ed98f0eaa7f
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/dump_watch_main.cpp b/dump_watch_main.cpp
new file mode 100644
index 0000000..6c7d98b
--- /dev/null
+++ b/dump_watch_main.cpp
@@ -0,0 +1,43 @@
+#include <exception>
+#include "dump_watch.hpp"
+#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include "elog-errors.hpp"
+#include <xyz/openbmc_project/Dump/Monitor/error.hpp>
+#include "xyz/openbmc_project/Common/error.hpp"
+
+int main(int argc, char* argv[])
+{
+    sd_event* loop = nullptr;
+    sd_event_default(&loop);
+
+    using namespace phosphor::logging;
+
+    using InvalidCorePath =
+        sdbusplus::xyz::openbmc_project::Dump::Monitor::Error::InvalidCorePath;
+    using InternalFailure =
+        sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+
+    try
+    {
+        phosphor::dump::inotify::Watch watch(loop);
+        sd_event_loop(loop);
+    }
+
+    catch (InvalidCorePath& e)
+    {
+        commit<InvalidCorePath>();
+        return -1;
+    }
+
+    catch (InternalFailure& e)
+    {
+        commit<InternalFailure>();
+        return -1;
+    }
+
+    sd_event_unref(loop);
+
+    return 0;
+}