Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix privatisation support
[simgrid.git] / src / mc / mc_client.cpp
index 984a221..9caade7 100644 (file)
@@ -4,9 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <stdlib.h>
-#include <errno.h>
-#include <error.h>
+#include <cstdlib>
+#include <cerrno>
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -21,7 +20,6 @@
 // We won't need those once the separation MCer/MCed is complete:
 #include "mc_mmalloc.h"
 #include "mc_ignore.h"
-#include "mc_model_checker.h"
 #include "mc_private.h" // MC_deadlock_check()
 #include "mc_smx.h"
 
@@ -38,7 +36,7 @@ void MC_client_init(void)
     return;
   }
 
-  char* fd_env = getenv(MC_ENV_SOCKET_FD);
+  char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
   if (!fd_env)
     xbt_die("MC socket not found");
 
@@ -58,12 +56,6 @@ void MC_client_init(void)
   mc_client->active = 1;
 }
 
-void MC_client_hello(void)
-{
-  if (MC_protocol_hello(mc_client->fd) != 0)
-    xbt_die("Could not say hello the MC server");
-}
-
 void MC_client_send_message(void* message, size_t size)
 {
   if (MC_protocol_send(mc_client->fd, message, size))
@@ -120,6 +112,16 @@ void MC_client_handle_messages(void)
       }
       break;
 
+    case MC_MESSAGE_RESTORE:
+      {
+        s_mc_restore_message_t message;
+        if (s != sizeof(message))
+          xbt_die("Unexpected size for SIMCALL_HANDLE");
+        memcpy(&message, message_buffer, sizeof(message));
+        smpi_really_switch_data_segment(message.index);
+      }
+      break;
+
     default:
       xbt_die("%s received unexpected message %s (%i)",
         MC_mode_name(mc_mode),