From 8f173a92f8f4d81fd033e86b50583f513b31c429 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 10 Sep 2024 12:35:30 +0200 Subject: [PATCH] os: log: drop now meaningless XLOG_FLUSH option Since we're not indirectly writing via FILE anymore, this option has become meaningless: it meant flushing out our in-process buffer to the kernel, but we're now doing direct write() calls anyways. xf86 still accepts the "flush" config file flag for backwards compatibility, but it hasn't any practical meaning anymore. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/common/xf86Config.c | 4 +--- hw/xwin/InitOutput.c | 1 - include/os.h | 1 - os/log.c | 12 +++--------- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index ba5ab72d5..702ec6eaa 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -827,12 +827,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) { if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) { if (!xf86NameCmp(s, "flush")) { - LogMessageVerb(X_CONFIG, 1, "Flushing logfile enabled\n"); - LogSetParameter(XLOG_FLUSH, TRUE); + LogMessageVerb(X_CONFIG, 1, "flush log flag is noop\n"); } else if (!xf86NameCmp(s, "sync")) { LogMessageVerb(X_CONFIG, 1, "Syncing logfile enabled\n"); - LogSetParameter(XLOG_FLUSH, TRUE); LogSetParameter(XLOG_SYNC, TRUE); } else { diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index a8a8cac24..74775e1e6 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -643,7 +643,6 @@ OsVendorInit(void) g_pszLogFile = LogInit(g_pszLogFile, ".old"); } - LogSetParameter(XLOG_FLUSH, 1); LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose); LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose); diff --git a/include/os.h b/include/os.h index e26664d9a..2a051891c 100644 --- a/include/os.h +++ b/include/os.h @@ -324,7 +324,6 @@ timingsafe_memcmp(const void *b1, const void *b2, size_t len); /* Logging. */ typedef enum _LogParameter { - XLOG_FLUSH, XLOG_SYNC, XLOG_VERBOSITY, XLOG_FILE_VERBOSITY diff --git a/os/log.c b/os/log.c index 00aa5d5a2..5484a0ee0 100644 --- a/os/log.c +++ b/os/log.c @@ -110,7 +110,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #define DEFAULT_LOG_FILE_VERBOSITY 3 static int logFileFd = -1; -static Bool logFlush = FALSE; static Bool logSync = FALSE; static int logVerbosity = DEFAULT_LOG_VERBOSITY; static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY; @@ -309,9 +308,6 @@ Bool LogSetParameter(LogParameter param, int value) { switch (param) { - case XLOG_FLUSH: - logFlush = value ? TRUE : FALSE; - return TRUE; case XLOG_SYNC: logSync = value ? TRUE : FALSE; return TRUE; @@ -559,7 +555,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) if (inSignalContext && logFileFd >= 0) { ret = write(logFileFd, buf, len); #ifndef WIN32 - if (logFlush && logSync) + if (logSync) fsync(logFileFd); #endif } @@ -575,12 +571,10 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) } newline = end_line; write(logFileFd, buf, len); - if (logFlush) { #ifndef WIN32 - if (logSync) - fsync(logFileFd); + if (logSync) + fsync(logFileFd); #endif - } } else if (!inSignalContext && needBuffer) { if (len > bufferUnused) {