X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d239d3b23481b30b2a17c1d5b1fdb5fec70fd23b..92afe9670ecc5246040dad7a9d6b805f9c8f84cb:/src/mc/simgrid_mc.cpp diff --git a/src/mc/simgrid_mc.cpp b/src/mc/simgrid_mc.cpp index d121fdbf73..71d0388828 100644 --- a/src/mc/simgrid_mc.cpp +++ b/src/mc/simgrid_mc.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -29,6 +30,7 @@ #include "mc_protocol.h" #include "mc_server.h" #include "mc_model_checker.h" +#include "mc_safety.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc"); @@ -37,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: @@ -76,8 +82,7 @@ static int do_parent(int socket, pid_t child) mc_server = new s_mc_server(child, socket); mc_server->start(); MC_init_pid(child, socket); - mc_server->resume(&mc_model_checker->process); - mc_server->loop(); + MC_do_the_modelcheck_for_real(); mc_server->shutdown(); mc_server->exit(); } @@ -107,7 +112,7 @@ int main(int argc, char** argv) if (argc < 2) xbt_die("Missing arguments.\n"); - bool server_mode = false; + bool server_mode = true; char* env = std::getenv("SIMGRID_MC_MODE"); if (env) { if (std::strcmp(env, "server") == 0) @@ -115,7 +120,7 @@ int main(int argc, char** argv) else if (std::strcmp(env, "standalone") == 0) server_mode = false; else - XBT_WARN("Unrecognised value for SIMGRID_MC_MODE (server/standalone)"); + xbt_die("Unrecognised value for SIMGRID_MC_MODE (server/standalone)"); } if (!server_mode) {