Просмотр исходного кода

Fix error in a previous logsys patch.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1574 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 лет назад
Родитель
Сommit
49dd2badad
2 измененных файлов с 34 добавлено и 2 удалено
  1. 4 2
      exec/logsys.c
  2. 30 0
      exec/logsys.h

+ 4 - 2
exec/logsys.c

@@ -84,6 +84,8 @@ static unsigned int dropped_log_entries = 0;
 #endif
 struct logsys_logger logsys_loggers[MAX_LOGGERS];
 
+int logsys_single_id = 0;
+
 
 struct log_entry {
 	char *file;
@@ -641,7 +643,8 @@ int logsys_init (char *name, int mode, int facility, int priority, char *file)
 {
 	char *errstr;
 
-	logsys_subsys_id = 0;
+	/* logsys_subsys_id will be 0 */
+	logsys_single_id = 1;
 
 	strncpy (logsys_loggers[0].subsys, name,
 		 sizeof (logsys_loggers[0].subsys));
@@ -670,7 +673,6 @@ int logsys_conf (char *name, int mode, int facility, int priority, char *file)
 
 void logsys_exit (void)
 {
-	logsys_subsys_id = -1;
 	logsys_flush ();
 }
 

+ 30 - 0
exec/logsys.h

@@ -97,6 +97,8 @@ struct logsys_logger {
 
 extern struct logsys_logger logsys_loggers[];
 
+extern int logsys_single_id;
+
 extern inline int logsys_mkpri (int priority, int id);
 
 extern void logsys_config_mode_set (
@@ -191,6 +193,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 }
 
 #define log_printf(lvl, format, args...) do {				\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if ((lvl) <= logsys_loggers[logsys_subsys_id].priority)	{	\
 		_logsys_log_printf2 (__FILE__, __LINE__, lvl,		\
@@ -199,6 +203,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define dprintf(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_log_printf2 (__FILE__, __LINE__, LOG_DEBUG,	\
@@ -207,6 +213,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define ENTER_VOID() do {						\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER,	\
@@ -215,6 +223,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define ENTER(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER,	\
@@ -224,6 +234,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define LEAVE_VOID() do {						\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE,	\
@@ -232,6 +244,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define LEAVE(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE,	\
@@ -241,6 +255,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE1(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE1,	\
@@ -249,6 +265,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE2(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE2,	\
@@ -257,6 +275,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE3(format, args...) do { \
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE3,	\
@@ -265,6 +285,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE4(format, args...) do { \
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE4,	\
@@ -273,6 +295,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE5(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE5,	\
@@ -281,6 +305,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE6(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE6,	\
@@ -289,6 +315,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE7(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 		_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE7,	\
@@ -297,6 +325,8 @@ __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 } while(0)
 
 #define TRACE8(format, args...) do {					\
+	if (logsys_single_id)						\
+		logsys_subsys_id = 0;					\
 	assert (logsys_subsys_id != -1);				\
 	if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \
 	_logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE8,		\