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/Makefile.am b/Makefile.am
index 6ff8965..30d5a88 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,35 +2,54 @@
 
 # Build these headers, don't install them
 noinst_HEADERS = \
-	dump_entry.hpp
+	dump_entry.hpp \
+	dump_watch.hpp
 
 nobase_nodist_include_HEADERS = \
+	xyz/openbmc_project/Dump/Monitor/error.hpp \
 	xyz/openbmc_project/Dump/Internal/Create/server.hpp
 
 sbin_PROGRAMS = \
-	phosphor-dump-manager
+	phosphor-dump-manager \
+	phosphor-dump-monitor
 
 phosphor_dump_manager_SOURCES = \
 	dump_manager_main.cpp \
 	dump_entry.cpp \
 	xyz/openbmc_project/Dump/Internal/Create/server.cpp
 
+phosphor_dump_monitor_SOURCES = \
+	dump_watch_main.cpp \
+	dump_watch.cpp \
+	xyz/openbmc_project/Dump/Monitor/error.cpp
+
 phosphor_dump_manager_CXXFLAGS = \
 	$(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
-	$(SDBUSPLUS_CFLAGS)
+	$(SDBUSPLUS_CFLAGS) \
+	$(PHOSPHOR_LOGGING_CFLAGS)
+
+phosphor_dump_monitor_CXXFLAGS = \
+	$(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
+	$(PHOSPHOR_LOGGING_CFLAGS)
 
 phosphor_dump_manager_LDADD = \
 	$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
-	$(SDBUSPLUS_LIBS)
+	$(SDBUSPLUS_LIBS) \
+	$(PHOSPHOR_LOGGING_LIBS)
+
+phosphor_dump_monitor_LDADD = \
+	$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
+	$(PHOSPHOR_LOGGING_LIBS) \
+	-lstdc++fs
 
 # Be sure to build needed files before compiling
 BUILT_SOURCES = \
-        xyz/openbmc_project/Dump/Internal/Create/server.cpp \
-        xyz/openbmc_project/Dump/Internal/Create/server.hpp
+	xyz/openbmc_project/Dump/Internal/Create/server.cpp \
+	xyz/openbmc_project/Dump/Internal/Create/server.hpp \
+	xyz/openbmc_project/Dump/Monitor/error.cpp \
+	xyz/openbmc_project/Dump/Monitor/error.hpp
 
-CLEANFILES = \
-        xyz/openbmc_project/Dump/Internal/Create/server.cpp \
-        xyz/openbmc_project/Dump/Internal/Create/server.hpp
+CLEANFILES=${BUILT_SOURCES}
 
 xyz/openbmc_project/Dump/Internal/Create/server.cpp: \
 xyz/openbmc_project/Dump/Internal/Create.interface.yaml \
@@ -44,3 +63,12 @@
 	@mkdir -p `dirname $@`
 	$(SDBUSPLUSPLUS) -r $(srcdir) interface server-header \
 xyz.openbmc_project.Dump.Internal.Create > $@
+
+xyz/openbmc_project/Dump/Monitor/error.hpp: \
+${top_srcdir}/xyz/openbmc_project/Dump/Monitor.errors.yaml
+	@mkdir -p `dirname $@`
+	$(SDBUSPLUSPLUS) -r $(srcdir) error exception-header xyz.openbmc_project.Dump.Monitor > $@
+
+xyz/openbmc_project/Dump/Monitor/error.cpp: ${top_srcdir}/xyz/openbmc_project/Dump/Monitor.errors.yaml
+	@mkdir -p `dirname $@`
+	$(SDBUSPLUSPLUS) -r $(srcdir) error exception-cpp xyz.openbmc_project.Dump.Monitor > $@