Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Make SIMCALL_MUTEX_TRYLOCK visible and forbid usage of MUTEX operations with...
[simgrid.git] / src / mc / simgrid_mc.cpp
index f06240e..afe4ba0 100644 (file)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
+
+#ifdef __linux__
 #include <sys/prctl.h>
+#endif
 
 #include <xbt/log.h>
 
 
 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);
 }