From: Gabriel Corona Date: Fri, 10 Apr 2015 10:15:27 +0000 (+0200) Subject: [mc] Kill the MCed process if/when the MCer dies X-Git-Tag: v3_12~732^2~64 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/92afe9670ecc5246040dad7a9d6b805f9c8f84cb?hp=4ccb50bf15bbe1f967b1232f2c56695bd6439d6e [mc] Kill the MCed process if/when the MCer dies --- diff --git a/src/mc/simgrid_mc.cpp b/src/mc/simgrid_mc.cpp index 0c8899bbee..71d0388828 100644 --- a/src/mc/simgrid_mc.cpp +++ b/src/mc/simgrid_mc.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -38,6 +39,10 @@ static const bool trace = true; static int do_child(int socket, char** argv) { XBT_DEBUG("Inside the child process PID=%i", (int) getpid()); + if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0) { + std::perror("simgrid-mc"); + return MC_SERVER_ERROR; + } int res; // Remove CLOEXEC in order to pass the socket to the exec-ed program: