Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the use of surf_workstation_model at smx_host.c
[simgrid.git] / src / simix / smx_user.c
index a7aa1e5..d51ccfa 100644 (file)
@@ -277,41 +277,142 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
 
 /**
  * \ingroup simix_vm_management
- * \brief Returns a dict of the properties assigned to a host.
+ * \brief Create a VM on the given physical host.
  *
- * \param host A host
- * \return The properties of this host
+ * \param name VM name
+ * \param host Physical host
+ *
+ * \return The host object of the VM
+ */
+void* simcall_vm_create(const char *name, smx_host_t phys_host){
+  /* will jump to SIMIX_pre_vm_create() in src/simix/smx_smurf_private.h */
+  return simcall_BODY_vm_create(name, phys_host);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Start the given VM to the given physical host
+ *
+ * \param vm VM
+ */
+void simcall_vm_start(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_start in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_start(vm);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Get the state of the given VM
+ *
+ * \param vm VM
+ * \return The state of the VM
  */
-void* simcall_vm_ws_create(const char *name, smx_host_t phys_host){
-  return simcall_BODY_vm_ws_create(name, phys_host);
+int simcall_vm_get_state(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_get_state in src/simix/smx_smurf_private.h */
+  return simcall_BODY_vm_get_state(vm);
 }
 
-void simcall_vm_start(smx_host_t vm) {
+/**
+ * \ingroup simix_vm_management
+ * \brief Get the name of the physical host on which the given VM runs.
+ *
+ * \param vm VM
+ * \return The name of the physical host
+ */
+const char *simcall_vm_get_phys_host(smx_host_t vm)
 {
-  simcall_BODY_set_vm_state(vm, msg_vm_state_running);
+  /* will jump to SIMIX_pre_vm_migrate in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_get_phys_host(vm);
 }
 
+/**
+ * \ingroup simix_vm_management
+ * \brief Migrate the given VM to the given physical host
+ *
+ * \param vm VM
+ * \param host Destination physical host
+ */
+void simcall_vm_migrate(smx_host_t vm, smx_host_t host)
+{
+  /* will jump to SIMIX_pre_vm_migrate in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_migrate(vm, host);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Suspend the given VM
+ *
+ * \param vm VM
+ */
 void simcall_vm_suspend(smx_host_t vm)
 {
-  /* will jump to SIMIX_pre_vm_suspend */
+  /* will jump to SIMIX_pre_vm_suspend in src/simix/smx_smurf_private.h */
   simcall_BODY_vm_suspend(vm);
 }
 
+/**
+ * \ingroup simix_vm_management
+ * \brief Resume the given VM
+ *
+ * \param vm VM
+ */
+void simcall_vm_resume(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_resume in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_resume(vm);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Save the given VM
+ *
+ * \param vm VM
+ */
+void simcall_vm_save(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_save in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_save(vm);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Restore the given VM
+ *
+ * \param vm VM
+ */
+void simcall_vm_restore(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_restore in src/simix/smx_smurf_private.h */
+  simcall_BODY_vm_restore(vm);
+}
+
+/**
+ * \ingroup simix_vm_management
+ * \brief Shutdown the given VM
+ *
+ * \param vm VM
+ */
 void simcall_vm_shutdown(smx_host_t vm)
 {
-  /* will jump to SIMIX_pre_vm_shutdown */
+  /* will jump to SIMIX_pre_vm_shutdown in src/simix/smx_smurf_private.h */
   simcall_BODY_vm_shutdown(vm);
 }
 
+/**
+ * \ingroup simix_vm_management
+ * \brief Destroy the given VM
+ *
+ * \param vm VM
+ */
 void simcall_vm_destroy(smx_host_t vm)
 {
-  /*
-   * simcall_BODY_ is defined in src/simix/smx_smurf_private.h.
-   * This function will jump to SIMIX_pre_vm_destroy.
-   **/
+   /* will jump to SIMIX_pre_vm_destroy in src/simix/smx_smurf_private.h */
   simcall_BODY_vm_destroy(vm);
 }
 
+
 /**
  * \ingroup simix_process_management
  * \brief Creates and runs a new SIMIX process.
@@ -361,9 +462,9 @@ void simcall_process_kill(smx_process_t process)
  * \ingroup simix_process_management
  * \brief Kills all SIMIX processes.
  */
-void simcall_process_killall(void)
+void simcall_process_killall(int reset_pid)
 {
-  simcall_BODY_process_killall();
+  simcall_BODY_process_killall(reset_pid);
 }
 
 /**
@@ -431,6 +532,38 @@ int simcall_process_count(void)
   return simcall_BODY_process_count();
 }
 
+/**
+ * \ingroup simix_process_management
+ * \brief Return the PID of a #smx_process_t.
+ * \param process a SIMIX process
+ * \return the PID of this process
+ */
+int simcall_process_get_PID(smx_process_t process)
+{
+  if (process == SIMIX_process_self()) {
+    /* avoid a simcall if this function is called by the process itself */
+    return SIMIX_process_get_PID(process);
+  }
+
+  return simcall_BODY_process_get_PID(process);
+}
+
+/**
+ * \ingroup simix_process_management
+ * \brief Return the parent PID of a #smx_process_t.
+ * \param process a SIMIX process
+ * \return the PID of this process parenrt
+ */
+int simcall_process_get_PPID(smx_process_t process)
+{
+  if (process == SIMIX_process_self()) {
+    /* avoid a simcall if this function is called by the process itself */
+    return SIMIX_process_get_PPID(process);
+  }
+
+  return simcall_BODY_process_get_PPID(process);
+}
+
 /**
  * \ingroup simix_process_management
  * \brief Return the user data of a #smx_process_t.