Hi,
the patch in attachment makes sure that LOGSYS_DECLARE_SYSTEM
is always invoked before LOGSYS_DECLARE_(NO)SUBSYS by using the
optional priority argument to the construct attribute.
Depending on the -O level when building, gcc rearrange the construct
ordering as it fits best but it doesn't guarantee they are invoked
in the same order as written in the code.
This could lead to DECLARE_SYSTEM to be issued after (NO)SUBSYS
and it's not a desired behavior for logsys.
The 2 values 101 and 102 are the first available in the range since
0 to 100 are reserved for the implementation (gcc).
Fabio
Index: include/corosync/engine/logsys.h
===================================================================
--- include/corosync/engine/logsys.h (revision 1989)
+++ include/corosync/engine/logsys.h (working copy)
@@ -175,7 +175,7 @@
#define LOG_REC_END (&logsys_rec_end)
#define LOGSYS_DECLARE_SYSTEM(name,mode,file,facility,format,rec_size) \
-__attribute__ ((constructor)) static void logsys_system_init (void) \
+__attribute__ ((constructor (101))) static void logsys_system_init (void) \
{ \
const char *error_string; \
\
@@ -188,7 +188,7 @@
}
#define LOGSYS_DECLARE_NOSUBSYS(priority) \
-__attribute__ ((constructor)) static void logsys_nosubsys_init (void) \
+__attribute__ ((constructor (102))) static void logsys_nosubsys_init (void) \
{ \
unsigned int pri, tags; \
\
@@ -203,7 +203,7 @@
}
#define LOGSYS_DECLARE_SUBSYS(subsys,priority) \
-__attribute__ ((constructor)) static void logsys_subsys_init (void) \
+__attribute__ ((constructor (102))) static void logsys_subsys_init (void) \
{ \
unsigned int pri, tags; \
\
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais