+
+ return xbt_lib_get_elm_or_null(host_lib, name);
+}
+
+void SIMIX_pre_host_on(smx_simcall_t simcall, smx_host_t h)
+{
+ SIMIX_host_on(h);
+}
+
+/**
+ * \brief Start the host if it is off
+ *
+ */
+void SIMIX_host_on(smx_host_t h)
+{
+ smx_host_priv_t host = SIMIX_host_priv(h);
+
+ xbt_assert((host != NULL), "Invalid parameters");
+
+ if (surf_resource_get_state(surf_workstation_resource_priv(h))==SURF_RESOURCE_OFF) {
+ surf_resource_set_state(surf_workstation_resource_priv(h), SURF_RESOURCE_ON);
+ unsigned int cpt;
+ smx_process_arg_t arg;
+ xbt_dynar_foreach(host->boot_processes,cpt,arg) {
+ smx_process_t process;
+
+ XBT_DEBUG("Booting Process %s(%s) right now", arg->argv[0], arg->hostname);
+ if (simix_global->create_process_function) {
+ simix_global->create_process_function(&process,
+ arg->argv[0],
+ arg->code,
+ NULL,
+ arg->hostname,
+ arg->kill_time,
+ arg->argc,
+ arg->argv,
+ arg->properties,
+ arg->auto_restart,
+ NULL);
+ } else {
+ simcall_process_create(&process,
+ arg->argv[0],
+ arg->code,
+ NULL,
+ arg->hostname,
+ arg->kill_time,
+ arg->argc,
+ arg->argv,
+ arg->properties,
+ arg->auto_restart);
+ }
+ }
+ }
+}
+
+void SIMIX_pre_host_off(smx_simcall_t simcall, smx_host_t h)
+{
+ SIMIX_host_off(h, simcall->issuer);
+}
+
+/**
+ * \brief Stop the host if it is on
+ *
+ */
+void SIMIX_host_off(smx_host_t h, smx_process_t issuer)
+{
+ smx_host_priv_t host = SIMIX_host_priv(h);