From 40ffa837924e30c9aa35eefef1711601419d8de7 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 10 Mar 2014 13:07:44 +0100 Subject: [PATCH] Remove function SIMIX_process_create_with_parent. Add the parameter parent_process to SIMIX_process_create. --- include/simgrid/simix.h | 3 +- src/msg/msg_private.h | 6 ++- src/msg/msg_process.c | 8 ++-- src/simix/smx_deployment.c | 2 +- src/simix/smx_host.c | 29 +++++++------- src/simix/smx_process.c | 70 ++++++++++++++------------------- src/simix/smx_process_private.h | 13 +----- 7 files changed, 58 insertions(+), 73 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 623f7614f1..da13e26b3b 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -110,7 +110,8 @@ typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*, /* argc */ int, /* argv */ char**, /* props */ xbt_dict_t, - /* auto_restart */ int); + /* auto_restart */ int, + /* parent_process */ smx_process_t); /******************************* Networking ***********************************/ diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index 1d2eb8f187..56448820b1 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -146,8 +146,10 @@ void __MSG_file_destroy(msg_file_priv_t host); void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc); void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name, xbt_main_func_t code, void *data, - const char *hostname, double kill_time, int argc, - char **argv, xbt_dict_t properties, int auto_restart); + const char *hostname, double kill_time, + int argc, char **argv, + xbt_dict_t properties, int auto_restart, + smx_process_t parent_process); void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size); void _MSG_action_init(void); diff --git a/src/msg/msg_process.c b/src/msg/msg_process.c index 6fbe364a69..6a64e9db7d 100644 --- a/src/msg/msg_process.c +++ b/src/msg/msg_process.c @@ -56,9 +56,11 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc) /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */ void MSG_process_create_from_SIMIX(smx_process_t* process, const char *name, - xbt_main_func_t code, void *data, - const char *hostname, double kill_time, int argc, char **argv, - xbt_dict_t properties, int auto_restart) + xbt_main_func_t code, void *data, + const char *hostname, double kill_time, + int argc, char **argv, + xbt_dict_t properties, int auto_restart, + smx_process_t parent_process) { msg_host_t host = MSG_get_host_by_name(hostname); msg_process_t p = MSG_process_create_with_environment(name, code, data, diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index 894de3c2dd..d1fcee1a94 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -80,7 +80,7 @@ static void parse_process(sg_platf_process_cbarg_t process) process->argc, (char**)(process->argv), current_property_set, - auto_restart); + auto_restart, NULL); else simcall_process_create(&process_created, (char*)(process->argv)[0], parse_code, NULL, sg_host_name(host), kill_time, process->argc, (char**)process->argv, current_property_set,auto_restart); diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 40f3c73e24..0ee1ee8c48 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -53,7 +53,7 @@ void SIMIX_host_on(smx_host_t 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); + 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) { @@ -70,19 +70,19 @@ void SIMIX_host_on(smx_host_t h) arg->argc, arg->argv, arg->properties, - arg->auto_restart); - } - else { + 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); + arg->argv[0], + arg->code, + NULL, + arg->hostname, + arg->kill_time, + arg->argc, + arg->argv, + arg->properties, + arg->auto_restart); } } } @@ -391,7 +391,8 @@ void SIMIX_host_restart_processes(smx_host_t host) arg->argc, arg->argv, arg->properties, - arg->auto_restart); + arg->auto_restart, + NULL); } else { simcall_process_create(&process, arg->argv[0], diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 205d5b48be..0fadb637f6 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -179,17 +179,17 @@ void SIMIX_process_stop(smx_process_t arg) { smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) { smx_process_t process; - simix_global->create_process_function( - &process, - args->name, - args->code, - args->data, - args->hostname, - args->kill_time, - args->argc, - args->argv, - args->properties, - args->auto_restart); + simix_global->create_process_function(&process, + args->name, + args->code, + args->data, + args->hostname, + args->kill_time, + args->argc, + args->argv, + args->properties, + args->auto_restart, + NULL); xbt_free(args); return process; } @@ -205,9 +205,9 @@ void SIMIX_pre_process_create(smx_simcall_t simcall, int argc, char **argv, xbt_dict_t properties, int auto_restart){ - SIMIX_process_create_with_parent(process, name, code, data, hostname, - kill_time, argc, argv, properties, auto_restart, - simcall->issuer); + SIMIX_process_create(process, name, code, data, hostname, + kill_time, argc, argv, properties, auto_restart, + simcall->issuer); } /** * \brief Internal function to create a process. @@ -226,21 +226,9 @@ void SIMIX_process_create(smx_process_t *process, double kill_time, int argc, char **argv, xbt_dict_t properties, - int auto_restart) { - SIMIX_process_create_with_parent(process, name, code, data, hostname, - kill_time, argc, argv, properties, auto_restart, NULL); -} - -void SIMIX_process_create_with_parent(smx_process_t *process, - const char *name, - xbt_main_func_t code, - void *data, - const char *hostname, - double kill_time, - int argc, char **argv, - xbt_dict_t properties, - int auto_restart, - smx_process_t parent_process) { + int auto_restart, + smx_process_t parent_process) +{ *process = NULL; smx_host_t host = SIMIX_host_get_by_name(hostname); @@ -956,19 +944,19 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer) arg.argc, arg.argv, arg.properties, - arg.auto_restart); - } - else { + arg.auto_restart, + NULL); + } else { simcall_process_create(&new_process, - arg.argv[0], - arg.code, - arg.data, - arg.hostname, - arg.kill_time, - arg.argc, - arg.argv, - arg.properties, - arg.auto_restart); + arg.argv[0], + arg.code, + arg.data, + arg.hostname, + arg.kill_time, + arg.argc, + arg.argv, + arg.properties, + arg.auto_restart); } return new_process; diff --git a/src/simix/smx_process_private.h b/src/simix/smx_process_private.h index 0d2494369e..eb269f97fa 100644 --- a/src/simix/smx_process_private.h +++ b/src/simix/smx_process_private.h @@ -70,17 +70,8 @@ void SIMIX_process_create(smx_process_t *process, double kill_time, int argc, char **argv, xbt_dict_t properties, - int auto_restart); -void SIMIX_process_create_with_parent(smx_process_t *process, - const char *name, - xbt_main_func_t code, - void *data, - const char *hostname, - double kill_time, - int argc, char **argv, - xbt_dict_t properties, - int auto_restart, - smx_process_t parent_process); + int auto_restart, + smx_process_t parent_process); void SIMIX_process_runall(void); void SIMIX_process_kill(smx_process_t process, smx_process_t issuer); void SIMIX_process_killall(smx_process_t issuer, int reset_pid); -- 2.20.1