X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/347996b4a10c4e8579080692afa60e0afb88b60a..aabd69e2ec25a7e7e1b6e3d7d86f531c42f4fca9:/src/xbt/log.c diff --git a/src/xbt/log.c b/src/xbt/log.c index 49d4529635..1428f70217 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -11,7 +11,7 @@ #include /* snprintf */ #include /* snprintf */ -#include "src/portable.h" /* to get a working stdarg.h */ +#include "src/internal_config.h" #include "src/xbt_modinter.h" @@ -24,7 +24,7 @@ #include "xbt/xbt_os_thread.h" int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */ -static xbt_os_rmutex_t log_cat_init_mutex = NULL; +static xbt_os_mutex_t log_cat_init_mutex = NULL; /** \addtogroup XBT_log * @@ -552,7 +552,7 @@ void xbt_log_preinit(void) xbt_log_default_layout = xbt_log_layout_simple_new(NULL); _XBT_LOGV(XBT_LOG_ROOT_CAT).appender = xbt_log_default_appender; _XBT_LOGV(XBT_LOG_ROOT_CAT).layout = xbt_log_default_layout; - log_cat_init_mutex = xbt_os_rmutex_init(); + log_cat_init_mutex = xbt_os_mutex_init(); } static void xbt_log_connect_categories(void) @@ -562,7 +562,6 @@ static void xbt_log_connect_categories(void) /* xbt */ XBT_LOG_CONNECT(xbt); - XBT_LOG_CONNECT(graphxml_parse); XBT_LOG_CONNECT(log); XBT_LOG_CONNECT(module); XBT_LOG_CONNECT(replay); @@ -571,9 +570,6 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(xbt_dict); XBT_LOG_CONNECT(xbt_dict_cursor); XBT_LOG_CONNECT(xbt_dict_elm); -#ifdef XBT_USE_DEPRECATED - XBT_LOG_CONNECT(xbt_dict_multi); -#endif XBT_LOG_CONNECT(xbt_dyn); XBT_LOG_CONNECT(xbt_ex); XBT_LOG_CONNECT(xbt_fifo); @@ -590,8 +586,7 @@ static void xbt_log_connect_categories(void) /* The following categories are only defined in libsimgrid */ /* bindings */ -#ifdef HAVE_LUA - XBT_LOG_CONNECT(bindings); +#if HAVE_LUA XBT_LOG_CONNECT(lua); XBT_LOG_CONNECT(lua_host); XBT_LOG_CONNECT(lua_platf); @@ -617,14 +612,14 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(instr_TI_trace); /* jedule */ -#ifdef HAVE_JEDULE +#if HAVE_JEDULE XBT_LOG_CONNECT(jedule); XBT_LOG_CONNECT(jed_out); XBT_LOG_CONNECT(jed_sd); #endif /* mc */ -#ifdef HAVE_MC +#if HAVE_MC XBT_LOG_CONNECT(mc); XBT_LOG_CONNECT(mc_checkpoint); XBT_LOG_CONNECT(mc_comm_determinism); @@ -632,7 +627,6 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(mc_diff); XBT_LOG_CONNECT(mc_dwarf); XBT_LOG_CONNECT(mc_hash); - XBT_LOG_CONNECT(mc_ignore); XBT_LOG_CONNECT(mc_liveness); XBT_LOG_CONNECT(mc_memory); XBT_LOG_CONNECT(mc_page_snapshot); @@ -670,7 +664,7 @@ static void xbt_log_connect_categories(void) /* simdag */ XBT_LOG_CONNECT(sd); XBT_LOG_CONNECT(sd_daxparse); -#ifdef HAVE_GRAPHVIZ +#if HAVE_GRAPHVIZ XBT_LOG_CONNECT(sd_dotparse); #endif XBT_LOG_CONNECT(sd_kernel); @@ -705,7 +699,7 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(surf_lagrange_dichotomy); XBT_LOG_CONNECT(surf_maxmin); XBT_LOG_CONNECT(surf_network); -#ifdef HAVE_NS3 +#if HAVE_NS3 XBT_LOG_CONNECT(ns3); #endif XBT_LOG_CONNECT(surf_parse); @@ -795,7 +789,7 @@ static void log_cat_exit(xbt_log_category_t cat) void xbt_log_postexit(void) { XBT_VERB("Exiting log"); - xbt_os_rmutex_destroy(log_cat_init_mutex); + xbt_os_mutex_destroy(log_cat_init_mutex); xbt_dynar_free(&xbt_log_settings); log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT)); } @@ -890,8 +884,7 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category, if (setting->fmt) { xbt_log_layout_set(category, xbt_log_layout_format_new(setting->fmt)); - XBT_DEBUG("Apply settings for category '%s': set format to %s", - category->name, setting->fmt); + XBT_DEBUG("Apply settings for category '%s': set format to %s", category->name, setting->fmt); } if (setting->additivity != -1) { @@ -921,14 +914,12 @@ int _xbt_log_cat_init(xbt_log_category_t category, { #define _xbt_log_cat_init(a, b) (0) - if (log_cat_init_mutex != NULL) { - xbt_os_rmutex_acquire(log_cat_init_mutex); - } + if (log_cat_init_mutex != NULL) + xbt_os_mutex_acquire(log_cat_init_mutex); if (category->initialized) { - if (log_cat_init_mutex != NULL) { - xbt_os_rmutex_release(log_cat_init_mutex); - } + if (log_cat_init_mutex != NULL) + xbt_os_mutex_release(log_cat_init_mutex); return priority >= category->threshold; } @@ -1005,9 +996,8 @@ int _xbt_log_cat_init(xbt_log_category_t category, } category->initialized = 1; - if (log_cat_init_mutex != NULL) { - xbt_os_rmutex_release(log_cat_init_mutex); - } + if (log_cat_init_mutex != NULL) + xbt_os_mutex_release(log_cat_init_mutex); return priority >= category->threshold; #undef _xbt_log_cat_init @@ -1170,7 +1160,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) set->fmt = xbt_strdup(eq + 1); } else { char buff[512]; - snprintf(buff, min(512, eq - dot), "%s", dot + 1); + snprintf(buff, MIN(512, eq - dot), "%s", dot + 1); THROWF(arg_error, 0, "Unknown setting of the log category: '%s'", buff); }