Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify the MC initialization by using only one env variable
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 5 May 2020 22:13:03 +0000 (00:13 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 5 May 2020 22:13:03 +0000 (00:13 +0200)
src/mc/Session.cpp
src/mc/remote/mc_protocol.h
src/xbt/mmalloc/mm_legacy.c

index 8079ed7..a925128 100644 (file)
@@ -44,9 +44,6 @@ static void setup_child_environment(int socket)
   xbt_assert(fdflags != -1 && fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) != -1,
              "Could not remove CLOEXEC for socket");
 
-  // Set environment so that mmalloc gets used in application
-  setenv(MC_ENV_VARIABLE, "1", 1);
-
   // Disable lazy relocation in the model-checked process to prevent the application from
   // modifying its .got.plt during snapshot.
   setenv("LC_BIND_NOW", "1", 1);
index 39b5aa7..ab6f855 100644 (file)
@@ -14,12 +14,10 @@ SG_BEGIN_DECL
 
 // ***** Environment variables for passing context to the model-checked process
 
-/** Environment variable name set by `simgrid-mc` to enable MC support in the
- *  children MC processes
+/** Environment variable name used to pass the communication socket.
+ *
+ * It is set by `simgrid-mc` to enable MC support in the children processes
  */
-#define MC_ENV_VARIABLE "SIMGRID_MC"
-
-/** Environment variable name used to pass the communication socket */
 #define MC_ENV_SOCKET_FD "SIMGRID_MC_SOCKET_FD"
 
 // ***** Messages
index 002d9c5..d3c6cb7 100644 (file)
@@ -117,7 +117,7 @@ XBT_ATTRIB_CONSTRUCTOR(101) static void mm_legacy_constructor()
   if (mm_initialized)
     return;
   mm_initializing = 1;
-  __malloc_use_mmalloc = getenv(MC_ENV_VARIABLE) ? 1 : 0;
+  __malloc_use_mmalloc = getenv(MC_ENV_SOCKET_FD) ? 1 : 0;
   if (__malloc_use_mmalloc) {
     __mmalloc_current_heap = mmalloc_preinit();
   } else {