From 1cde906ff21eb6a3dd34cce742b544e1ddcb8994 Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 17 Aug 2009 09:24:23 +0000 Subject: [PATCH] Fixed some issues in logs logic due to recent changes [Cristian] We assumed that maestro have no simix process (not true anymore) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6563 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- .../msg/masterslave/masterslave_failure.tesh | 2 +- src/gras/Virtu/sg_dns.c | 20 ++++++++++++++----- src/gras/Virtu/sg_process.c | 19 +++++++++++------- src/simix/smx_context.c | 2 +- src/simix/smx_context_sysv.c | 2 +- src/simix/smx_context_thread.c | 2 +- src/simix/smx_global.c | 2 ++ src/simix/smx_process.c | 2 -- 8 files changed, 33 insertions(+), 18 deletions(-) diff --git a/examples/msg/masterslave/masterslave_failure.tesh b/examples/msg/masterslave/masterslave_failure.tesh index cefe5c6357..404f31b648 100644 --- a/examples/msg/masterslave/masterslave_failure.tesh +++ b/examples/msg/masterslave/masterslave_failure.tesh @@ -3,7 +3,7 @@ p Testing a simple master/slave example application handling failures $ masterslave/masterslave_failure$EXEEXT small_platform_with_failures.xml masterslave/deployment_masterslave.xml -> [0.000000] simix/smx_process.c:84: [simix_process/WARNING] Cannot launch process 'slave' on failed host 'Fafard' +> [0.000000] simix/smx_process.c:92: [simix_process/WARNING] Cannot launch process 'slave' on failed host 'Fafard' > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Got 5 slave(s) : > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Jupiter > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Fafard diff --git a/src/gras/Virtu/sg_dns.c b/src/gras/Virtu/sg_dns.c index 09bba4612d..e3e83ecd27 100644 --- a/src/gras/Virtu/sg_dns.c +++ b/src/gras/Virtu/sg_dns.c @@ -12,9 +12,19 @@ const char *gras_os_myname(void) { - smx_host_t host = SIMIX_host_self(); - if (host != NULL) - return SIMIX_host_get_name(SIMIX_host_self()); - else - return ""; + smx_host_t host; + smx_process_t process = SIMIX_process_self(); + + /*HACK: maestro used not have a simix process, now it does so + SIMIX_process_self will return something different to NULL. This breaks + the old xbt_log logic that assumed that NULL was equivalent to maestro, + thus when printing it searches for maestro host name (which doesn't exists) + and breaks the logging. + As a hack we check for maestro by looking to the assigned host, if it is + NULL then we are sure is maestro + */ + if (process != NULL && (host = SIMIX_host_self()) != NULL) + return SIMIX_host_get_name(host); + + return ""; } diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index 218b4473b8..1ecbf3e2e4 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -170,14 +170,19 @@ xbt_dict_t gras_process_properties(void) const char *xbt_procname(void) { - const char *res = NULL; smx_process_t process = SIMIX_process_self(); - if (process != NULL) - res = SIMIX_process_get_name(process); - if (res) - return res; - else - return ""; + /*FIXME: maestro used not have a simix process, now it does so + SIMIX_process_self will return something different to NULL. This breaks + the old xbt_log logic that assumed that NULL was equivalent to maestro, + thus when printing it searches for maestro host name (which doesn't exists) + and breaks the logging. + As a hack we check for maestro by looking to the assigned host, if it is + NULL then we are sure is maestro + */ + if (process != NULL && SIMIX_host_self()) + return SIMIX_process_get_name(process); + + return ""; } int gras_os_getpid(void) diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 3b83787148..7101a1ab19 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -11,7 +11,7 @@ #include "xbt/swag.h" #include "private.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smx_context, simix, "Context switching mecanism"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix, "Context switching mecanism"); /** diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 418dbdb305..5834354e0b 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -20,7 +20,7 @@ # include #endif /* HAVE_VALGRIND_VALGRIND_H */ -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smx_context); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); typedef struct s_smx_ctx_sysv { SMX_CTX_BASE_T; diff --git a/src/simix/smx_context_thread.c b/src/simix/smx_context_thread.c index 9bd06d63e3..0c1d543cab 100644 --- a/src/simix/smx_context_thread.c +++ b/src/simix/smx_context_thread.c @@ -14,7 +14,7 @@ #include "xbt/swag.h" #include "xbt/xbt_os_thread.h" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smx_context); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); typedef struct s_smx_ctx_thread { SMX_CTX_BASE_T; diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index bc2f6f4ebb..c04067bc0f 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -18,6 +18,7 @@ XBT_LOG_EXTERNAL_CATEGORY(simix_environment); XBT_LOG_EXTERNAL_CATEGORY(simix_host); XBT_LOG_EXTERNAL_CATEGORY(simix_process); XBT_LOG_EXTERNAL_CATEGORY(simix_synchro); +XBT_LOG_EXTERNAL_CATEGORY(simix_context); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, "Logging specific to SIMIX (kernel)"); @@ -55,6 +56,7 @@ void SIMIX_global_init(int *argc, char **argv) XBT_LOG_CONNECT(simix_kernel, simix); XBT_LOG_CONNECT(simix_process, simix); XBT_LOG_CONNECT(simix_synchro, simix); + XBT_LOG_CONNECT(simix_context, simix); simix_global = xbt_new0(s_SIMIX_Global_t, 1); diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index e3cc9ce9df..e0c849ca70 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -18,7 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, /** * \brief Move a process to the list of process to destroy. * */ - void SIMIX_process_cleanup(void *arg) { xbt_swag_remove(arg, simix_global->process_to_run); @@ -47,7 +46,6 @@ void SIMIX_process_empty_trash(void) /** * \brief Creates and runs the maestro process - * */ void __SIMIX_create_maestro_process() { -- 2.20.1