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_user.c
index 771268f..76e288c 100644 (file)
@@ -534,7 +534,7 @@ void* simcall_process_get_data(smx_process_t process)
  * \ingroup simix_process_management
  * \brief Set the user data of a #smx_process_t.
  *
- * This functions checks whether \a process is a valid pointer or not and set the user data associated to \a process if it is possible.
+ * This functions sets the user data associated to \a process.
  * \param process SIMIX process
  * \param data User data
  */
@@ -577,7 +577,8 @@ void simcall_process_set_kill_time(smx_process_t process, double kill_time)
  * \ingroup simix_process_management
  * \brief Return the location on which an agent is running.
  *
- * This functions checks whether \a process is a valid pointer or not and return the m_host_t corresponding to the location on which \a process is running.
+ * This functions returns the smx_host_t corresponding to the location on which
+ * \a process is running.
  * \param process SIMIX process
  * \return SIMIX host
  */
@@ -652,7 +653,8 @@ xbt_dict_t simcall_process_get_properties(smx_process_t process)
  * \brief Add an on_exit function
  * Add an on_exit function which will be executed when the process exits/is killed.
  */
-XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data) {
+XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data)
+{
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_PROCESS_ON_EXIT;
@@ -668,7 +670,8 @@ XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fu
  * Will restart the process when the host comes back up if auto_restart is set to 1.
  */
 
-XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart) {
+XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart)
+{
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_PROCESS_AUTO_RESTART_SET;
@@ -677,6 +680,21 @@ XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int aut
 
   SIMIX_simcall_push(simcall->issuer);
 }
+/**
+ * \ingroup simix_process_management
+ * \brief Restarts the process, killing it and starting it again from scratch.
+ */
+XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process)
+{
+  smx_simcall_t simcall = SIMIX_simcall_mine();
+
+  simcall->call = SIMCALL_PROCESS_RESTART;
+  simcall->process_restart.process = process;
+
+  SIMIX_simcall_push(simcall->issuer);
+
+  return simcall->process_restart.result;
+}
 /**
  * \ingroup simix_process_management
  * \brief Creates a new sleep SIMIX action.
@@ -791,6 +809,29 @@ smx_action_t simcall_rdv_get_head(smx_rdv_t rdv)
   SIMIX_simcall_push(simcall->issuer);
   return simcall->rdv_get_head.result;
 }
+
+void simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process)
+{
+  smx_simcall_t simcall = SIMIX_simcall_mine();
+
+  simcall->call = SIMCALL_RDV_SET_RECV;
+  simcall->rdv_set_rcv_proc.rdv = rdv;
+  simcall->rdv_set_rcv_proc.receiver = process;
+
+  SIMIX_simcall_push(simcall->issuer);
+}
+
+smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv)
+{
+  smx_simcall_t simcall = SIMIX_simcall_mine();
+
+  simcall->call = SIMCALL_RDV_GET_RECV;
+  simcall->rdv_get_rcv_proc.rdv = rdv;
+
+  SIMIX_simcall_push(simcall->issuer);
+  return simcall->rdv_get_rcv_proc.result;
+}
+
 /**
  * \ingroup simix_comm_management
  */
@@ -1447,6 +1488,21 @@ int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf)
   return simcall->file_stat.result;
 }
 
+/**
+ * \ingroup simix_file_management
+ *
+ */
+int simcall_file_unlink(smx_file_t fd)
+{
+  smx_simcall_t simcall = SIMIX_simcall_mine();
+  simcall->call = SIMCALL_FILE_UNLINK;
+  simcall->file_unlink.fd = fd;
+
+  SIMIX_simcall_push(simcall->issuer);
+
+  return simcall->file_unlink.result;
+}
+
 /* ************************************************************************** */
 
 /** @brief returns a printable string representing a simcall */