From: Martin Quinson Date: Sun, 25 Nov 2012 14:07:45 +0000 (+0100) Subject: xbt_os_procname and xbt_binary_name are the same -- keep only one of them X-Git-Tag: v3_9_rc1~91^2~28 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a11846627b7e46427494b079e4124a1e8a10e288 xbt_os_procname and xbt_binary_name are the same -- keep only one of them --- diff --git a/include/xbt/module.h b/include/xbt/module.h index f3f5a44d22..3fc85f9f0d 100644 --- a/include/xbt/module.h +++ b/include/xbt/module.h @@ -11,8 +11,6 @@ #include /* XBT_PUBLIC */ -XBT_PUBLIC(char *)xbt_binary_name; - XBT_PUBLIC(void) xbt_init(int *argc, char **argv); XBT_PUBLIC(void) xbt_exit(void); #endif /* _XBT_MODULE_H */ diff --git a/include/xbt/virtu.h b/include/xbt/virtu.h index c298083f31..006bdd87d2 100644 --- a/include/xbt/virtu.h +++ b/include/xbt/virtu.h @@ -22,7 +22,7 @@ XBT_PUBLIC_DATA(int_f_void_t) xbt_getpid; XBT_PUBLIC(double) xbt_time(void); /* Get the name of the UNIX process englobing the world */ - XBT_PUBLIC(const char*) xbt_os_procname(void); + XBT_PUBLIC_DATA(char*) xbt_binary_name; /** * diff --git a/src/surf/surf.c b/src/surf/surf.c index df3087e1a1..fc1e385857 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -413,13 +413,8 @@ void sg_version(int *ver_major,int *ver_minor,int *ver_patch) { xbt_dynar_t sg_cmdline = NULL; -extern char *xbt_os_procname_data; - - void surf_init(int *argc, char **argv) { - xbt_os_procname_data = argv[0]; - XBT_DEBUG("Create all Libs"); host_lib = xbt_lib_new(); link_lib = xbt_lib_new(); diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index e9dbed5524..898069ab0c 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -116,7 +116,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im e->bt_strings = NULL; - if (!xbt_binary_name) /* no binary name, nothing to do */ + if (xbt_binary_name != NULL) /* no binary name, nothing to do */ return; if (e->used <= 1) diff --git a/src/xbt/ex.c b/src/xbt/ex.c index d853cf56dd..b90fc8d331 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -46,7 +46,6 @@ #include "portable.h" /* execinfo when available */ #include "xbt/ex.h" #include "xbt/str.h" -#include "xbt/module.h" /* xbt_binary_name */ #include "xbt_modinter.h" /* backtrace initialization headers */ #include "xbt/ex_interface.h" @@ -140,7 +139,7 @@ void xbt_ex_display(xbt_ex_t * e) "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n" "** %s\n" "** Thrown by %s()%s\n", - xbt_os_procname(), xbt_getpid(), + xbt_binary_name, xbt_getpid(), xbt_ex_catname(e->category), e->value, e->msg, e->procname, thrower ? thrower : " in this process"); XBT_CRITICAL("%s", e->msg); diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index f577979454..9ffeac1fbb 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -13,8 +13,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mm_diff, xbt, "Logging specific to mm_diff in mmalloc"); -extern char *xbt_binary_name; - xbt_dynar_t mc_heap_comparison_ignore; xbt_dynar_t stacks_areas; diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 79a0c7c2cf..73e2daa1f2 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -26,7 +26,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling"); XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories"); /* lives here even if that's a bit odd to solve linking issues: this is used in xbt_log_file_appender to detect whether SMPI is used (and thus whether we should unbench the writing to disk) */ -char *xbt_binary_name = NULL; /* Mandatory to retrieve neat backtraces */ +char *xbt_binary_name = NULL; /* Name of the system process containing us (mandatory to retrieve neat backtraces) */ int xbt_initialized = 0; int _surf_do_model_check = 0; diff --git a/src/xbt/xbt_virtu.c b/src/xbt/xbt_virtu.c index efe333daef..664d87b3eb 100644 --- a/src/xbt/xbt_virtu.c +++ b/src/xbt/xbt_virtu.c @@ -11,8 +11,6 @@ #include "xbt/function_types.h" #include "simgrid/simix.h" -char *xbt_os_procname_data = NULL; - static int xbt_fake_pid(void) { return 0; @@ -41,8 +39,3 @@ const char *xbt_procname(void) { return SIMIX_process_self_get_name(); } - -const char *xbt_os_procname(void) -{ - return xbt_os_procname_data; -}