Procházet zdrojové kódy

Allow setting of the logsys priority to one lower then was already specified.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1579 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake před 17 roky
rodič
revize
6a518947d4
2 změnil soubory, kde provedl 17 přidání a 11 odebrání
  1. 1 8
      exec/logsys.c
  2. 16 3
      exec/logsys.h

+ 1 - 8
exec/logsys.c

@@ -185,9 +185,6 @@ unsigned int logsys_config_subsys_set (
 			logsys_loggers[i].tags = tags;
 			logsys_loggers[i].priority = priority;
 
-			if (priority > logsys_loggers[i].priority) {
-				logsys_loggers[i].priority = priority;
-			}
 			break;
 		}
 	}
@@ -228,7 +225,7 @@ int logsys_config_subsys_get (
 			*tags = logsys_loggers[i].tags;
 			*priority = logsys_loggers[i].priority;
 			pthread_mutex_unlock (&logsys_config_mutex);
-			return (0);
+			return i;
 		}
 	}
 
@@ -483,10 +480,6 @@ void _logsys_config_priority_set (unsigned int id, unsigned int priority)
 
 	logsys_loggers[id].priority = priority;
 
-	if (priority > logsys_loggers[id].priority) {
-		logsys_loggers[id].priority = priority;
-	}
-
 	pthread_mutex_unlock (&logsys_new_log_mutex);
 }
 

+ 16 - 3
exec/logsys.h

@@ -181,16 +181,29 @@ static unsigned int logsys_subsys_id __attribute__((unused)) = -1;	\
 #define LOGSYS_DECLARE_NOSUBSYS(priority)				\
 __attribute__ ((constructor)) static void logsys_nosubsys_init (void)	\
 {									\
-	_logsys_nosubsys_set();						\
+	unsigned int pri, tags;						\
+									\
 	logsys_subsys_id =						\
-		_logsys_subsys_create ("MAIN", (priority));		\
+		logsys_config_subsys_get("MAIN", &tags, &pri);		\
+									\
+	if (logsys_subsys_id == -1) {					\
+		_logsys_nosubsys_set();					\
+		logsys_subsys_id =					\
+			_logsys_subsys_create ("MAIN", (priority));	\
+	}								\
 }
 
 #define LOGSYS_DECLARE_SUBSYS(subsys,priority)				\
 __attribute__ ((constructor)) static void logsys_subsys_init (void)	\
 {									\
+	unsigned int pri, tags;						\
+									\
 	logsys_subsys_id =						\
-		_logsys_subsys_create ((subsys), (priority));		\
+		logsys_config_subsys_get((subsys), &tags, &pri);	\
+									\
+	if (logsys_subsys_id == -1)					\
+		logsys_subsys_id =					\
+			_logsys_subsys_create ((subsys), (priority));	\
 }
 
 #define log_printf(lvl, format, args...) do {				\