Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Remove sg_cabinet_cb
[simgrid.git] / src / simix / smx_process.c
index b09039c..0fe5c6f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2014. The SimGrid Team.
+/* Copyright (c) 2007-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -9,8 +9,8 @@
 #include "xbt/log.h"
 #include "xbt/dict.h"
 #include "mc/mc.h"
-#include "mc/mc_replay.h"
-#include "mc/mc_client.h"
+#include "src/mc/mc_replay.h"
+#include "src/mc/mc_client.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix,
                                 "Logging specific to SIMIX (process)");
@@ -163,14 +163,14 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* Add the process to the list of process to restart, only if
    * the host is down
    */
-  if (arg->auto_restart && !SIMIX_host_get_state(arg->host)) {
+  if (arg->auto_restart && !sg_host_get_state(arg->host)) {
     SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
-                                        sg_host_name(arg->host),
+                                        sg_host_get_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
                                         arg->argc,arg->argv,arg->properties,
                                         arg->auto_restart);
   }
-  XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_name(arg->host));
+  XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_get_name(arg->host));
   /* stop the context */
   SIMIX_context_stop(arg->context);
 }
@@ -211,6 +211,12 @@ void* simcall_HANDLER_process_create(smx_simcall_t simcall,
                        kill_time, argc, argv, properties, auto_restart,
                        simcall->issuer);
 }
+
+static void kill_process(void* process)
+{
+  return simix_global->kill_process_function(process);
+}
+
 /**
  * \brief Internal function to create a process.
  *
@@ -236,7 +242,7 @@ smx_process_t SIMIX_process_create(
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
-  if (!SIMIX_host_get_state(host)) {
+  if (!sg_host_get_state(host)) {
     int i;
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
           hostname);
@@ -289,13 +295,13 @@ smx_process_t SIMIX_process_create(
 
     /* Now insert it in the global process list and in the process to run list */
     xbt_swag_insert(process, simix_global->process_list);
-    XBT_DEBUG("Inserting %s(%s) in the to_run list", process->name, sg_host_name(host));
+    XBT_DEBUG("Inserting %s(%s) in the to_run list", process->name, sg_host_get_name(host));
     xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
 
     if (kill_time > SIMIX_get_clock() && simix_global->kill_process_function) {
       XBT_DEBUG("Process %s(%s) will be kill at time %f", process->name,
-          sg_host_name(process->host), kill_time);
-      process->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, process);
+          sg_host_get_name(process->host), kill_time);
+      process->kill_timer = SIMIX_timer_set(kill_time, kill_process, process);
     }
   }
   return process;
@@ -334,7 +340,7 @@ void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_process_t process)
  */
 void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
 
-  XBT_DEBUG("Killing process %s on %s", process->name, sg_host_name(process->host));
+  XBT_DEBUG("Killing process %s on %s", process->name, sg_host_get_name(process->host));
 
   process->context->iwannadie = 1;
   process->blocked = 0;
@@ -461,8 +467,7 @@ void SIMIX_process_killall(smx_process_t issuer, int reset_pid)
   SIMIX_process_empty_trash();
 }
 
-void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process,
-                                  sg_host_t dest)
+void simcall_HANDLER_process_set_host(smx_simcall_t simcall, smx_process_t process, sg_host_t dest)
 {
   process->new_host = dest;
 }
@@ -746,7 +751,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration)
   /* check if the host is active */
   if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
@@ -962,12 +967,12 @@ smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process
 }
 /** @brief Restart a process, starting it again from the beginning. */
 smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer) {
-  XBT_DEBUG("Restarting process %s on %s", process->name, sg_host_name(process->host));
+  XBT_DEBUG("Restarting process %s on %s", process->name, sg_host_get_name(process->host));
   //retrieve the arguments of the old process
   //FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
   s_smx_process_arg_t arg;
   arg.code = process->code;
-  arg.hostname = sg_host_name(process->host);
+  arg.hostname = sg_host_get_name(process->host);
   arg.kill_time = SIMIX_timer_get_date(process->kill_timer);
   arg.argc = process->argc;
   arg.data = process->data;