X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/28d7faa60b9789a70d99c922e163c4aa7de363de..92e3bfcf13304cf11bc64722974dfdca8b2ae6d4:/src/mc/simgrid_mc.cpp diff --git a/src/mc/simgrid_mc.cpp b/src/mc/simgrid_mc.cpp index f06240ef84..1d517f1f81 100644 --- a/src/mc/simgrid_mc.cpp +++ b/src/mc/simgrid_mc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015. The SimGrid Team. + /* Copyright (c) 2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -18,7 +18,10 @@ #include #include #include + +#ifdef __linux__ #include +#endif #include @@ -35,15 +38,18 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc"); -static const bool trace = true; - static int do_child(int socket, char** argv) { XBT_DEBUG("Inside the child process PID=%i", (int) getpid()); + +#ifdef __linux__ + // Make sure we do not outlive our parent: if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0) { std::perror("simgrid-mc"); return MC_SERVER_ERROR; } +#endif + int res; // Remove CLOEXEC in order to pass the socket to the exec-ed program: @@ -93,7 +99,7 @@ static int do_parent(int socket, pid_t child) mc_server->exit(); } catch(std::exception& e) { - XBT_ERROR(e.what()); + XBT_ERROR("Exception: %s", e.what()); } exit(MC_SERVER_ERROR); }