diff --git a/src/core/log.c b/src/core/log.c index 0d636b9ba90..89be4f7fb17 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -103,6 +103,16 @@ core_log_fini() core_log_default_fini(); } +static void +core_log_lib_info(void) { + CORE_LOG_HARK("src version: " SRCVERSION); +#if SDS_ENABLED + CORE_LOG_HARK("compiled with support for shutdown state"); +#endif +#if NDCTL_ENABLED + CORE_LOG_HARK("compiled with libndctl 63+"); +#endif +} /* * core_log_set_function -- set the log function pointer either to * a user-provided function pointer or to the default logging function. @@ -127,10 +137,12 @@ core_log_set_function(core_log_function *log_function, void *context) core_log_function_old, (uintptr_t)log_function)) return EAGAIN; if (__sync_bool_compare_and_swap(&Core_log_function_context, - context_old, context)) + context_old, context)) { + core_log_lib_info(); return 0; + } - __sync_bool_compare_and_swap(&Core_log_function, + (void) __sync_bool_compare_and_swap(&Core_log_function, (uintptr_t)log_function, core_log_function_old); return EAGAIN; diff --git a/src/core/out.c b/src/core/out.c index e6922ab4f90..54003a5382e 100644 --- a/src/core/out.c +++ b/src/core/out.c @@ -133,13 +133,6 @@ out_init(const char *log_prefix, const char *log_level_var, abort(); } } - - if (log_level != NULL || log_file != NULL) { - ret = core_log_set_function(out_legacy, NULL); - if (ret) { - CORE_LOG_FATAL("Cannot set legacy log function"); - } - } #endif /* DEBUG */ char *log_alignment = os_getenv("PMDK_LOG_ALIGN"); @@ -154,11 +147,19 @@ out_init(const char *log_prefix, const char *log_level_var, else setlinebuf(Out_fp); +#ifdef DEBUG + if (log_level != NULL || log_file != NULL) { + ret = core_log_set_function(out_legacy, NULL); + if (ret) { + CORE_LOG_FATAL("Cannot set legacy log function"); + } + } +#endif /* DEBUG */ #ifdef DEBUG static char namepath[PATH_MAX]; CORE_LOG_HARK("pid %d: program: %s", getpid(), util_getexecname(namepath, PATH_MAX)); -#endif +#endif /* DEBUG */ CORE_LOG_HARK("%s version %d.%d", log_prefix, major_version, minor_version); diff --git a/src/test/arch_flags/log0.log.match b/src/test/arch_flags/log0.log.match index 6328efe7c15..6335703f5f0 100644 --- a/src/test/arch_flags/log0.log.match +++ b/src/test/arch_flags/log0.log.match @@ -1,12 +1,15 @@ -: <1> [$(nW) out_init]$(W)pid $(nW): program: $(nW) -: <1> [$(nW) out_init]$(W)arch_flags version 0.0 -: <1> [$(nW) out_init]$(W)src version: $(nW) -$(OPT): <1> [$(nW) out_init]$(W)compiled with support for Valgrind pmemcheck -$(OPT): <1> [$(nW) out_init]$(W)compiled with support for Valgrind helgrind -$(OPT): <1> [$(nW) out_init]$(W)compiled with support for Valgrind memcheck -$(OPT): <1> [$(nW) out_init]$(W)compiled with support for Valgrind drd -$(OPT): <1> [$(nW) out_init]$(W)compiled with support for shutdown state -$(OPT): <1> [$(nW) out_init]$(W)compiled with libndctl 63+ +: <1> [$(*)]$(W)src version: $(nW) +$(OPT): <1> [$(*)]$(W)compiled with support for shutdown state +$(OPT): <1> [$(*)]$(W)compiled with libndctl 63+ +: <1> [$(*)]$(W)pid $(nW): program: $(nW) +: <1> [$(*)]$(W)arch_flags version 0.0 +: <1> [$(*)]$(W)src version: $(nW) +$(OPT): <1> [$(*)]$(W)compiled with support for Valgrind pmemcheck +$(OPT): <1> [$(*)]$(W)compiled with support for Valgrind helgrind +$(OPT): <1> [$(*)]$(W)compiled with support for Valgrind memcheck +$(OPT): <1> [$(*)]$(W)compiled with support for Valgrind drd +$(OPT): <1> [$(*)]$(W)compiled with support for shutdown state +$(OPT): <1> [$(*)]$(W)compiled with libndctl 63+ : <3> [$(nW) util_mmap_init] : <1> [$(nW) util_check_arch_flags]$(W)invalid machine value : <1> [$(nW) util_check_arch_flags]$(W)invalid machine_class value diff --git a/src/test/out_err/traces0.log.match b/src/test/out_err/traces0.log.match index 0e34ec94875..f4a016acc1d 100644 --- a/src/test/out_err/traces0.log.match +++ b/src/test/out_err/traces0.log.match @@ -1,3 +1,6 @@ +: <1> [$(*)]$(W)src version: $(nW) +$(OPT): <1> [$(*)]$(W)compiled with support for shutdown state +$(OPT): <1> [$(*)]$(W)compiled with libndctl 63+ : <1> [out.c:$(N) out_init]$(W)pid $(N): program: $(nW) : <1> [out.c:$(N) out_init]$(W)trace version 1.0 : <1> [out.c:$(N) out_init]$(W)src version: $(nW) diff --git a/src/test/traces/custom_file0.log.match b/src/test/traces/custom_file0.log.match index 8247d4a062f..f5fc05bbbb5 100644 --- a/src/test/traces/custom_file0.log.match +++ b/src/test/traces/custom_file0.log.match @@ -1,3 +1,6 @@ +$(nW) <1> $(nW) $(nW) src version: $(nW) +$(nW) <1> $(nW) $(nW) compiled with support for shutdown state +$(nW) <1> $(nW) $(nW) compiled with libndctl 63+ $(nW) <1> $(nW) $(nW) pid $(N): program: $(nW) $(nW) <1> $(nW) $(nW) ut version 1.0 $(nW) <1> $(nW) $(nW) src version: $(nW) diff --git a/src/test/traces/redir_stderr2.log.match b/src/test/traces/redir_stderr2.log.match index e0792eb7238..1b1da1d81dc 100644 --- a/src/test/traces/redir_stderr2.log.match +++ b/src/test/traces/redir_stderr2.log.match @@ -1,3 +1,6 @@ +$(nW) <1> $(nW) $(nW) src version: $(nW) +$(nW) <1> $(nW) $(nW) compiled with support for shutdown state +$(nW) <1> $(nW) $(nW) compiled with libndctl 63+ $(nW) <1> $(nW) $(nW) pid $(N): program: $(nW) $(nW) <1> $(nW) $(nW) ut version 1.0 $(nW) <1> $(nW) $(nW) src version: $(nW) diff --git a/src/test/traces/redir_stderr3.log.match b/src/test/traces/redir_stderr3.log.match index 1522078c9fe..c71f0ff5d27 100644 --- a/src/test/traces/redir_stderr3.log.match +++ b/src/test/traces/redir_stderr3.log.match @@ -1,3 +1,6 @@ +$(nW) <1> $(nW) $(nW) src version: $(nW) +$(nW) <1> $(nW) $(nW) compiled with support for shutdown state +$(nW) <1> $(nW) $(nW) compiled with libndctl 63+ $(nW) <1> $(nW) $(nW) pid $(N): program: $(nW) $(nW) <1> $(nW) $(nW) ut version 1.0 $(nW) <1> $(nW) $(nW) src version: $(nW) diff --git a/src/test/traces/redir_stderr4.log.match b/src/test/traces/redir_stderr4.log.match index be7f3829c7b..48b1f776812 100644 --- a/src/test/traces/redir_stderr4.log.match +++ b/src/test/traces/redir_stderr4.log.match @@ -1,3 +1,6 @@ +$(nW) <1> $(nW) $(nW) src version: $(nW) +$(nW) <1> $(nW) $(nW) compiled with support for shutdown state +$(nW) <1> $(nW) $(nW) compiled with libndctl 63+ $(nW) <1> $(nW) $(nW) pid $(N): program: $(nW) $(nW) <1> $(nW) $(nW) ut version 1.0 $(nW) <1> $(nW) $(nW) src version: $(nW) diff --git a/src/test/traces/redir_stderr5.log.match b/src/test/traces/redir_stderr5.log.match index 8247d4a062f..f5fc05bbbb5 100644 --- a/src/test/traces/redir_stderr5.log.match +++ b/src/test/traces/redir_stderr5.log.match @@ -1,3 +1,6 @@ +$(nW) <1> $(nW) $(nW) src version: $(nW) +$(nW) <1> $(nW) $(nW) compiled with support for shutdown state +$(nW) <1> $(nW) $(nW) compiled with libndctl 63+ $(nW) <1> $(nW) $(nW) pid $(N): program: $(nW) $(nW) <1> $(nW) $(nW) ut version 1.0 $(nW) <1> $(nW) $(nW) src version: $(nW) diff --git a/src/test/util_poolset/grep0.log.match b/src/test/util_poolset/grep0.log.match index 6790b813cff..bfdcdb162bb 100644 --- a/src/test/util_poolset/grep0.log.match +++ b/src/test/util_poolset/grep0.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)/util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep1.log.match b/src/test/util_poolset/grep1.log.match index 7dcf42462b5..739d49f8239 100644 --- a/src/test/util_poolset/grep1.log.match +++ b/src/test/util_poolset/grep1.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)/util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep2.log.match b/src/test/util_poolset/grep2.log.match index 6d25e56c110..4d9565f6890 100644 --- a/src/test/util_poolset/grep2.log.match +++ b/src/test/util_poolset/grep2.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)/util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep3.log.match b/src/test/util_poolset/grep3.log.match index 96b81b9b3b7..e65f9966f51 100644 --- a/src/test/util_poolset/grep3.log.match +++ b/src/test/util_poolset/grep3.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep4.log.match b/src/test/util_poolset/grep4.log.match index 96b81b9b3b7..e65f9966f51 100644 --- a/src/test/util_poolset/grep4.log.match +++ b/src/test/util_poolset/grep4.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep5.log.match b/src/test/util_poolset/grep5.log.match index 96b81b9b3b7..e65f9966f51 100644 --- a/src/test/util_poolset/grep5.log.match +++ b/src/test/util_poolset/grep5.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep6.log.match b/src/test/util_poolset/grep6.log.match index 536bfdc581b..cacd9c26dae 100644 --- a/src/test/util_poolset/grep6.log.match +++ b/src/test/util_poolset/grep6.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)util_poolset$(nW) ut version 1.0 src version: $(nW) diff --git a/src/test/util_poolset/grep7.log.match b/src/test/util_poolset/grep7.log.match index 712b6a897dd..b89d04ba9fb 100644 --- a/src/test/util_poolset/grep7.log.match +++ b/src/test/util_poolset/grep7.log.match @@ -1,3 +1,6 @@ +src version: $(nW) +$(OPT)compiled with support for shutdown state +$(OPT)compiled with libndctl 63+ pid $(N): program: $(nW)util_poolset$(nW) ut version 1.0 src version: $(nW)