netd: Add Flush out enumerating/configuring interfaces

Signed-off-by: San Mehat <san@google.com>
diff --git a/main.cpp b/main.cpp
index 98e1c3f..7c31179 100644
--- a/main.cpp
+++ b/main.cpp
@@ -16,10 +16,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <signal.h>
 #include <errno.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 
 #include <fcntl.h>
 #include <dirent.h>
@@ -32,6 +34,7 @@
 #include "NetlinkManager.h"
 
 static void coldboot(const char *path);
+static void sigchld_handler(int sig);
 
 int main() {
 
@@ -40,6 +43,8 @@
 
     LOGI("Netd 1.0 starting");
 
+    signal(SIGCHLD, sigchld_handler);
+
     if (!(nm = NetlinkManager::Instance())) {
         LOGE("Unable to create NetlinkManager");
         exit(1);
@@ -115,3 +120,8 @@
         closedir(d);
     }
 }
+
+static void sigchld_handler(int sig) {
+    pid_t pid = wait(NULL);
+    LOGD("Child process %d exited", pid);
+}