Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a new simcall to get/set the receiver of a rendez-vous point.
[simgrid.git] / src / simix / smx_smurf.c
index c752587..7278076 100644 (file)
@@ -13,7 +13,8 @@ XBT_INLINE smx_simcall_t SIMIX_simcall_mine()
 
 /**
  * \brief Makes the current process do a simcall to the kernel and yields
- * until completion.
+ * until completion. If the current thread is maestro, we don't yield and
+ * execute the simcall directly.
  * \param self the current process
  */
 void SIMIX_simcall_push(smx_process_t self)
@@ -33,10 +34,12 @@ void SIMIX_simcall_answer(smx_simcall_t simcall)
     XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call,
         simcall->issuer->name, simcall->issuer);
     simcall->issuer->simcall.call = SIMCALL_NONE;
-    if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer)))
-      xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
-    else
-      DIE_IMPOSSIBLE;
+/*    This check should be useless and slows everyone. Reactivate if you see something
+ *    weird in process scheduling.
+ */
+/*    if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */
+    xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
+/*    else DIE_IMPOSSIBLE; */
   }
 }
 
@@ -200,6 +203,16 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
       SIMIX_simcall_answer(simcall);
       break;
 
+    case SIMCALL_RDV_SET_RECV:
+      SIMIX_rdv_set_receiver(simcall->rdv_set_rcv_proc.rdv, simcall->rdv_set_rcv_proc.receiver);
+      SIMIX_simcall_answer(simcall);
+      break;
+
+    case SIMCALL_RDV_GET_RECV:
+      simcall->rdv_get_rcv_proc.result = SIMIX_rdv_get_receiver(simcall->rdv_set_rcv_proc.rdv);
+      SIMIX_simcall_answer(simcall);
+      break;
+
     case SIMCALL_HOST_GET_BY_NAME:
       simcall->host_get_by_name.result =
         SIMIX_host_get_by_name(simcall->host_get_by_name.name);
@@ -207,7 +220,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
       break;
 
     case SIMCALL_HOST_GET_NAME:
-      simcall->host_get_name.result =  SIMIX_host_get_name(simcall->host_get_name.host);
+      simcall->host_get_name.result =  SIMIX_host_get_name(simcall->host_get_name.host);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -225,7 +238,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_HOST_GET_AVAILABLE_SPEED:
       simcall->host_get_available_speed.result =
-       SIMIX_host_get_available_speed(simcall->host_get_available_speed.host);
+        SIMIX_host_get_available_speed(simcall->host_get_available_speed.host);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -236,7 +249,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
       break;
 
     case SIMCALL_HOST_GET_DATA:
-      simcall->host_get_data.result =  SIMIX_host_get_data(simcall->host_get_data.host);
+      simcall->host_get_data.result =  SIMIX_host_get_data(simcall->host_get_data.host);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -247,22 +260,22 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_HOST_EXECUTE:
       simcall->host_execute.result = SIMIX_host_execute(
-         simcall->host_execute.name,
-         simcall->host_execute.host,
-         simcall->host_execute.computation_amount,
-         simcall->host_execute.priority);
+    simcall->host_execute.name,
+    simcall->host_execute.host,
+    simcall->host_execute.computation_amount,
+    simcall->host_execute.priority);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_PARALLEL_EXECUTE:
       simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(
-         simcall->host_parallel_execute.name,
-         simcall->host_parallel_execute.host_nb,
-         simcall->host_parallel_execute.host_list,
-         simcall->host_parallel_execute.computation_amount,
-         simcall->host_parallel_execute.communication_amount,
-         simcall->host_parallel_execute.amount,
-         simcall->host_parallel_execute.rate);
+    simcall->host_parallel_execute.name,
+    simcall->host_parallel_execute.host_nb,
+    simcall->host_parallel_execute.host_list,
+    simcall->host_parallel_execute.computation_amount,
+    simcall->host_parallel_execute.communication_amount,
+    simcall->host_parallel_execute.amount,
+    simcall->host_parallel_execute.rate);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -284,14 +297,14 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_HOST_EXECUTION_GET_STATE:
       simcall->host_execution_get_state.result =
-       SIMIX_host_execution_get_state(simcall->host_execution_get_state.execution);
+        SIMIX_host_execution_get_state(simcall->host_execution_get_state.execution);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
       SIMIX_host_execution_set_priority(
-         simcall->host_execution_set_priority.execution,
-         simcall->host_execution_set_priority.priority);
+    simcall->host_execution_set_priority.execution,
+    simcall->host_execution_set_priority.priority);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -302,19 +315,20 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
     case SIMCALL_PROCESS_CREATE:
       SIMIX_process_create(
           simcall->process_create.process,
-         simcall->process_create.name,
-         simcall->process_create.code,
-         simcall->process_create.data,
-         simcall->process_create.hostname,
-         simcall->process_create.kill_time,
-         simcall->process_create.argc,
-         simcall->process_create.argv,
-         simcall->process_create.properties);
+    simcall->process_create.name,
+    simcall->process_create.code,
+    simcall->process_create.data,
+    simcall->process_create.hostname,
+    simcall->process_create.kill_time,
+    simcall->process_create.argc,
+    simcall->process_create.argv,
+    simcall->process_create.properties,
+    simcall->process_create.auto_restart);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_PROCESS_KILL:
-      SIMIX_process_kill(simcall->process_kill.process);
+      SIMIX_process_kill(simcall->process_kill.process,simcall->issuer);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -330,8 +344,8 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_PROCESS_CHANGE_HOST:
       SIMIX_pre_process_change_host(
-         simcall->process_change_host.process,
-         simcall->process_change_host.dest);
+          simcall->process_change_host.process,
+          simcall->process_change_host.dest);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -354,11 +368,24 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
         SIMIX_process_get_data(simcall->process_get_data.process);
       SIMIX_simcall_answer(simcall);
       break;
-
+    case SIMCALL_PROCESS_ON_EXIT:
+      SIMIX_process_on_exit(simcall->process_on_exit.process,
+                            simcall->process_on_exit.fun,
+                            simcall->process_on_exit.data);
+      SIMIX_simcall_answer(simcall);
+    break;
+    case SIMCALL_PROCESS_RESTART:
+      simcall->process_restart.result = SIMIX_process_restart(simcall->process_restart.process, simcall->issuer);
+      SIMIX_simcall_answer(simcall);
+    break;
+    case SIMCALL_PROCESS_AUTO_RESTART_SET:
+      SIMIX_process_auto_restart_set(simcall->process_auto_restart.process,simcall->process_auto_restart.auto_restart);
+      SIMIX_simcall_answer(simcall);
+    break;
     case SIMCALL_PROCESS_SET_DATA:
       SIMIX_process_set_data(
-         simcall->process_set_data.process,
-         simcall->process_set_data.data);
+    simcall->process_set_data.process,
+    simcall->process_set_data.data);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -413,7 +440,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_MUTEX_TRYLOCK:
       simcall->mutex_trylock.result =
-             SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
+        SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -467,7 +494,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_SEM_WOULD_BLOCK:
       simcall->sem_would_block.result =
-       SIMIX_sem_would_block(simcall->sem_would_block.sem);
+        SIMIX_sem_would_block(simcall->sem_would_block.sem);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -505,6 +532,10 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
       SIMIX_pre_file_stat(simcall);
       break;
 
+    case SIMCALL_FILE_UNLINK:
+      SIMIX_pre_file_unlink(simcall);
+      break;
+
     case SIMCALL_NONE:
       THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
           SIMIX_process_get_name(simcall->issuer),