[sheepdog] [PATCH] logger: set priorities to logger constructor

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Feb 7 08:52:34 CET 2013


We must call log_format_register before init_log_formatter.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 lib/logger.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/logger.c b/lib/logger.c
index 9605ae6..aa465bf 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -75,7 +75,7 @@ struct log_format {
 };
 
 #define log_format_register(n, formatter_fn)				\
-	static void __attribute__((constructor))			\
+	static void __attribute__((constructor(101)))			\
 	regist_ ## formatter_fn(void) {					\
 		static struct log_format f =				\
 			{ .name = n, .formatter = formatter_fn };	\
@@ -105,7 +105,7 @@ static pthread_mutex_t logsize_lock = PTHREAD_MUTEX_INITIALIZER;
  * We need to set default log formatter because collie doesn't want to call
  * select_log_formatter().
  */
-static void __attribute__((constructor))
+static void __attribute__((constructor(65535)))
 init_log_formatter(void)
 {
 	struct log_format *f;
-- 
1.7.2.5




More information about the sheepdog mailing list