os: direct access to logVerbosity

No need for complicated 'generic' setter, just make the variable
itself available to DDX'es.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-10 13:30:20 +01:00 committed by Enrico Weigelt, metux IT consult .
parent 4fa8b1658b
commit 3640a33077
11 changed files with 30 additions and 20 deletions

View File

@ -28,6 +28,7 @@
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "os/cmdline.h" #include "os/cmdline.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "ephyr.h" #include "ephyr.h"
@ -288,10 +289,8 @@ ddxProcessArgument(int argc, char **argv, int i)
} }
else if (!strcmp(argv[i], "-verbosity")) { else if (!strcmp(argv[i], "-verbosity")) {
if (i + 1 < argc && argv[i + 1][0] != '-') { if (i + 1 < argc && argv[i + 1][0] != '-') {
int verbosity = atoi(argv[i + 1]); logVerbosity = atoi(argv[i + 1]);
EPHYR_LOG("set verbosiry to %d\n", logVerbosity);
LogSetParameter(XLOG_VERBOSITY, verbosity);
EPHYR_LOG("set verbosiry to %d\n", verbosity);
return 2; return 2;
} }
else { else {

View File

@ -58,6 +58,7 @@
#include "mi/mi_priv.h" #include "mi/mi_priv.h"
#include "os/cmdline.h" #include "os/cmdline.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "servermd.h" #include "servermd.h"
@ -870,7 +871,7 @@ void
xf86SetVerbosity(int verb) xf86SetVerbosity(int verb)
{ {
xf86Verbose = verb; xf86Verbose = verb;
LogSetParameter(XLOG_VERBOSITY, verb); logVerbosity = verb;
} }
void void

View File

@ -41,6 +41,7 @@
#include "os/client_priv.h" #include "os/client_priv.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/fmt.h" #include "os/fmt.h"
#include "os/log_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "os/xserver_poll.h" #include "os/xserver_poll.h"
@ -134,7 +135,6 @@ static int init_fd = -1;
static int wm_fd = -1; static int wm_fd = -1;
static int listen_fds[5] = { -1, -1, -1, -1, -1 }; static int listen_fds[5] = { -1, -1, -1, -1, -1 };
static int listen_fd_count = 0; static int listen_fd_count = 0;
static int verbosity = 0;
static void static void
xwl_show_version(void) xwl_show_version(void)
@ -237,12 +237,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
val = strtol(argv[i], &end, 0); val = strtol(argv[i], &end, 0);
if (*end == '\0') { if (*end == '\0') {
verbosity = val; logVerbosity = val;
LogSetParameter(XLOG_VERBOSITY, verbosity);
return 2; return 2;
} }
} }
LogSetParameter(XLOG_VERBOSITY, ++verbosity); logVerbosity++;
return 1; return 1;
} }
else if (strcmp(argv[i], "-version") == 0) { else if (strcmp(argv[i], "-version") == 0) {

View File

@ -37,6 +37,7 @@ from The Open Group.
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screenint_priv.h" #include "dix/screenint_priv.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "winmsg.h" #include "winmsg.h"
@ -643,8 +644,8 @@ OsVendorInit(void)
g_pszLogFile = LogInit(g_pszLogFile, ".old"); g_pszLogFile = LogInit(g_pszLogFile, ".old");
} }
LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose); logVerbosity = 2;
LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose); LogSetParameter(XLOG_FILE_VERBOSITY, logVerbosity);
/* Log the version information */ /* Log the version information */
if (serverGeneration == 1) if (serverGeneration == 1)

View File

@ -78,6 +78,8 @@
#include <xwin-config.h> #include <xwin-config.h>
#endif #endif
#include "os/log_priv.h"
#include "glwindows.h" #include "glwindows.h"
#include <glx/glxserver.h> #include <glx/glxserver.h>
#include <glx/glxutil.h> #include <glx/glxutil.h>
@ -297,7 +299,7 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects)
LogMessage(X_INFO, "ignored pixel formats: %d not OpenGL, %d unknown pixel type, %d unaccelerated\n", LogMessage(X_INFO, "ignored pixel formats: %d not OpenGL, %d unknown pixel type, %d unaccelerated\n",
rejects->notOpenGL, rejects->unknownPixelType, rejects->unaccelerated); rejects->notOpenGL, rejects->unknownPixelType, rejects->unaccelerated);
if (g_iLogVerbose < 3) if (logVerbosity < 3)
return; return;
ErrorF ErrorF
@ -572,7 +574,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
if (!wgl_extensions) if (!wgl_extensions)
wgl_extensions = ""; wgl_extensions = "";
if (g_iLogVerbose >= 3) { if (logVerbosity >= 3) {
glxLogExtensions("GL_EXTENSIONS: ", gl_extensions); glxLogExtensions("GL_EXTENSIONS: ", gl_extensions);
glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions); glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
} }

View File

@ -69,7 +69,6 @@ const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
const char *g_pszLogFile = "XWin.log"; const char *g_pszLogFile = "XWin.log";
Bool g_fLogFileChanged = FALSE; Bool g_fLogFileChanged = FALSE;
#endif #endif
int g_iLogVerbose = 2;
Bool g_fLogInited = FALSE; Bool g_fLogInited = FALSE;
char *g_pszCommandLine = NULL; char *g_pszCommandLine = NULL;
Bool g_fSilentFatalError = FALSE; Bool g_fSilentFatalError = FALSE;

View File

@ -45,7 +45,6 @@ extern const char *g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT #ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged; extern Bool g_fLogFileChanged;
#endif #endif
extern int g_iLogVerbose;
extern Bool g_fLogInited; extern Bool g_fLogInited;
extern Bool g_fAuthEnabled; extern Bool g_fAuthEnabled;

View File

@ -36,8 +36,9 @@ from The Open Group.
#endif #endif
#include "os/cmdline.h" #include "os/cmdline.h"
#include "os/osdep.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include <../xfree86/common/xorgVersion.h> #include <../xfree86/common/xorgVersion.h>
#include "win.h" #include "win.h"
@ -996,7 +997,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
*/ */
if (IS_OPTION("-logverbose")) { if (IS_OPTION("-logverbose")) {
CHECK_ARGS(1); CHECK_ARGS(1);
g_iLogVerbose = atoi(argv[++i]); logVerbosity = atoi(argv[++i]);
return 2; return 2;
} }

View File

@ -111,9 +111,9 @@ OR PERFORMANCE OF THIS SOFTWARE.
#define DEFAULT_LOG_FILE_VERBOSITY 3 #define DEFAULT_LOG_FILE_VERBOSITY 3
Bool logSync = FALSE; Bool logSync = FALSE;
int logVerbosity = DEFAULT_LOG_VERBOSITY;
static int logFileFd = -1; static int logFileFd = -1;
static int logVerbosity = DEFAULT_LOG_VERBOSITY;
static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY; static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY;
/* Buffer to information logged before the log file is opened. */ /* Buffer to information logged before the log file is opened. */

View File

@ -15,4 +15,12 @@
*/ */
extern Bool logSync; extern Bool logSync;
/**
* @brief console log verbosity (stderr)
*
* The verbosity level of logging to console. All messages with verbosity
* level below this one will be written to stderr
*/
extern int logVerbosity;
#endif /* _XSERVER_LOG_PRIV_H */ #endif /* _XSERVER_LOG_PRIV_H */

View File

@ -30,6 +30,7 @@
#include <unistd.h> #include <unistd.h>
#include "os/fmt.h" #include "os/fmt.h"
#include "os/log_priv.h"
#include "assert.h" #include "assert.h"
#include "misc.h" #include "misc.h"
@ -149,7 +150,7 @@ number_formatting(void)
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */ -0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
} ; } ;
LogSetParameter(XLOG_VERBOSITY, -1); logVerbosity = -1;
for (i = 0; i < ARRAY_SIZE(unsigned_tests); i++) for (i = 0; i < ARRAY_SIZE(unsigned_tests); i++)
assert(check_number_format_test(unsigned_tests[i])); assert(check_number_format_test(unsigned_tests[i]));
@ -181,7 +182,7 @@ static void logging_format(void)
uintptr_t ptr; uintptr_t ptr;
char *fname = NULL; char *fname = NULL;
LogSetParameter(XLOG_VERBOSITY, -1); logVerbosity = -1;
/* set up buf to contain ".....end" */ /* set up buf to contain ".....end" */
memset(buf, '.', sizeof(buf)); memset(buf, '.', sizeof(buf));