Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar by removing useless asignments and return statements
[simgrid.git] / src / mc / Session.cpp
index 9969665..260edd4 100644 (file)
@@ -32,9 +32,9 @@ static void setup_child_environment(int socket)
   sigset_t mask;
   sigemptyset (&mask);
   if (sigprocmask(SIG_SETMASK, &mask, nullptr) < 0)
-    throw simgrid::xbt::errno_error(errno, "Could not unblock signals");
+    throw simgrid::xbt::errno_error("Could not unblock signals");
   if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0)
-    throw simgrid::xbt::errno_error(errno, "Could not PR_SET_PDEATHSIG");
+    throw simgrid::xbt::errno_error("Could not PR_SET_PDEATHSIG");
 #endif
 
   int res;
@@ -42,7 +42,7 @@ static void setup_child_environment(int socket)
   // Remove CLOEXEC in order to pass the socket to the exec-ed program:
   int fdflags = fcntl(socket, F_GETFD, 0);
   if (fdflags == -1 || fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) == -1)
-    throw simgrid::xbt::errno_error(errno, "Could not remove CLOEXEC for socket");
+    throw simgrid::xbt::errno_error("Could not remove CLOEXEC for socket");
 
   // Set environment:
   setenv(MC_ENV_VARIABLE, "1", 1);
@@ -66,7 +66,7 @@ pid_t do_fork(F code)
 {
   pid_t pid = fork();
   if (pid < 0)
-    throw simgrid::xbt::errno_error(errno, "Could not fork model-checked process");
+    throw simgrid::xbt::errno_error("Could not fork model-checked process");
   if (pid != 0)
     return pid;
 
@@ -86,7 +86,7 @@ Session::Session(pid_t pid, int socket)
   std::unique_ptr<simgrid::mc::Process> process(new simgrid::mc::Process(pid, socket));
   // TODO, automatic detection of the config from the process
   process->privatized(
-    xbt_cfg_get_boolean("smpi/privatize_global_variables"));
+    xbt_cfg_get_boolean("smpi/privatize-global-variables"));
   modelChecker_ = std::unique_ptr<ModelChecker>(
     new simgrid::mc::ModelChecker(std::move(process)));
   xbt_assert(mc_model_checker == nullptr);
@@ -141,7 +141,7 @@ Session* Session::fork(std::function<void(void)> code)
   int sockets[2];
   res = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, sockets);
   if (res == -1)
-    throw simgrid::xbt::errno_error(errno, "Could not create socketpair");
+    throw simgrid::xbt::errno_error("Could not create socketpair");
 
   pid_t pid = do_fork([&] {
     ::close(sockets[1]);
@@ -165,10 +165,10 @@ Session* Session::spawnv(const char *path, char *const argv[])
 }
 
 // static
-Session* Session::spawnvp(const char *path, char *const argv[])
+Session* Session::spawnvp(const char *file, char *const argv[])
 {
   return Session::fork([&] {
-    execvp(path, argv);
+    execvp(file, argv);
   });
 }