Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix the dlopen privatization (fix #157)
[simgrid.git] / src / smpi / smpi_global.cpp
index 6234227..5910e15 100644 (file)
@@ -446,7 +446,7 @@ static void smpi_init_options(){
     simgrid::smpi::Colls::smpi_coll_cleanup_callback=nullptr;
     smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
     smpi_host_speed = xbt_cfg_get_double("smpi/host-speed");
-    const char* smpi_privatize_option = xbt_cfg_get_string("smpi/privatize-global-variables");
+    const char* smpi_privatize_option               = xbt_cfg_get_string("smpi/privatization");
     if (std::strcmp(smpi_privatize_option, "no") == 0)
       smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
     else if (std::strcmp(smpi_privatize_option, "yes") == 0)
@@ -463,8 +463,7 @@ static void smpi_init_options(){
       smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
 
     else
-      xbt_die("Invalid value for smpi/privatize-global-variables: %s",
-        smpi_privatize_option);
+      xbt_die("Invalid value for smpi/privatization: %s", smpi_privatize_option);
 
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
@@ -571,11 +570,12 @@ int smpi_main(const char* executable, int argc, char *argv[])
           + "_" + std::to_string(getpid())
           + "_" + std::to_string(rank++) + ".so";
 
-        int fdout = open(target_executable.c_str(), O_WRONLY);
+        int fdout = open(target_executable.c_str(), O_CREAT | O_RDWR, S_IRWXU);
         xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str());
 
 #if HAVE_SENDFILE
-        sendfile(fdout, fdin, NULL, fdin_size);
+        off_t offset = 0;
+        sendfile(fdout, fdin, &offset, fdin_size);
 #else
         XBT_WARN("Copy %d bytes into %s", static_cast<int>(fdin_size), target_executable.c_str());
         const int bufsize = 1024 * 1024 * 4;