#define MSG_get_host_by_name(n) MSG_host_by_name(n) /* Rewrite the old name into the new one transparently */
XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data);
XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
-XBT_PUBLIC(const char *) MSG_host_get_name(msg_host_t host);
+/** \ingroup m_host_management
+ *
+ * \brief Return the name of the #msg_host_t. */
+#define MSG_host_get_name(host) sg_host_get_name(host)
XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
XBT_PUBLIC(msg_host_t) MSG_host_self(void);
/*********************************** Host *************************************/
XBT_PUBLIC(sg_host_t) SIMIX_host_self(void);
XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
-#define SIMIX_host_get_name(h) sg_host_get_name(h) /* DEPRECATED: SIMIX_host_get_name */
XBT_PUBLIC(void) SIMIX_host_on(sg_host_t host);
XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_process_t issuer);
XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
- container_t host_container = PJ_container_get (SIMIX_host_get_name(host));
+ container_t host_container = PJ_container_get (sg_host_get_name(host));
PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
}
}
PJ_container_free(existing_container);
//create new container on the new_host location
- PJ_container_new(instr_vm_id(vm, str, len), INSTR_MSG_VM, PJ_container_get(SIMIX_host_get_name(new_host)));
+ PJ_container_new(instr_vm_id(vm, str, len), INSTR_MSG_VM, PJ_container_get(sg_host_get_name(new_host)));
//end link
msg = PJ_container_get(instr_vm_id(vm, str, len));
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
- container_t host_container = PJ_container_get (SIMIX_host_get_name(host));
+ container_t host_container = PJ_container_get (sg_host_get_name(host));
PJ_container_new(instr_vm_id_2(vm_name, str, len), INSTR_MSG_VM, host_container);
}
}
return sg_host_user(host);
}
-/** \ingroup m_host_management
- *
- * \brief Return the name of the #msg_host_t.
- *
- * This functions checks whether \a host is a valid pointer or not and return
- its name.
- */
-const char *MSG_host_get_name(msg_host_t host) {
- return SIMIX_host_get_name(host);
-}
-
/** \ingroup m_host_management
*
* \brief Return the location on which the current process is executed.
host_dest = MSG_host_by_name(host_name_dest);
}else{
- XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, SIMIX_host_get_name(host));
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host));
return MSG_TASK_CANCELED;
}
}
void Host::turn_off() {
- simgrid::simix::simcall<void>(SIMCALL_HOST_OFF, this);
+ simgrid::simix::kernel(std::bind(SIMIX_host_off, this, SIMIX_process_self()));
}
bool Host::is_on() {
*/
-static inline sg_host_t simcall_host_off__get__host(smx_simcall_t simcall) {
- return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_off__set__host(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-
static inline sg_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall) {
return (sg_host_t) simcall->args[0].dp;
}
/* The prototype of all simcall handlers, automatically generated for you */
-XBT_PRIVATE void simcall_HANDLER_host_off(smx_simcall_t simcall, sg_host_t host);
XBT_PRIVATE void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, sg_host_t ind_vm);
XBT_PRIVATE void simcall_HANDLER_vm_resume(smx_simcall_t simcall, sg_host_t ind_vm);
XBT_PRIVATE void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm);
#include "xbt/ex.h"
#include <simgrid/simix.hpp>
-inline static void simcall_BODY_host_off(sg_host_t host) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_host_off(&self->simcall, host);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_HOST_OFF;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) host;
- if (self != simix_global->maestro_process) {
- XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
- SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
-
- }
-
inline static void simcall_BODY_vm_suspend(sg_host_t ind_vm) {
smx_process_t self = SIMIX_process_self();
*/
typedef enum {
SIMCALL_NONE,
- SIMCALL_HOST_OFF,
SIMCALL_VM_SUSPEND,
SIMCALL_VM_RESUME,
SIMCALL_VM_SHUTDOWN,
/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
const char* simcall_names[] = {
- "SIMCALL_NONE", "SIMCALL_HOST_OFF",
- "SIMCALL_VM_SUSPEND",
+ "SIMCALL_NONE", "SIMCALL_VM_SUSPEND",
"SIMCALL_VM_RESUME",
"SIMCALL_VM_SHUTDOWN",
"SIMCALL_VM_SAVE",
if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
return;
switch (simcall->call) {
-case SIMCALL_HOST_OFF:
- simcall_HANDLER_host_off(simcall , (sg_host_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_VM_SUSPEND:
simcall_HANDLER_vm_suspend(simcall , (sg_host_t) simcall->args[0].dp);
SIMIX_simcall_answer(simcall);
case SIMCALL_NONE:
THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
SIMIX_process_get_name(simcall->issuer),
- SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
+ sg_host_get_name(SIMIX_process_get_host(simcall->issuer))
);
break;
# ./include/simgrid/simix.h (otherwise you will get a warning at the
# compilation time)
-Proc H host_off (void) (host, void*, sg_host_t)
-
Proc H vm_suspend (void) (ind_vm, void*, sg_host_t)
Proc H vm_resume (void) (ind_vm, void*, sg_host_t)
Proc H vm_shutdown (void) (ind_vm, void*, sg_host_t)
fd.write(' case SIMCALL_NONE:\n');
fd.write(' THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",\n');
fd.write(' SIMIX_process_get_name(simcall->issuer),\n');
- fd.write(' SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))\n');
+ fd.write(' sg_host_get_name(SIMIX_process_get_host(simcall->issuer))\n');
fd.write(' );\n');
fd.write(' break;\n');
fd.write('\n');
}
}
-void simcall_HANDLER_host_off(smx_simcall_t simcall, sg_host_t h)
-{
- SIMIX_host_off(h, simcall->issuer);
-}
-
/**
* \brief Stop the host if it is on
*
if (host == NULL || SIMIX_process_self() == simix_global->maestro_process)
return "";
- return SIMIX_host_get_name(host);
+ return sg_host_get_name(host);
}
void _SIMIX_host_free_process_arg(void *data)
sg_host_t receiver = synchro->comm.dst_proc->host;
XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro,
- SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
+ sg_host_get_name(sender), sg_host_get_name(receiver));
synchro->comm.surf_comm = surf_network_model_communicate(surf_network_model,
sender, receiver,
/* If a link is failed, detect it immediately */
if (synchro->comm.surf_comm->getState() == SURF_ACTION_FAILED) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure",
- SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
+ sg_host_get_name(sender), sg_host_get_name(receiver));
synchro->state = SIMIX_LINK_FAILURE;
SIMIX_comm_destroy_internal_actions(synchro);
}
if (SIMIX_process_is_suspended(synchro->comm.src_proc))
XBT_DEBUG("The communication is suspended on startup because src (%s:%s) were suspended since it initiated the communication",
- SIMIX_host_get_name(synchro->comm.src_proc->host), synchro->comm.src_proc->name);
+ sg_host_get_name(synchro->comm.src_proc->host), synchro->comm.src_proc->name);
else
XBT_DEBUG("The communication is suspended on startup because dst (%s:%s) were suspended since it initiated the communication",
- SIMIX_host_get_name(synchro->comm.dst_proc->host), synchro->comm.dst_proc->name);
+ sg_host_get_name(synchro->comm.dst_proc->host), synchro->comm.dst_proc->name);
synchro->comm.surf_comm->suspend();
ind_vm->extension<simgrid::surf::Host>()
)->setState(SURF_VM_STATE_RUNNING);
else
- THROWF(vm_error, 0, "The VM %s cannot be started", SIMIX_host_get_name(ind_vm));
+ THROWF(vm_error, 0, "The VM %s cannot be started", sg_host_get_name(ind_vm));
}
*/
void SIMIX_vm_suspend(sg_host_t ind_vm, smx_process_t issuer)
{
- const char *name = SIMIX_host_get_name(ind_vm);
+ const char *name = sg_host_get_name(ind_vm);
if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_RUNNING)
THROWF(vm_error, 0, "VM(%s) is not running", name);
*/
void SIMIX_vm_resume(sg_host_t ind_vm, smx_process_t issuer)
{
- const char *name = SIMIX_host_get_name(ind_vm);
+ const char *name = sg_host_get_name(ind_vm);
if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_SUSPENDED)
THROWF(vm_error, 0, "VM(%s) was not suspended", name);
*/
void SIMIX_vm_save(sg_host_t ind_vm, smx_process_t issuer)
{
- const char *name = SIMIX_host_get_name(ind_vm);
+ const char *name = sg_host_get_name(ind_vm);
if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_RUNNING)
THROWF(vm_error, 0, "VM(%s) is not running", name);
*/
void SIMIX_vm_restore(sg_host_t ind_vm, smx_process_t issuer)
{
- const char *name = SIMIX_host_get_name(ind_vm);
+ const char *name = sg_host_get_name(ind_vm);
if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_SAVED)
THROWF(vm_error, 0, "VM(%s) was not saved", name);
*/
void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_process_t issuer)
{
- const char *name = SIMIX_host_get_name(ind_vm);
+ const char *name = sg_host_get_name(ind_vm);
if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_RUNNING)
THROWF(vm_error, 0, "VM(%s) is not running", name);
{
/* this code basically performs a similar thing like SIMIX_host_destroy() */
- xbt_assert((ind_vm != NULL), "Invalid parameters");
- const char *hostname = SIMIX_host_get_name(ind_vm);
+ const char *hostname = sg_host_get_name(ind_vm);
XBT_DEBUG("destroy %s", hostname);
{
int retval = MPI_SUCCESS;
- strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
- strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
- strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
+ strncpy(name, sg_host_get_name(SIMIX_host_self()),
+ strlen(sg_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
+ strlen(sg_host_get_name(SIMIX_host_self())) +1 :
MPI_MAX_PROCESSOR_NAME - 1 );
*resultlen =
strlen(name) >