(!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
497e981348
commit
86ba735482
|
@ -827,7 +827,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
|
||||||
}
|
}
|
||||||
else if (!xf86NameCmp(s, "sync")) {
|
else if (!xf86NameCmp(s, "sync")) {
|
||||||
LogMessageVerb(X_CONFIG, 1, "Syncing logfile enabled\n");
|
LogMessageVerb(X_CONFIG, 1, "Syncing logfile enabled\n");
|
||||||
LogSetParameter(XLOG_SYNC, TRUE);
|
xorgLogSync = TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogMessageVerb(X_WARNING, 1, "Unknown Log option\n");
|
LogMessageVerb(X_WARNING, 1, "Unknown Log option\n");
|
||||||
|
|
8
os/log.c
8
os/log.c
|
@ -113,7 +113,7 @@ void (*OsVendorVErrorFProc) (const char *, va_list args) = NULL;
|
||||||
#define DEFAULT_LOG_FILE_VERBOSITY 3
|
#define DEFAULT_LOG_FILE_VERBOSITY 3
|
||||||
|
|
||||||
static int logFileFd = -1;
|
static int logFileFd = -1;
|
||||||
static Bool logSync = FALSE;
|
Bool xorgLogSync = FALSE;
|
||||||
int xorgLogVerbosity = DEFAULT_LOG_VERBOSITY;
|
int xorgLogVerbosity = DEFAULT_LOG_VERBOSITY;
|
||||||
int xorgLogFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY;
|
int xorgLogFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ LogSetParameter(LogParameter param, int value)
|
||||||
{
|
{
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case XLOG_SYNC:
|
case XLOG_SYNC:
|
||||||
logSync = value ? TRUE : FALSE;
|
xorgLogSync = value ? TRUE : FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case XLOG_VERBOSITY:
|
case XLOG_VERBOSITY:
|
||||||
xorgLogVerbosity = value;
|
xorgLogVerbosity = value;
|
||||||
|
@ -574,7 +574,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
|
||||||
if (verb < 0 || xorgLogFileVerbosity >= verb) {
|
if (verb < 0 || xorgLogFileVerbosity >= verb) {
|
||||||
if (inSignalContext && logFileFd >= 0) {
|
if (inSignalContext && logFileFd >= 0) {
|
||||||
ret = write(logFileFd, buf, len);
|
ret = write(logFileFd, buf, len);
|
||||||
if (logSync)
|
if (xorgLogSync)
|
||||||
doLogSync();
|
doLogSync();
|
||||||
}
|
}
|
||||||
else if (!inSignalContext && logFileFd != -1) {
|
else if (!inSignalContext && logFileFd != -1) {
|
||||||
|
@ -589,7 +589,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
|
||||||
}
|
}
|
||||||
newline = end_line;
|
newline = end_line;
|
||||||
write(logFileFd, buf, len);
|
write(logFileFd, buf, len);
|
||||||
if (logSync)
|
if (xorgLogSync)
|
||||||
doLogSync();
|
doLogSync();
|
||||||
}
|
}
|
||||||
else if (!inSignalContext && needBuffer) {
|
else if (!inSignalContext && needBuffer) {
|
||||||
|
|
|
@ -84,4 +84,11 @@ extern int xorgLogVerbosity;
|
||||||
*/
|
*/
|
||||||
extern int xorgLogFileVerbosity;
|
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 */
|
#endif /* __XORG_OS_LOGGING_H */
|
||||||
|
|
Loading…
Reference in New Issue