Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixed some issues in logs logic due to recent changes [Cristian]
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Aug 2009 09:24:23 +0000 (09:24 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Aug 2009 09:24:23 +0000 (09:24 +0000)
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

examples/msg/masterslave/masterslave_failure.tesh
src/gras/Virtu/sg_dns.c
src/gras/Virtu/sg_process.c
src/simix/smx_context.c
src/simix/smx_context_sysv.c
src/simix/smx_context_thread.c
src/simix/smx_global.c
src/simix/smx_process.c

index cefe5c6..404f31b 100644 (file)
@@ -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
index 09bba46..e3e83ec 100644 (file)
 
 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 ""; 
 }
index 218b447..1ecbf3e 100644 (file)
@@ -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)
index 3b83787..7101a1a 100644 (file)
@@ -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");
 
 
 /**
index 418dbdb..5834354 100644 (file)
@@ -20,7 +20,7 @@
 #  include <valgrind/valgrind.h>
 #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;
index 9bd06d6..0c1d543 100644 (file)
@@ -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;
index bc2f6f4..c04067b 100644 (file)
@@ -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);
 
index e3cc9ce..e0c849c 100644 (file)
@@ -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()
 {