(!1688) os: directly set log file sync flag, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a simple bool variable. Setting the sync flag really is nothing more than just writing some value into a variable, so it's trivial to just to do that, instead of having an unncessarily complex "universal setter" for that. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									b1d99b385a
								
							
						
					
					
						commit
						41f214b6fb
					
				|  | @ -828,7 +828,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) | |||
|             } | ||||
|             else if (!xf86NameCmp(s, "sync")) { | ||||
|                 LogMessageVerb(X_CONFIG, 1, "Syncing logfile enabled\n"); | ||||
|                 LogSetParameter(XLOG_SYNC, TRUE); | ||||
|                 xorgLogSync = TRUE; | ||||
|             } | ||||
|             else { | ||||
|                 LogMessageVerb(X_WARNING, 1, "Unknown Log option\n"); | ||||
|  |  | |||
							
								
								
									
										8
									
								
								os/log.c
								
								
								
								
							
							
						
						
									
										8
									
								
								os/log.c
								
								
								
								
							|  | @ -112,7 +112,7 @@ OR PERFORMANCE OF THIS SOFTWARE. | |||
| #define DEFAULT_LOG_FILE_VERBOSITY	3 | ||||
| 
 | ||||
| static int logFileFd = -1; | ||||
| static Bool logSync = FALSE; | ||||
| Bool xorgLogSync = FALSE; | ||||
| int xorgLogVerbosity = DEFAULT_LOG_VERBOSITY; | ||||
| int xorgLogFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY; | ||||
| 
 | ||||
|  | @ -315,7 +315,7 @@ LogSetParameter(LogParameter param, int value) | |||
| { | ||||
|     switch (param) { | ||||
|     case XLOG_SYNC: | ||||
|         logSync = value ? TRUE : FALSE; | ||||
|         xorgLogSync = value ? TRUE : FALSE; | ||||
|         return TRUE; | ||||
|     case XLOG_VERBOSITY: | ||||
|         xorgLogVerbosity = value; | ||||
|  | @ -561,7 +561,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) | |||
|     if (verb < 0 || xorgLogFileVerbosity >= verb) { | ||||
|         if (inSignalContext && logFileFd >= 0) { | ||||
|             ret = write(logFileFd, buf, len); | ||||
|             if (logSync) | ||||
|             if (xorgLogSync) | ||||
|                 doLogSync(); | ||||
|         } | ||||
|         else if (!inSignalContext && logFileFd != -1) { | ||||
|  | @ -576,7 +576,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) | |||
|             } | ||||
|             newline = end_line; | ||||
|             write(logFileFd, buf, len); | ||||
|             if (logSync) | ||||
|             if (xorgLogSync) | ||||
|                 doLogSync(); | ||||
|         } | ||||
|         else if (!inSignalContext && needBuffer) { | ||||
|  |  | |||
|  | @ -84,4 +84,11 @@ extern int xorgLogVerbosity; | |||
|  */ | ||||
| extern int xorgLogFileVerbosity; | ||||
| 
 | ||||
| /**
 | ||||
|  * @brief force fsync() on each log write | ||||
|  * | ||||
|  * If set to TRUE, force fsync() on each log write. | ||||
|  */ | ||||
| extern Bool xorgLogSync; | ||||
| 
 | ||||
| #endif /* __XORG_OS_LOGGING_H */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue