X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9c6d72b5bbc9f9b0f9d61c8964fabacaaa2a9914..8985a1134de89a845dd5fb959c9a1fe776b890bf:/src/simix/smx_host.c diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 69f45257e6..2480bbdcf2 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2012. The SimGrid Team. +/* Copyright (c) 2007-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -262,10 +262,14 @@ void* SIMIX_host_get_data(smx_host_t host){ return SIMIX_host_priv(host)->data; } -void _SIMIX_host_free_process_arg(void *); -void _SIMIX_host_free_process_arg(void *data) + +static void _SIMIX_host_free_process_arg(void *data) { smx_process_arg_t arg = *(void**)data; + int i; + for (i = 0; i < arg->argc; i++) + xbt_free(arg->argv[i]); + xbt_free(arg->argv); xbt_free(arg->name); xbt_free(arg); } @@ -323,9 +327,10 @@ void SIMIX_host_restart_processes(smx_host_t host) unsigned int cpt; smx_process_arg_t arg; xbt_dynar_t process_list = SIMIX_host_priv(host)->auto_restart_processes; - if(!process_list) return; + if (!process_list) + return; - xbt_dynar_foreach(process_list,cpt,arg) { + xbt_dynar_foreach (process_list, cpt, arg) { smx_process_t process; @@ -341,20 +346,24 @@ void SIMIX_host_restart_processes(smx_host_t host) arg->argv, arg->properties, arg->auto_restart); - } - else { + } 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); + arg->argv[0], + arg->code, + NULL, + arg->hostname, + arg->kill_time, + arg->argc, + arg->argv, + arg->properties, + arg->auto_restart); } + /* arg->argv is used by the process created above. Hide it to + * _SIMIX_host_free_process_arg() which is called by xbt_dynar_reset() + * below. */ + arg->argc = 0; + arg->argv = NULL; } xbt_dynar_reset(process_list); } @@ -555,7 +564,7 @@ void SIMIX_execution_finish(smx_action_t action) case SIMIX_FAILED: XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", sg_host_name(simcall->issuer->smx_host)); simcall->issuer->context->iwannadie = 1; - //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); + SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; case SIMIX_CANCELED: @@ -626,10 +635,10 @@ void SIMIX_set_category(smx_action_t action, const char *category) } #endif -xbt_dynar_t SIMIX_pre_host_get_storage_list(smx_simcall_t simcall, smx_host_t host){ +xbt_dict_t SIMIX_pre_host_get_storage_list(smx_simcall_t simcall, smx_host_t host){ return SIMIX_host_get_storage_list(host); } -xbt_dynar_t SIMIX_host_get_storage_list(smx_host_t host){ +xbt_dict_t SIMIX_host_get_storage_list(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_model->extension.workstation.get_storage_list(host);