sync/watch: reduce memory usage

Currently we get a different inotify handle for every file in the
synclist, and register all of them with sd_event.  A single fd will
work and saves memory in libsystemd and the kernel, so do that instead.

This in turn allows the fileMap structure to be simplified down to a
basic map of watch descriptor / filename pairs.

Remove redundant calls to both close and inotify_rm_watch - let the
kernel do the work for us.  From the inotify man page:

  When all file descriptors referring to an inotify instance have been
  closed (using close(2)), the underlying object and its resources are
  freed for reuse by the kernel; all associated watches are auto‐
  matically freed.

Change-Id: Ia63cb667cdf41c171276a0351d95347a54578f2f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/sync_watch.hpp b/sync_watch.hpp
index 3ad5afd..126c50c 100644
--- a/sync_watch.hpp
+++ b/sync_watch.hpp
@@ -63,7 +63,8 @@
     /** @brief Map of file descriptors, watch descriptors, and file paths */
     using fd = int;
     using wd = int;
-    std::map<fd, std::map<wd, fs::path>> fileMap;
+    fd inotifyFd;
+    std::map<wd, fs::path> fileMap;
 
     /** @brief The callback function for processing the inotify event */
     std::function<int(int, fs::path&)> syncCallback;