Compare commits

...

27 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult d1ba6fd921 (!1678) os: move AbortServer() to os/utils.c
This function doesn't much to do with logging, except for being
called once by FatalError(). It's better placed in utils.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 0aea7f71e5 (!1677) os: drop obsolete LogHdrMessage()
This function isn't used anywhere, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 1118521fda (!1679) xfre86: drop xf86Msg() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 685f30ec01 (!1679) xfree86: drop xf86MsgVerb() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 8eb7031099 (!1680) os: log: drop unncessary HAVE_DIX_CONFIG
It's always defined and dix-config.h is always present, so need for the
extra check.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 00ad63c7b2 (!1680) os: log: drop unnecessary ifdef's
The #ifdef's for log prefix defines aren't needed, so drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult a788acecce (!1681) xfree86: common: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 0742083904 (!1681) xfree86: fbdevhw: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 271e5e3cf0 (!1681) xfree86: os-support: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 1d85d93cf8 (!1681) xfree86: i2c: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 908f416606 (!1681) glx: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult d2d54c0d66 (!1681) xfree86: use LogMessageVerb() instead of xf86MsgVerb()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 939f357e78 (!1683) os: replace LogVWrite() by LogVMessageVerb()
It's just a wrapper around LogVMessageVerb() and no external module
using it, so can easily be optimized-away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:42 +02:00
Enrico Weigelt, metux IT consult 9669879a45 (!1683) os: replace LogWrite() by LogMessageVerb()
It's nothing but a wrapper, doing the same as LogMessageVerb(X_NONE, ...),
and no external module / driver needs it, so can be easily optimized away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 20affc4366 (NOMERGE) ci: always build with drivers 2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 04f839243f (!1687) xfree86: unexport xf86SetVerbosity() and xf86SetLogVerbosity()
These aren't used by any modules/drivers, so no need to keep them exported.
Also drop the return value, which isn't used by any caller.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 04077fad1b (!1688) os: log: add syslog support
Add support for logging to syslog.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 5728b2a458 (!1688) os: helper for parsing an counting-flag or value-flag option
Parses an option that may either be used for setting an integer value or
given one or multiple times (without argument) to increase an value

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 70d9a43ad4 (!1688) meson.build: move writing conf_data into tail of main meson file
This allows us to do further probing in the included meson files:
Individual subdirectories (eg. DDXes, extensions, OS layer, ...)
can now probe things that are only relevant to them - no need to fill
the already too fat includes/meson.build with even more things.

Preparation for upcoming commits that'll make us of that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 107a24c537 (!1688) os: log: drop obsolete LogSetParameter()
The variables that can be set via this function are all now being
accessed directly. Not callers left, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 6b0fc3eb40 (!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>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult ba8c048b3a (!1688) os: directly set log file verbosity level, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level 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>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult dff6fb4246 (!1688) os: directly set console verbosity level, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level 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>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 16bb113472 (!1688) os: unexport internal logging functions
Lots of logging functions, especially init and teardown aren't called
by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult 80a0297638 (!1682) os: log: consolidate OS specific fsync() call into helper
Instead of having lots of #ifdef's, consolidating the conditionally
compiled fsync() call into a tiny inline helper.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult c5f1390f8e (!1682) 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 <info@metux.net>
2024-09-13 13:37:41 +02:00
Enrico Weigelt, metux IT consult b94a9ca1d4 (!1682) os: log via fd instead of FILE
Instead of maintaining both the logfile fd, as well as ANSI FILE pointer,
simplify it to just a fd.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-13 13:37:41 +02:00
91 changed files with 826 additions and 751 deletions

View File

@ -277,13 +277,6 @@ xf86-driver-build-test:
GIT_DEPTH: 1
MESON_ARGS: -Dprefix=/usr/
MESON_EXTRA_ARGS: -Dxwayland=false -Dxnest=false -Dxvfb=false -Dxquartz=false -Ddocs=false
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*dix_paths
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*xorg_paths
#
# Verify that commit messages are as expected

View File

@ -47,6 +47,7 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "misc.h"

View File

@ -38,6 +38,9 @@ from Kaleb S. KEITHLEY
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xf86vmproto.h>
#include "os/log_priv.h"
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"

View File

@ -96,6 +96,7 @@ SOFTWARE.
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include "inputstr.h"
#include "windowstr.h"

View File

@ -30,6 +30,8 @@
#include <dbus/dbus.h>
#include <sys/select.h>
#include "os/log_priv.h"
#include "dix.h"
#include "os.h"

View File

@ -61,6 +61,7 @@ SOFTWARE.
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/ptrveloc_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "misc.h"

View File

@ -62,6 +62,7 @@ Equipment Corporation.
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "os/auth.h"
#include "os/log_priv.h"
#include "scrnintstr.h"
#include "resource.h"

View File

@ -119,6 +119,7 @@ Equipment Corporation.
#include "dix/input_priv.h"
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "misc.h"

View File

@ -32,6 +32,7 @@
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include "inputstr.h"
#include "scrnintstr.h"

View File

@ -196,7 +196,7 @@ GLXClientCallback(CallbackListPtr *list, void *closure, void *data)
static void
GLXReset(ExtensionEntry *extEntry)
{
// xf86Msg(X_INFO, "GLX: GLXReset\n");
// LogMessageVerb(X_INFO, 1, "GLX: GLXReset\n");
GlxVendorExtensionReset(extEntry);
GlxDispatchReset();

View File

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

View File

@ -254,12 +254,6 @@ extern _X_EXPORT void
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86Msg(MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
xf86ErrorFVerb(int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
@ -406,4 +400,8 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
extern _X_EXPORT void
xf86UpdateDesktopDimensions(void);
/* only for backwards (source) compatibility */
#define xf86MsgVerb LogMessageVerb
#define xf86Msg(type, ...) LogMessageVerb(type, 1, __VA_ARGS__)
#endif /* _XF86_H */

View File

@ -160,7 +160,7 @@ xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver)
md->nmatches++;
}
else {
xf86Msg(X_WARNING, "Too many drivers registered, can't add %s\n", driver);
LogMessageVerb(X_WARNING, 1, "Too many drivers registered, can't add %s\n", driver);
}
}
@ -178,7 +178,7 @@ xf86AutoConfig(void)
ret = CONFIG_OK; /* OK so far */
}
else {
xf86Msg(X_ERROR, "Couldn't allocate Config record.\n");
LogMessageVerb(X_ERROR, 1, "Couldn't allocate Config record.\n");
return FALSE;
}
@ -205,14 +205,14 @@ xf86AutoConfig(void)
free(md.matches[i]);
}
xf86MsgVerb(X_DEFAULT, 0,
LogMessageVerb(X_DEFAULT, 0,
"Using default built-in configuration (%d lines)\n",
builtinLines);
xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
LogMessageVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
for (cp = builtinConfig; *cp; cp++)
xf86ErrorFVerb(3, "\t%s", *cp);
xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
LogMessageVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
xf86initConfigFiles();
xf86setBuiltinConfig(builtinConfig);
@ -220,7 +220,7 @@ xf86AutoConfig(void)
FreeConfig();
if (ret != CONFIG_OK)
xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n");
LogMessageVerb(X_ERROR, 1, "Error parsing the built-in default configuration.\n");
return ret == CONFIG_OK;
}
@ -253,12 +253,12 @@ listPossibleVideoDrivers(XF86MatchedDrivers *md)
}
if (iret < 0) {
xf86Msg(X_WARNING,
"could not get frame buffer identifier from %s\n",
xf86SolarisFbDev);
LogMessageVerb(X_WARNING, 1,
"could not get frame buffer identifier from %s\n",
xf86SolarisFbDev);
}
else {
xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
LogMessageVerb(X_PROBED, 1, "console driver: %s\n", visid.name);
/* Special case from before the general case was set */
if (strcmp(visid.name, "NVDAnvda") == 0) {
@ -392,7 +392,7 @@ autoConfigDevice(GDevPtr preconf_device)
/* get all possible video drivers and count them */
listPossibleVideoDrivers(&md);
for (i = 0; i < md.nmatches; i++) {
xf86Msg(X_DEFAULT, "Matched %s as autoconfigured driver %d\n",
LogMessageVerb(X_DEFAULT, 1, "Matched %s as autoconfigured driver %d\n",
md.matches[i], i);
}
@ -441,7 +441,7 @@ autoConfigDevice(GDevPtr preconf_device)
}
}
xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
LogMessageVerb(X_DEFAULT, 1, "Assigned the driver to the xf86ConfigLayout\n");
return ptr;
}

View File

@ -96,7 +96,7 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
}
#endif
if (!foundScreen && (drv->Probe != NULL)) {
xf86Msg(X_WARNING, "Falling back to old probe method for %s\n",
LogMessageVerb(X_WARNING, 1, "Falling back to old probe method for %s\n",
drv->driverName);
foundScreen = (*drv->Probe) (drv, (detect_only) ? PROBE_DETECT
: PROBE_DEFAULT);
@ -181,7 +181,7 @@ xf86BusConfig(void)
/* If nothing was detected, return now */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR, "No devices detected.\n");
LogMessageVerb(X_ERROR, 1, "No devices detected.\n");
return FALSE;
}
@ -205,9 +205,9 @@ xf86BusConfig(void)
xf86Screens[i]->confScreen = layout->screen;
else {
/* No match found */
xf86Msg(X_ERROR,
"Screen %d deleted because of no matching config section.\n",
i);
LogMessageVerb(X_ERROR, 1,
"Screen %d deleted because of no matching config section.\n",
i);
xf86DeleteScreen(xf86Screens[i--]);
}
}
@ -221,8 +221,8 @@ xf86BusConfig(void)
/* If no screens left, return now. */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR,
"Device(s) detected, but none match those in the config file.\n");
LogMessageVerb(X_ERROR, 1,
"Device(s) detected, but none match those in the config file.\n");
return FALSE;
}

View File

@ -50,6 +50,7 @@
#include <sys/types.h>
#include <grp.h>
#include "os/log_priv.h"
#include "os/osdep.h"
#include "xf86.h"
@ -195,8 +196,8 @@ xf86ValidateFontPath(char *path)
if (!S_ISDIR(stat_buf.st_mode))
flag = -1;
if (flag != 0) {
xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n",
dir_elem);
LogMessageVerb(X_WARNING, 1, "The directory \"%s\" does not exist.\n",
dir_elem);
xf86ErrorF("\tEntry deleted from font path.\n");
free(dir_elem);
continue;
@ -209,9 +210,9 @@ xf86ValidateFontPath(char *path)
flag = -1;
free(p1);
if (flag != 0) {
xf86Msg(X_WARNING,
"`fonts.dir' not found (or not valid) in \"%s\".\n",
dir_elem);
LogMessageVerb(X_WARNING, 1,
"`fonts.dir' not found (or not valid) in \"%s\".\n",
dir_elem);
xf86ErrorF("\tEntry deleted from font path.\n");
xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
free(dir_elem);
@ -269,7 +270,7 @@ xf86ModulelistFromConfig(void ***optlist)
* ModulePath
*/
if (xf86configptr == NULL) {
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
LogMessageVerb(X_ERROR, 1, "Cannot access global config data structure\n");
return NULL;
}
@ -279,9 +280,9 @@ xf86ModulelistFromConfig(void ***optlist)
*/
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
xf86Msg(X_WARNING,
"\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n",
modp->load_name);
LogMessageVerb(X_WARNING, 1,
"\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n",
modp->load_name);
modp = (XF86LoadPtr) modp->list.next;
}
/*
@ -292,18 +293,18 @@ xf86ModulelistFromConfig(void ***optlist)
*/
for (i = 0; ModuleDefaults[i].name != NULL; i++) {
if (ModuleDefaults[i].toLoad == FALSE) {
xf86Msg(X_WARNING,
"\"%s\" is not to be loaded by default. Skipping.\n",
ModuleDefaults[i].name);
LogMessageVerb(X_WARNING, 1,
"\"%s\" is not to be loaded by default. Skipping.\n",
ModuleDefaults[i].name);
continue;
}
found = FALSE;
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
xf86Msg(X_INFO,
"\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n",
ModuleDefaults[i].name);
LogMessageVerb(X_INFO, 1,
"\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n",
ModuleDefaults[i].name);
found = TRUE;
break;
}
@ -313,9 +314,9 @@ xf86ModulelistFromConfig(void ***optlist)
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
xf86Msg(X_INFO,
"\"%s\" will be loaded even though the default is to disable it.\n",
ModuleDefaults[i].name);
LogMessageVerb(X_INFO, 1,
"\"%s\" will be loaded even though the default is to disable it.\n",
ModuleDefaults[i].name);
found = TRUE;
break;
}
@ -328,8 +329,8 @@ xf86ModulelistFromConfig(void ***optlist)
xf86addNewLoadDirective(ptr, ModuleDefaults[i].name,
XF86_LOAD_MODULE,
ModuleDefaults[i].load_opt);
xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n",
ModuleDefaults[i].name);
LogMessageVerb(X_INFO, 1, "\"%s\" will be loaded by default.\n",
ModuleDefaults[i].name);
}
}
}
@ -401,7 +402,7 @@ xf86DriverlistFromConfig(void)
* ModulePath
*/
if (xf86configptr == NULL) {
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
LogMessageVerb(X_ERROR, 1, "Cannot access global config data structure\n");
return NULL;
}
@ -478,7 +479,7 @@ xf86InputDriverlistFromConfig(void)
* ModulePath
*/
if (xf86configptr == NULL) {
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
LogMessageVerb(X_ERROR, 1, "Cannot access global config data structure\n");
return NULL;
}
@ -582,7 +583,7 @@ configFiles(XF86ConfFilesPtr fileconf)
/* copy last entry */
*(temp_path++) = '\t';
strcpy(temp_path, start);
xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
LogMessageVerb(pathFrom, 1, "FontPath set to:\n%s\n", log_buf);
free(log_buf);
/* ModulePath */
@ -594,12 +595,12 @@ configFiles(XF86ConfFilesPtr fileconf)
}
}
xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
LogMessageVerb(xf86ModPathFrom, 1, "ModulePath set to \"%s\"\n", xf86ModulePath);
if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
XkbBaseDirectory = fileconf->file_xkbdir;
xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
XkbBaseDirectory);
LogMessageVerb(X_CONFIG, 1, "XKB base directory set to \"%s\"\n",
XkbBaseDirectory);
}
#if 0
/* LogFile */
@ -749,12 +750,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
if (xf86Info.ignoreABI) {
xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
LogMessageVerb(X_CONFIG, 1, "Ignoring ABI Version\n");
}
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &AllowByteSwappedClients);
if (AllowByteSwappedClients) {
xf86Msg(X_CONFIG, "Allowing byte-swapped clients\n");
LogMessageVerb(X_CONFIG, 1, "Allowing byte-swapped clients\n");
}
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
@ -765,8 +766,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
else {
from = X_DEFAULT;
}
xf86Msg(from, "%sutomatically adding devices\n",
xf86Info.autoAddDevices ? "A" : "Not a");
LogMessageVerb(from, 1, "%sutomatically adding devices\n",
xf86Info.autoAddDevices ? "A" : "Not a");
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) {
xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES,
@ -776,8 +777,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
else {
from = X_DEFAULT;
}
xf86Msg(from, "%sutomatically enabling devices\n",
xf86Info.autoEnableDevices ? "A" : "Not a");
LogMessageVerb(from, 1, "%sutomatically enabling devices\n",
xf86Info.autoEnableDevices ? "A" : "Not a");
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_GPU)) {
xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_GPU,
@ -787,8 +788,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
else {
from = X_DEFAULT;
}
xf86Msg(from, "%sutomatically adding GPU devices\n",
xf86Info.autoAddGPU ? "A" : "Not a");
LogMessageVerb(from, 1, "%sutomatically adding GPU devices\n",
xf86Info.autoAddGPU ? "A" : "Not a");
if (xf86AutoBindGPUDisabled) {
xf86Info.autoBindGPU = FALSE;
@ -802,8 +803,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
else {
from = X_DEFAULT;
}
xf86Msg(from, "%sutomatically binding GPU devices\n",
xf86Info.autoBindGPU ? "A" : "Not a");
LogMessageVerb(from, 1, "%sutomatically binding GPU devices\n",
xf86Info.autoBindGPU ? "A" : "Not a");
/*
* Set things up based on the config file information. Some of these
@ -826,16 +827,14 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
{
if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
if (!xf86NameCmp(s, "flush")) {
xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
LogSetParameter(XLOG_FLUSH, TRUE);
LogMessageVerb(X_CONFIG, 1, "flush log flag is noop\n");
}
else if (!xf86NameCmp(s, "sync")) {
xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
LogSetParameter(XLOG_FLUSH, TRUE);
LogSetParameter(XLOG_SYNC, TRUE);
LogMessageVerb(X_CONFIG, 1, "Syncing logfile enabled\n");
xorgLogSync = TRUE;
}
else {
xf86Msg(X_WARNING, "Unknown Log option\n");
LogMessageVerb(X_WARNING, 1, "Unknown Log option\n");
}
}
}
@ -845,9 +844,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
int policy = PictureParseCmapPolicy(s);
if (policy == PictureCmapPolicyInvalid)
xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
LogMessageVerb(X_WARNING, 1, "Unknown colormap policy \"%s\"\n", s);
else {
xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
LogMessageVerb(X_CONFIG, 1, "Render colormap policy set to %s\n", s);
PictureCmapPolicy = policy;
}
}
@ -867,7 +866,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.glxVisuals = XF86_GlxVisualsAll;
}
else {
xf86Msg(X_WARNING, "Unknown GlxVisuals option\n");
LogMessageVerb(X_WARNING, 1, "Unknown GlxVisuals option\n");
}
}
@ -948,7 +947,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
from = X_CONFIG;
}
if (!noPanoramiXExtension)
xf86Msg(from, "Xinerama: enabled\n");
LogMessageVerb(from, 1, "Xinerama: enabled\n");
#endif
#ifdef DRI2
@ -972,7 +971,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
LimitClients = i;
}
}
xf86Msg(from, "Max clients allowed: %i, resource mask: 0x%x\n",
LogMessageVerb(from, 1, "Max clients allowed: %i, resource mask: 0x%x\n",
LimitClients, RESOURCE_ID_MASK);
}
@ -1081,7 +1080,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
confInput = xf86findInput(xf86PointerName,
xf86configptr->conf_input_lst);
if (!confInput) {
xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
LogMessageVerb(X_ERROR, 1, "No InputDevice section called \"%s\"\n",
xf86PointerName);
return FALSE;
}
@ -1168,7 +1167,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (!foundPointer && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
LogMessageVerb(X_ERROR, 1, "Cannot locate a core pointer device.\n");
xf86DeleteInput(Pointer, 0);
return FALSE;
}
@ -1180,7 +1179,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
confInput = xf86findInput(xf86KeyboardName,
xf86configptr->conf_input_lst);
if (!confInput) {
xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
LogMessageVerb(X_ERROR, 1, "No InputDevice section called \"%s\"\n",
xf86KeyboardName);
return FALSE;
}
@ -1264,27 +1263,27 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (!foundKeyboard && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
LogMessageVerb(X_ERROR, 1, "Cannot locate a core keyboard device.\n");
xf86DeleteInput(Keyboard, 0);
return FALSE;
}
if (pointerMsg) {
if (implicitLayout)
xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
LogMessageVerb(X_DEFAULT, 1, "No Layout section. Using the %s.\n",
pointerMsg);
else
xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
LogMessageVerb(X_DEFAULT, 1, "The core pointer device wasn't specified "
"explicitly in the layout.\n"
"\tUsing the %s.\n", pointerMsg);
}
if (keyboardMsg) {
if (implicitLayout)
xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
LogMessageVerb(X_DEFAULT, 1, "No Layout section. Using the %s.\n",
keyboardMsg);
else
xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
LogMessageVerb(X_DEFAULT, 1, "The core keyboard device wasn't specified "
"explicitly in the layout.\n"
"\tUsing the %s.\n", keyboardMsg);
}
@ -1300,15 +1299,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
#else
config_backend = "wscons";
#endif
xf86Msg(X_INFO, "The server relies on %s to provide the list of "
"input devices.\n\tIf no devices become available, "
"reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend);
LogMessageVerb(X_INFO, 1, "The server relies on %s to provide the list of "
"input devices.\n\tIf no devices become available, "
"reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend);
#else
xf86Msg(X_WARNING, "Hotplugging requested but the server was "
"compiled without a config backend. "
"No input devices were configured, the server "
"will start without any input devices.\n");
LogMessageVerb(X_WARNING, 1, "Hotplugging requested but the server was "
"compiled without a config backend. "
"No input devices were configured, the server "
"will start without any input devices.\n");
#endif
}
@ -1405,13 +1404,13 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
}
if (xf86LayoutName != NULL) {
if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
xf86LayoutName);
LogMessageVerb(X_ERROR, 1, "No ServerLayout section called \"%s\"\n",
xf86LayoutName);
return FALSE;
}
conf_layout = l;
}
xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
LogMessageVerb(from, 1, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
adjp = conf_layout->lay_adjacency_lst;
/*
@ -1531,8 +1530,8 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
}
if (slp[i].where != PosObsolete
&& slp[i].where != PosAbsolute && !slp[i].refscreen) {
xf86Msg(X_ERROR, "Screen %s doesn't exist: deleting placement\n",
slp[i].refname);
LogMessageVerb(X_ERROR, 1, "Screen %s doesn't exist: deleting placement\n",
slp[i].refname);
slp[i].where = PosAbsolute;
slp[i].x = 0;
slp[i].y = 0;
@ -1612,8 +1611,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
from = X_CONFIG;
if (xf86ScreenName != NULL) {
if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
xf86ScreenName);
LogMessageVerb(X_ERROR, 1, "No Screen section called \"%s\"\n",
xf86ScreenName);
return FALSE;
}
conf_screen = s;
@ -1657,12 +1656,12 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
int count = 0;
XF86ConfVideoPortPtr conf_port;
xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
conf_adaptor->va_identifier);
LogMessageVerb(X_CONFIG, 1, "| |-->VideoAdaptor \"%s\"\n",
conf_adaptor->va_identifier);
adaptor->identifier = conf_adaptor->va_identifier;
adaptor->options = conf_adaptor->va_option_lst;
if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
LogMessageVerb(X_CONFIG, 1, "| | Unsupported device type, skipping entry\n");
return FALSE;
}
@ -1703,11 +1702,11 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
memset(&local_conf_screen, 0, sizeof(local_conf_screen));
conf_screen = &local_conf_screen;
conf_screen->scrn_identifier = "Default Screen Section";
xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
LogMessageVerb(X_DEFAULT, 1, "No screen section available. Using defaults.\n");
}
xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
scrnum);
LogMessageVerb(from, 1, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
scrnum);
/*
* now we fill in the elements of the screen
*/
@ -1737,8 +1736,8 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
screenp->device = XNFcallocarray(1, sizeof(GDevRec));
if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device);
xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
"\tUsing the first device section listed.\n", screenp->id);
LogMessageVerb(X_DEFAULT, 1, "No device specified for screen \"%s\".\n"
"\tUsing the first device section listed.\n", screenp->id);
}
if (configDevice(screenp->device, conf_screen->scrn_device, TRUE, FALSE)) {
screenp->device->myScreenSection = screenp;
@ -1845,8 +1844,8 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
if (defaultMonitor) {
xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
"\tUsing a default monitor configuration.\n", screenp->id);
LogMessageVerb(X_DEFAULT, 1, "No monitor specified for screen \"%s\".\n"
"\tUsing a default monitor configuration.\n", screenp->id);
}
return TRUE;
}
@ -1877,7 +1876,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
float badgamma = 0.0;
double maxPixClock;
xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier);
LogMessageVerb(X_CONFIG, 1, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier);
monitorp->id = conf_monitor->mon_identifier;
monitorp->vendor = conf_monitor->mon_vendor;
monitorp->model = conf_monitor->mon_modelname;
@ -2097,14 +2096,14 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool g
if (active) {
if (gpu)
xf86Msg(X_CONFIG, "| |-->GPUDevice \"%s\"\n",
conf_device->dev_identifier);
LogMessageVerb(X_CONFIG, 1, "| |-->GPUDevice \"%s\"\n",
conf_device->dev_identifier);
else
xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
conf_device->dev_identifier);
LogMessageVerb(X_CONFIG, 1, "| |-->Device \"%s\"\n",
conf_device->dev_identifier);
} else
xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
conf_device->dev_identifier);
LogMessageVerb(X_CONFIG, 1, "|-->Inactive Device \"%s\"\n",
conf_device->dev_identifier);
devicep->identifier = conf_device->dev_identifier;
devicep->vendor = conf_device->dev_vendor;
@ -2198,17 +2197,17 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
enable = !enable;
}
else {
xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
LogMessageVerb(X_WARNING, 1, "Ignoring unrecognized value \"%s\"\n", val);
free(n);
continue;
}
if (EnableDisableExtension(name, enable)) {
xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
LogMessageVerb(X_CONFIG, 1, "Extension \"%s\" is %s\n",
name, enable ? "enabled" : "disabled");
}
else {
xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
LogMessageVerb(X_WARNING, 1, "Ignoring unrecognized extension \"%s\"\n",
name);
}
free(n);
@ -2219,7 +2218,7 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
static Bool
configInput(InputInfoPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
{
xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
LogMessageVerb(from, 1, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
inputp->name = conf_input->inp_identifier;
inputp->driver = conf_input->inp_driver;
inputp->options = conf_input->inp_option_lst;
@ -2285,12 +2284,12 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout)
InputInfoPtr *current;
if (!warned) {
xf86Msg(X_WARNING, "Hotplugging is on, devices using "
LogMessageVerb(X_WARNING, 1, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE;
}
xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->name);
LogMessageVerb(X_WARNING, 1, "Disabling %s\n", (*dev)->name);
current = dev;
free(*dev);
@ -2346,27 +2345,27 @@ xf86HandleConfigFile(Bool autoconfig)
dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT);
filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT);
if (filename) {
xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
LogMessageVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
xf86ConfigFile = XNFstrdup(filename);
}
else {
if (xf86ConfigFile)
xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
LogMessageVerb(X_ERROR, 1, "Unable to locate/open config file: \"%s\"\n",
xf86ConfigFile);
}
if (dirname) {
xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
LogMessageVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
dirname);
xf86ConfigDir = XNFstrdup(dirname);
}
else {
if (xf86ConfigDir)
xf86Msg(X_ERROR,
"Unable to locate/open config directory: \"%s\"\n",
xf86ConfigDir);
LogMessageVerb(X_ERROR, 1,
"Unable to locate/open config directory: \"%s\"\n",
xf86ConfigDir);
}
if (sysdirname)
xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
LogMessageVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
sysdirname);
if (!filename && !dirname && !sysdirname)
return CONFIG_NOFILE;
@ -2377,7 +2376,7 @@ xf86HandleConfigFile(Bool autoconfig)
}
if ((xf86configptr = xf86readConfigFile()) == NULL) {
xf86Msg(X_ERROR, "Problem parsing the config file\n");
LogMessageVerb(X_ERROR, 1, "Problem parsing the config file\n");
return CONFIG_PARSE_ERROR;
}
xf86closeConfigFile();
@ -2399,14 +2398,14 @@ xf86HandleConfigFile(Bool autoconfig)
XF86ConfScreenPtr screen;
if (xf86ScreenName == NULL) {
xf86Msg(X_DEFAULT,
"No Layout section. Using the first Screen section.\n");
LogMessageVerb(X_DEFAULT, 1,
"No Layout section. Using the first Screen section.\n");
}
FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen);
if (!configImpliedLayout(&xf86ConfigLayout,
screen,
xf86configptr)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
LogMessageVerb(X_ERROR, 1, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR;
}
implicit_layout = TRUE;
@ -2420,13 +2419,13 @@ xf86HandleConfigFile(Bool autoconfig)
dfltlayout =
xf86SetStrOption(optlist, "defaultserverlayout", NULL);
if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
LogMessageVerb(X_ERROR, 1, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR;
}
}
else {
if (!configLayout(&xf86ConfigLayout, layout, NULL)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
LogMessageVerb(X_ERROR, 1, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR;
}
}
@ -2444,8 +2443,8 @@ xf86HandleConfigFile(Bool autoconfig)
}
if (scanptr) {
if (strncmp(scanptr, "PCI:", 4) != 0) {
xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
"\tIgnoring IsolateDevice option.\n");
LogMessageVerb(X_WARNING, 1, "Bus types other than PCI not yet isolable.\n"
"\tIgnoring IsolateDevice option.\n");
}
else
xf86PciIsolateDevice(scanptr);

View File

@ -68,4 +68,7 @@ ConfigStatus xf86HandleConfigFile(Bool);
Bool xf86AutoConfig(void);
GDevPtr autoConfigDevice(GDevPtr preconf_device);
void xf86SetVerbosity(int verb);
void xf86SetLogVerbosity(int verb);
#endif /* _xf86_config_h */

View File

@ -693,8 +693,8 @@ DoConfigure(void)
home, addslash);
if (xf86writeConfigFile(filename, xf86config) == 0) {
xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
LogMessageVerb(X_ERROR, 1, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
goto bail;
}
@ -799,8 +799,8 @@ DoConfigure(void)
}
if (xf86writeConfigFile(filename, xf86config) == 0) {
xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
LogMessageVerb(X_ERROR, 1, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
goto bail;
}

View File

@ -587,9 +587,9 @@ xf86InitOrigins(void)
if (screen->refscreen != NULL &&
screen->refscreen->screennum >= xf86NumScreens) {
screensLeft &= ~(1 << i);
xf86Msg(X_WARNING,
"Not including screen \"%s\" in origins calculation.\n",
screen->screen->id);
LogMessageVerb(X_WARNING, 1,
"Not including screen \"%s\" in origins calculation.\n",
screen->screen->id);
continue;
}

View File

@ -59,17 +59,17 @@
#include <X11/Xatom.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/keysym.h>
#include "dix/input_priv.h"
#include "dix/dix_priv.h"
#include "os/log_priv.h"
#include "misc.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_os_support.h"
#include "xf86_OSlib.h"
#include <X11/keysym.h>
#ifdef XFreeXDGA
#include "dgaproc.h"
@ -165,7 +165,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
switch (action) {
case ACTION_TERMINATE:
if (!xf86Info.dontZap) {
xf86Msg(X_INFO, "Server zapped. Shutting down.\n");
LogMessageVerb(X_INFO, 1, "Server zapped. Shutting down.\n");
GiveUp(0);
}
break;

View File

@ -43,6 +43,7 @@
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include "mi.h"
#include "os.h"
@ -59,6 +60,7 @@
#include "xf86DDC.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
#include "xf86Config.h"
#include "mivalidate.h"
/* For xf86GetClocks */
@ -636,7 +638,7 @@ void
xf86PrintDepthBpp(ScrnInfoPtr scrp)
{
xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel);
LogMessageVerb(scrp->bitsPerPixelFrom, 1, "framebuffer bpp %d\n", scrp->bitsPerPixel);
}
/*
@ -1093,28 +1095,6 @@ xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
va_end(ap);
}
/* Print non-driver messages with verbose level specified directly */
void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
{
va_list ap;
va_start(ap, format);
LogVMessageVerb(type, verb, format, ap);
va_end(ap);
}
/* Print non-driver messages with verbose level of 1 (default) */
void
xf86Msg(MessageType type, const char *format, ...)
{
va_list ap;
va_start(ap, format);
LogVMessageVerb(type, 1, format, ap);
va_end(ap);
}
/* Just like ErrorF, but with the verbose level checked */
void
xf86ErrorFVerb(int verb, const char *format, ...)
@ -1123,7 +1103,7 @@ xf86ErrorFVerb(int verb, const char *format, ...)
va_start(ap, format);
if (xf86Verbose >= verb || xf86LogVerbose >= verb)
LogVWrite(verb, format, ap);
LogVMessageVerb(X_NONE, verb, format, ap);
va_end(ap);
}
@ -1135,7 +1115,7 @@ xf86ErrorF(const char *format, ...)
va_start(ap, format);
if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
LogVWrite(1, format, ap);
LogVMessageVerb(X_NONE, 1, format, ap);
va_end(ap);
}
@ -1264,7 +1244,7 @@ xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
int len, i;
len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
LogMessageVerb(X_INFO, 1, "%s: %s:", drvname, drvmsg);
for (i = 0; chips[i].name != NULL; i++) {
if (i != 0) {
xf86ErrorF(",");
@ -1717,7 +1697,7 @@ xf86IsUnblank(int mode)
case SCREEN_SAVER_CYCLE:
return FALSE;
default:
xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
LogMessageVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
return TRUE;
}
}

View File

@ -54,6 +54,7 @@
#include "dix/screenint_priv.h"
#include "os/cmdline.h"
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "servermd.h"
@ -307,7 +308,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
t = time(NULL);
ct = ctime(&t);
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
LogMessageVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
xf86LogFile, ct);
}
@ -317,7 +318,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
case CONFIG_OK:
break;
case CONFIG_PARSE_ERROR:
xf86Msg(X_ERROR, "Error parsing the config file\n");
LogMessageVerb(X_ERROR, 1, "Error parsing the config file\n");
return;
case CONFIG_NOFILE:
autoconfig = TRUE;
@ -349,7 +350,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
if (autoconfig) {
if (!xf86AutoConfig()) {
xf86Msg(X_ERROR, "Auto configuration failed\n");
LogMessageVerb(X_ERROR, 1, "Auto configuration failed\n");
return;
}
}
@ -372,7 +373,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
configured_device = xf86ConfigLayout.screens->screen->device;
if ((!configured_device) || (!configured_device->driver)) {
if (!autoConfigDevice(configured_device)) {
xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
LogMessageVerb(X_ERROR, 1, "Automatic driver configuration failed\n");
return;
}
}
@ -402,7 +403,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
*/
if (xf86NumDrivers == 0) {
xf86Msg(X_ERROR, "No drivers available.\n");
LogMessageVerb(X_ERROR, 1, "No drivers available.\n");
return;
}
@ -500,8 +501,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
*/
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR,
"Screen(s) found, but none have a usable configuration.\n");
LogMessageVerb(X_ERROR, 1,
"Screen(s) found, but none have a usable configuration.\n");
return;
}
@ -578,7 +579,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
if (xf86OSPMClose)
xf86OSPMClose();
if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
LogMessageVerb(X_INFO, 3, "APM registered successfully\n");
/* Make sure full I/O access is enabled */
if (xorgHWAccess)
@ -864,24 +865,18 @@ OsVendorFatalError(const char *f, va_list args)
ErrorFSigSafe("\n");
}
int
void
xf86SetVerbosity(int verb)
{
int save = xf86Verbose;
xf86Verbose = verb;
LogSetParameter(XLOG_VERBOSITY, verb);
return save;
xorgLogVerbosity = verb;
}
int
void
xf86SetLogVerbosity(int verb)
{
int save = xf86LogVerbose;
xf86LogVerbose = verb;
LogSetParameter(XLOG_FILE_VERBOSITY, verb);
return save;
xorgLogFileVerbosity = verb;
}
static void

View File

@ -85,6 +85,9 @@
#endif
#include <X11/X.h>
#include "os/log_priv.h"
#include "xf86Modes.h"
#include "xf86Crtc.h"
#include "os.h"

View File

@ -208,7 +208,7 @@ xf86HandlePMEvents(int fd, void *data)
const char *str = NULL;
int verb = eventName(events[i], &str);
xf86MsgVerb(X_INFO, verb, "PM Event received: %s\n", str);
LogMessageVerb(X_INFO, verb, "PM Event received: %s\n", str);
DoApmEvent(events[i], FALSE);
switch (xf86PMConfirmEventToOs(fd, events[i])) {
case PM_WAIT:

View File

@ -151,10 +151,7 @@ xf86CloseLog(enum ExitCode error);
/* xf86Init.c */
extern _X_EXPORT Bool
xf86LoadModules(const char **list, void **optlist);
extern _X_EXPORT int
xf86SetVerbosity(int verb);
extern _X_EXPORT int
xf86SetLogVerbosity(int verb);
extern _X_EXPORT Bool
xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
extern _X_EXPORT Bool

View File

@ -71,8 +71,8 @@ xf86VGAarbiterInit(void)
{
if (pci_device_vgaarb_init() != 0) {
vga_no_arb = 1;
xf86Msg(X_WARNING,
"VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
LogMessageVerb(X_WARNING, 1,
"VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
}
}
@ -167,8 +167,9 @@ xf86VGAarbiterWrapFunctions(void)
if (vga_count < 2 || !xf86Screens)
return FALSE;
xf86Msg(X_INFO, "Found %d VGA devices: arbiter wrapping enabled\n",
vga_count);
LogMessageVerb(X_INFO, 1,
"Found %d VGA devices: arbiter wrapping enabled\n",
vga_count);
for (i = 0; i < xf86NumScreens; i++) {
pScreen = xf86Screens[i]->pScreen;

View File

@ -39,6 +39,9 @@
#endif
#include <X11/X.h>
#include "os/log_priv.h"
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"

View File

@ -109,12 +109,12 @@
#include "xkbsrv.h"
/* Valuator verification macro */
#define XI_VERIFY_VALUATORS(num_valuators) \
if (num_valuators > MAX_VALUATORS) { \
xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
" MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
return; \
}
#define XI_VERIFY_VALUATORS(num_valuators) \
if (num_valuators > MAX_VALUATORS) { \
LogMessageVerb(X_ERROR, 1, "%s: num_valuator %d is greater than MAX_VALUATORS\n", \
__FUNCTION__, num_valuators); \
return; \
}
static int
xf86InputDevicePostInit(DeviceIntPtr dev);
@ -148,8 +148,8 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list,
/* common settings (available via device properties) */
tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0);
if (tempf != 1.0) {
xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n",
devname, tempf);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) constant deceleration by %.1f\n",
devname, tempf);
prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
PropModeReplace, 1, &tempf, FALSE);
@ -157,8 +157,8 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list,
tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0);
if (tempf > 1.0) {
xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n",
devname, tempf);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) adaptive deceleration by %.1f\n",
devname, tempf);
prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
PropModeReplace, 1, &tempf, FALSE);
@ -171,12 +171,11 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list,
prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32,
PropModeReplace, 1, &tempi, FALSE) == Success) {
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname,
tempi);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) acceleration profile %i\n", devname, tempi);
}
else {
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
devname, tempi);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) acceleration profile %i is unknown\n",
devname, tempi);
}
/* set scaling */
@ -204,8 +203,8 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list,
tempf = xf86SetRealOption(list, "VelocityRelDiff", -1);
if (tempf >= 0) {
xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n",
devname, tempf * 100.0);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) max rel. velocity difference: %.1f%%\n",
devname, tempf * 100.0);
s->max_rel_diff = tempf;
}
@ -251,18 +250,18 @@ ApplyAccelerationSettings(DeviceIntPtr dev)
}
if (InitPointerAccelerationScheme(dev, scheme)) {
xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
pInfo->name, schemeStr, scheme);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) selected scheme %s/%i\n",
pInfo->name, schemeStr, scheme);
}
else {
xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
pInfo->name, schemeStr);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) could not init scheme %s\n",
pInfo->name, schemeStr);
scheme = dev->valuator->accelScheme.number;
}
}
else {
xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n",
pInfo->name, scheme);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) keeping acceleration scheme %i\n",
pInfo->name, scheme);
}
free(schemeStr);
@ -291,11 +290,11 @@ ApplyAccelerationSettings(DeviceIntPtr dev)
if (i >= 0)
dev->ptrfeed->ctrl.threshold = i;
xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n",
pInfo->name, ((float) dev->ptrfeed->ctrl.num) /
((float) dev->ptrfeed->ctrl.den));
xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n",
pInfo->name, dev->ptrfeed->ctrl.threshold);
LogMessageVerb(X_CONFIG, 1, "%s: (accel) acceleration factor: %.3f\n",
pInfo->name, ((float) dev->ptrfeed->ctrl.num) /
((float) dev->ptrfeed->ctrl.den));
LogMessageVerb(X_CONFIG, 1, "%s: (accel) acceleration threshold: %i\n",
pInfo->name, dev->ptrfeed->ctrl.threshold);
}
}
@ -318,9 +317,9 @@ ApplyTransformationMatrix(DeviceIntPtr dev)
&matrix[2], &matrix[3], &matrix[4], &matrix[5], &matrix[6],
&matrix[7], &matrix[8]);
if (rc != 9) {
xf86Msg(X_ERROR,
"%s: invalid format for transformation matrix. Ignoring configuration.\n",
pInfo->name);
LogMessageVerb(X_ERROR,1,
"%s: invalid format for transformation matrix. Ignoring configuration.\n",
pInfo->name);
return;
}
@ -347,11 +346,11 @@ ApplyAutoRepeat(DeviceIntPtr dev)
return;
if (sscanf(repeatStr, "%ld %ld", &delay, &rate) != 2) {
xf86Msg(X_ERROR, "\"%s\" is not a valid AutoRepeat value\n", repeatStr);
LogMessageVerb(X_ERROR, 1, "\"%s\" is not a valid AutoRepeat value\n", repeatStr);
return;
}
xf86Msg(X_CONFIG, "AutoRepeat: %ld %ld\n", delay, rate);
LogMessageVerb(X_CONFIG, 1, "AutoRepeat: %ld %ld\n", delay, rate);
xkbi->desc->ctrls->repeat_delay = delay;
xkbi->desc->ctrls->repeat_interval = 1000 / rate;
}
@ -372,11 +371,11 @@ xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr list)
!xf86SetBoolOption(list, "SendCoreEvents", 1) ||
!xf86SetBoolOption(list, "CorePointer", 1) ||
!xf86SetBoolOption(list, "CoreKeyboard", 1)) {
xf86Msg(X_CONFIG, "%s: doesn't report core events\n", pInfo->name);
LogMessageVerb(X_CONFIG, 1, "%s: doesn't report core events\n", pInfo->name);
}
else {
pInfo->flags |= XI86_ALWAYS_CORE;
xf86Msg(X_CONFIG, "%s: always reports core events\n", pInfo->name);
LogMessageVerb(X_CONFIG, 1, "%s: always reports core events\n", pInfo->name);
}
}
@ -398,7 +397,7 @@ xf86ActivateDevice(InputInfoPtr pInfo)
dev = AddInputDevice(serverClient, pInfo->device_control, TRUE);
if (dev == NULL) {
xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n", pInfo->name);
LogMessageVerb(X_ERROR, 1, "Too many input devices. Ignoring %s\n", pInfo->name);
pInfo->dev = NULL;
return NULL;
}
@ -415,9 +414,9 @@ xf86ActivateDevice(InputInfoPtr pInfo)
dev->config_info = xf86SetStrOption(pInfo->options, "config_info", NULL);
if (serverGeneration == 1)
xf86Msg(X_INFO,
"XINPUT: Adding extended input device \"%s\" (type: %s, id %d)\n",
pInfo->name, pInfo->type_name, dev->id);
LogMessageVerb(X_INFO, 1,
"XINPUT: Adding extended input device \"%s\" (type: %s, id %d)\n",
pInfo->name, pInfo->type_name, dev->id);
return dev;
}
@ -724,16 +723,16 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs)
free((void *) idev->driver);
idev->driver = Xstrdup(cl->driver);
if (!idev->driver) {
xf86Msg(X_ERROR, "Failed to allocate memory while merging "
"InputClass configuration");
LogMessageVerb(X_ERROR, 1, "Failed to allocate memory while merging "
"InputClass configuration");
return BadAlloc;
}
classopts = xf86ReplaceStrOption(classopts, "driver", idev->driver);
}
/* Apply options to device with InputClass settings preferred. */
xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n",
idev->name, cl->identifier);
LogMessageVerb(X_CONFIG, 1, "%s: Applying InputClass \"%s\"\n",
idev->name, cl->identifier);
idev->options = xf86optionListMerge(idev->options, classopts);
}
@ -761,8 +760,8 @@ IgnoreInputClass(const InputInfoPtr idev, const InputAttributes * attrs)
}
if (ignore)
xf86Msg(X_CONFIG, "%s: Ignoring device from InputClass \"%s\"\n",
idev->name, ignore_class);
LogMessageVerb(X_CONFIG, 1, "%s: Ignoring device from InputClass \"%s\"\n",
idev->name, ignore_class);
return ignore;
}
@ -914,10 +913,10 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
drv = xf86LoadInputDriver(pInfo->driver);
if (!drv) {
xf86Msg(X_ERROR, "No input driver matching `%s'\n", pInfo->driver);
LogMessageVerb(X_ERROR, 1, "No input driver matching `%s'\n", pInfo->driver);
if (strlen(FALLBACK_INPUT_DRIVER) > 0) {
xf86Msg(X_INFO, "Falling back to input driver `%s'\n",
LogMessageVerb(X_INFO, 1, "Falling back to input driver `%s'\n",
FALLBACK_INPUT_DRIVER);
drv = xf86LoadInputDriver(FALLBACK_INPUT_DRIVER);
if (drv) {
@ -931,13 +930,13 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
}
}
xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName,
LogMessageVerb(X_INFO, 1, "Using input driver '%s' for '%s'\n", drv->driverName,
pInfo->name);
if (!drv->PreInit) {
xf86Msg(X_ERROR,
"Input driver `%s' has no PreInit function (ignoring)\n",
drv->driverName);
LogMessageVerb(X_ERROR, 1,
"Input driver `%s' has no PreInit function (ignoring)\n",
drv->driverName);
rval = BadImplementation;
goto unwind;
}
@ -975,7 +974,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
input_unlock();
if (rval != Success) {
xf86Msg(X_ERROR, "PreInit returned %d for \"%s\"\n", rval, pInfo->name);
LogMessageVerb(X_ERROR, 1, "PreInit returned %d for \"%s\"\n", rval, pInfo->name);
goto unwind;
}
@ -986,14 +985,14 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
rval = ActivateDevice(dev, TRUE);
if (rval != Success) {
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
LogMessageVerb(X_ERROR, 1, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
goto unwind;
}
rval = xf86InputDevicePostInit(dev);
if (rval != Success) {
xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", pInfo->name);
LogMessageVerb(X_ERROR, 1, "Couldn't post-init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
goto unwind;
}
@ -1003,7 +1002,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
input_lock();
EnableDevice(dev, TRUE);
if (!dev->enabled) {
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
LogMessageVerb(X_ERROR, 1, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
rval = BadMatch;
input_unlock();
@ -1108,15 +1107,14 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
}
if (!pInfo->name) {
xf86Msg(X_INFO, "No identifier specified, ignoring this device.\n");
LogMessageVerb(X_INFO, 1, "No identifier specified, ignoring this device.\n");
rval = BadRequest;
goto unwind;
}
if (!pInfo->driver) {
xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n");
xf86Msg(X_INFO,
"This device may have been added with another device file.\n");
LogMessageVerb(X_INFO, 1, "No input driver specified, ignoring this device.\n");
LogMessageVerb(X_INFO, 1, "This device may have been added with another device file.\n");
rval = BadRequest;
goto unwind;
}
@ -1129,7 +1127,7 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
unwind:
if (is_auto && !xf86Info.autoAddDevices)
xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
LogMessageVerb(X_INFO, 1, "AutoAddDevices is off - not adding device.\n");
xf86DeleteInput(pInfo, 0);
return rval;
}

View File

@ -30,18 +30,17 @@
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os/log_priv.h"
#include "misc.h"
#include "xf86.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "regionstr.h"
#include "xf86fbman.h"
/*
#define DEBUG
*/
static DevPrivateKeyRec xf86FBManagerKeyRec;
static DevPrivateKey xf86FBManagerKey;

View File

@ -35,8 +35,11 @@
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include <pciaccess.h>
#include <X11/X.h>
#include "os/log_priv.h"
#include "os.h"
#include "Pci.h"
#include "xf86.h"
@ -133,8 +136,8 @@ xf86PciProbe(void)
primaryBus.id.pci = info;
}
else {
xf86Msg(X_NOTICE,
"More than one possible primary device found\n");
LogMessageVerb(X_NOTICE, 1,
"More than one possible primary device found\n");
primaryBus.type ^= (BusType) (-1);
}
}
@ -154,10 +157,10 @@ xf86PciProbe(void)
if (xf86IsPrimaryPci(info))
prim = "*";
xf86Msg(X_PROBED, "PCI:%s(%u@%u:%u:%u) %04x:%04x:%04x:%04x ", prim,
info->bus, info->domain, info->dev, info->func,
info->vendor_id, info->device_id,
info->subvendor_id, info->subdevice_id);
LogMessageVerb(X_PROBED, 1, "PCI:%s(%u@%u:%u:%u) %04x:%04x:%04x:%04x ", prim,
info->bus, info->domain, info->dev, info->func,
info->vendor_id, info->device_id,
info->subvendor_id, info->subdevice_id);
xf86ErrorF("rev %d", info->revision);
@ -825,11 +828,11 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
devList[j]->screen == instances[i].screen) {
if (devBus)
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section for "
"instances\n\t(BusID: %s) found: %s\n",
driverName, devList[j]->busID,
devList[j]->identifier);
LogMessageVerb(X_WARNING, 0,
"%s: More than one matching Device section for "
"instances\n\t(BusID: %s) found: %s\n",
driverName, devList[j]->busID,
devList[j]->identifier);
else
devBus = devList[j];
}
@ -840,13 +843,12 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* only assign to it to the primary device.
*/
if (xf86IsPrimaryPci(pPci)) {
xf86Msg(X_PROBED, "Assigning device section with no busID"
" to primary device\n");
LogMessageVerb(X_PROBED, 1, "Assigning device section with no busID to primary device\n");
if (dev || devBus)
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section "
"found: %s\n", driverName,
devList[j]->identifier);
LogMessageVerb(X_WARNING, 0,
"%s: More than one matching Device section "
"found: %s\n", driverName,
devList[j]->identifier);
else
dev = devList[j];
}
@ -856,10 +858,10 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
dev = devBus; /* busID preferred */
if (!dev) {
if (xf86CheckPciSlot(pPci) && pciDeviceHasBars(pPci)) {
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID PCI:%u@%u:%u:%u) found\n",
driverName, pPci->bus, pPci->domain, pPci->dev,
pPci->func);
LogMessageVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID PCI:%u@%u:%u:%u) found\n",
driverName, pPci->bus, pPci->domain, pPci->dev,
pPci->func);
}
}
else {
@ -888,10 +890,10 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if (c->token == -1) {
instances[i].claimed = FALSE;
numClaimedInstances--;
xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
"section \"%s\" isn't valid for this driver\n",
driverName, instances[i].dev->chipset,
instances[i].dev->identifier);
LogMessageVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
"section \"%s\" isn't valid for this driver\n",
driverName, instances[i].dev->chipset,
instances[i].dev->identifier);
}
else {
instances[i].chip = c->token;
@ -901,17 +903,17 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
break;
}
if (id->numChipset >= 0) {
xf86Msg(X_CONFIG, "Chipset override: %s\n",
instances[i].dev->chipset);
LogMessageVerb(X_CONFIG, 1, "Chipset override: %s\n",
instances[i].dev->chipset);
from = X_CONFIG;
}
else {
instances[i].claimed = FALSE;
numClaimedInstances--;
xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
"section \"%s\" isn't a valid PCI chipset\n",
driverName, instances[i].dev->chipset,
instances[i].dev->identifier);
LogMessageVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
"section \"%s\" isn't a valid PCI chipset\n",
driverName, instances[i].dev->chipset,
instances[i].dev->identifier);
}
}
}
@ -923,16 +925,15 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if (id->numChipset == -1) {
instances[i].claimed = FALSE;
numClaimedInstances--;
xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
"section \"%s\" isn't valid for this driver\n",
driverName, instances[i].dev->chipID,
instances[i].dev->identifier);
LogMessageVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
"section \"%s\" isn't valid for this driver\n",
driverName, instances[i].dev->chipID,
instances[i].dev->identifier);
}
else {
instances[i].chip = id->numChipset;
xf86Msg(X_CONFIG, "ChipID override: 0x%04X\n",
instances[i].dev->chipID);
LogMessageVerb(X_CONFIG, 1, "ChipID override: 0x%04X\n",
instances[i].dev->chipID);
from = X_CONFIG;
}
}
@ -949,7 +950,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if (c->token == instances[i].chip)
break;
}
xf86Msg(from, "Chipset %s found\n", c->name);
LogMessageVerb(from, 1, "Chipset %s found\n", c->name);
}
}
@ -1310,9 +1311,9 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
if (!idsdir)
return;
xf86Msg(X_INFO,
"Scanning %s directory for additional PCI ID's supported by the drivers\n",
PCI_TXT_IDS_PATH);
LogMessageVerb(X_INFO, 1,
"Scanning %s directory for additional PCI ID's supported by the drivers\n",
PCI_TXT_IDS_PATH);
direntry = readdir(idsdir);
/* Read the directory */
while (direntry) {
@ -1328,8 +1329,8 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
PCI_TXT_IDS_PATH, direntry->d_name);
fp = fopen(path_name, "r");
if (fp == NULL) {
xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n",
path_name);
LogMessageVerb(X_ERROR, 1, "Could not open %s for reading. Exiting.\n",
path_name);
goto end;
}
/* Read the file */
@ -1363,8 +1364,8 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
(char *) malloc(sizeof(char) *
strlen(direntry->d_name) - 3);
if (!tmpMatch) {
xf86Msg(X_ERROR,
"Could not allocate space for the module name. Exiting.\n");
LogMessageVerb(X_ERROR, 1,
"Could not allocate space for the module name. Exiting.\n");
goto end;
}
/* hack off the .ids suffix. This should guard
@ -1380,8 +1381,8 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
}
}
xf86AddMatchedDriver(md, tmpMatch);
xf86Msg(X_INFO, "Matched %s from file name %s\n",
tmpMatch, direntry->d_name);
LogMessageVerb(X_INFO, 1, "Matched %s from file name %s\n",
tmpMatch, direntry->d_name);
free(tmpMatch);
}
}

View File

@ -233,9 +233,9 @@ xf86OutputClassDriverList(int index, XF86MatchedDrivers *md)
if (OutputClassMatches(cl, &xf86_platform_devices[index])) {
char *path = xf86_platform_odev_attributes(index)->path;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
cl->identifier, path);
xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
LogMessageVerb(X_INFO, 1, "Applying OutputClass \"%s\" to %s\n",
cl->identifier, path);
LogMessageVerb(X_NONE, 1, "\tloading driver: %s\n", cl->driver);
xf86AddMatchedDriver(md, cl->driver);
}
@ -283,7 +283,7 @@ void xf86PlatformScanPciDev(void)
if (!xf86scanpci())
return;
xf86Msg(X_CONFIG, "Scanning the platform PCI devices\n");
LogMessageVerb(X_CONFIG, 1, "Scanning the platform PCI devices\n");
for (i = 0; i < xf86_num_platform_devices; i++) {
char *busid = xf86_platform_odev_attributes(i)->busid;
@ -327,8 +327,8 @@ xf86platformProbe(void)
XNFasprintf(&path, "%s,%s", cl->modulepath,
path ? path : xf86ModulePath);
free(old_path);
xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
cl->identifier, path);
LogMessageVerb(X_CONFIG, 1, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
cl->identifier, path);
LoaderSetPath(path);
}
}
@ -344,8 +344,8 @@ xf86platformProbe(void)
continue;
if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
cl->identifier, dev->attribs->path);
LogMessageVerb(X_CONFIG, 1, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
cl->identifier, dev->attribs->path);
primaryBus.type = BUS_PLATFORM;
primaryBus.id.plat = dev;
return 0;
@ -395,8 +395,8 @@ xf86MergeOutputClassOptions(int entityIndex, void **options)
}
break;
default:
xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
entity->bus.type);
LogMessageVerb(X_DEBUG, 1, "xf86MergeOutputClassOptions unsupported bus type %d\n",
entity->bus.type);
}
if (!dev)
@ -406,8 +406,8 @@ xf86MergeOutputClassOptions(int entityIndex, void **options)
if (!OutputClassMatches(cl, dev) || !cl->option_lst)
continue;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
cl->identifier, dev->attribs->path);
LogMessageVerb(X_INFO, 1, "Applying OutputClass \"%s\" options to %s\n",
cl->identifier, dev->attribs->path);
classopts = xf86optionListDup(cl->option_lst);
*options = xf86optionListMerge(*options, classopts);
@ -653,8 +653,8 @@ xf86PlatformFindHotplugDriver(int dev_index)
}
/* Return the first driver from the match list */
xf86Msg(X_INFO, "matching hotplug-driver is %s\n",
hp_driver ? hp_driver : "none");
LogMessageVerb(X_INFO, 1, "matching hotplug-driver is %s\n",
hp_driver ? hp_driver : "none");
return hp_driver;
}
@ -811,13 +811,13 @@ void xf86platformPrimary(void)
{
/* use the first platform device as a fallback */
if (primaryBus.type == BUS_NONE) {
xf86Msg(X_INFO, "no primary bus or device found\n");
LogMessageVerb(X_INFO, 1, "no primary bus or device found\n");
if (xf86_num_platform_devices > 0) {
primaryBus.id.plat = &xf86_platform_devices[0];
primaryBus.type = BUS_PLATFORM;
xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
LogMessageVerb(X_NONE, 1, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
}
}
}

View File

@ -224,7 +224,7 @@ xf86SbusProbe(void)
break;
}
xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
LogMessageVerb(X_PROBED, 1, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
promPath = sparcPromNode2Pathname(&psdp->node);
if (promPath) {
xf86ErrorF(" at %s", promPath);
@ -232,7 +232,7 @@ xf86SbusProbe(void)
}
}
else
xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
LogMessageVerb(X_PROBED, 1, "SBUS: %s", psdp->descr);
xf86ErrorF("\n");
}
if (useProm)
@ -464,11 +464,11 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
if (devList[j]->busID && *devList[j]->busID) {
if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
if (devBus)
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section for "
"instance (BusID: %s) found: %s\n",
driverName, devList[j]->identifier,
devList[j]->busID);
LogMessageVerb(X_WARNING, 0,
"%s: More than one matching Device section for "
"instance (BusID: %s) found: %s\n",
driverName, devList[j]->identifier,
devList[j]->busID);
else
devBus = devList[j];
}
@ -476,34 +476,34 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
else {
if (!dev && !devBus) {
if (promPath)
xf86Msg(X_PROBED,
"Assigning device section with no busID to SBUS:%s\n",
promPath);
LogMessageVerb(X_PROBED, 1,
"Assigning device section with no busID to SBUS:%s\n",
promPath);
else
xf86Msg(X_PROBED,
"Assigning device section with no busID to SBUS:fb%d\n",
psdp->fbNum);
LogMessageVerb(X_PROBED, 1,
"Assigning device section with no busID to SBUS:fb%d\n",
psdp->fbNum);
dev = devList[j];
}
else
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section "
"found: %s\n", driverName,
devList[j]->identifier);
LogMessageVerb(X_WARNING, 0,
"%s: More than one matching Device section "
"found: %s\n", driverName,
devList[j]->identifier);
}
}
if (devBus)
dev = devBus; /* busID preferred */
if (!dev && psdp->fd != -2) {
if (promPath) {
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:%s) found\n",
driverName, promPath);
LogMessageVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:%s) found\n",
driverName, promPath);
}
else
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:fb%d) found\n",
driverName, psdp->fbNum);
LogMessageVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:fb%d) found\n",
driverName, psdp->fbNum);
}
else if (dev) {
numClaimedInstances++;

View File

@ -89,8 +89,8 @@ handle_edid_quirks(xf86MonPtr m)
xf86ForEachDetailedBlock(m, find_max_detailed_clock, &clock);
if (clock && (ranges->max_clock * 1e6 < clock)) {
xf86Msg(X_WARNING, "EDID timing clock %.2f exceeds claimed max "
"%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock);
LogMessageVerb(X_WARNING, 1, "EDID timing clock %.2f exceeds claimed max "
"%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock);
ranges->max_clock = (clock + 999999) / 1e6;
}
}
@ -159,8 +159,8 @@ encode_aspect_ratio(xf86MonPtr m)
m->features.vsize = (p.real_vsize + 5) / 10;
}
xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
m->features.hsize, m->features.vsize);
LogMessageVerb(X_INFO, 1, "Quirked EDID physical size to %dx%d cm\n",
m->features.hsize, m->features.vsize);
}
}

View File

@ -5630,17 +5630,6 @@ strongly encouraged to improve the consistency of driver behaviour.
</blockquote></para></blockquote>
<blockquote><para>
<programlisting>
xf86MsgVerb(MessageType type, int verb, const char *format, ...);
</programlisting>
<blockquote><para>
Like <function>xf86Msg()</function>, but with the verbosity level given
explicitly.
</para>
</blockquote></para></blockquote>
<blockquote><para>
<programlisting>
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...);

View File

@ -28,7 +28,7 @@ fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
Bool
fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device)
{
xf86Msg(X_ERROR, "fbdevhw is not available on this platform\n");
LogMessageVerb(X_ERROR, 1, "fbdevhw is not available on this platform\n");
return FALSE;
}

View File

@ -752,9 +752,9 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
}
else {
if (unalloc) {
xf86Msg(X_ERROR,
"i2c bug: Attempt to remove I2C bus \"%s\", "
"but device list is not empty.\n", b->BusName);
LogMessageVerb(X_ERROR, 1,
"i2c bug: Attempt to remove I2C bus \"%s\", "
"but device list is not empty.\n", b->BusName);
return;
}
}

View File

@ -211,7 +211,7 @@ stack_trace(xf86Int10InfoPtr pInt)
if (stack >= tail)
return;
xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
LogMessageVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
for (; stack < tail; stack++) {
xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
i = (i + 1) % 0x10;

View File

@ -36,6 +36,8 @@
#include <stdio.h>
#include <string.h>
#include "os/log_priv.h"
#include "xf86.h"
#include "vbe.h"
#include "vbeModes.h"

View File

@ -75,19 +75,18 @@ LoaderInit(void)
LogMessageVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols);
#endif
LogMessageVerb(X_INFO, 2, "Module ABI versions:\n");
LogWrite(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC,
LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC,
GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion),
GET_ABI_MINOR(LoaderVersionInfo.ansicVersion));
LogWrite(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV,
LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV,
GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion),
GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion));
LogWrite(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT,
LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT,
GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion),
GET_ABI_MINOR(LoaderVersionInfo.xinputVersion));
LogWrite(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION,
LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION,
GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion),
GET_ABI_MINOR(LoaderVersionInfo.extensionVersion));
}
/* Public Interface to the loader. */

View File

@ -438,14 +438,14 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
vercode[1] = (ver / 100000) % 100;
vercode[2] = (ver / 1000) % 100;
vercode[3] = ver % 1000;
LogWrite(1, "\tcompiled for %d.%d.%d", vercode[0], vercode[1], vercode[2]);
LogMessageVerb(X_NONE, 1, "\tcompiled for %d.%d.%d", vercode[0], vercode[1], vercode[2]);
if (vercode[3] != 0)
LogWrite(1, ".%d", vercode[3]);
LogWrite(1, ", module version = %d.%d.%d\n", data->majorversion,
LogMessageVerb(X_NONE, 1, ".%d", vercode[3]);
LogMessageVerb(X_NONE, 1, ", module version = %d.%d.%d\n", data->majorversion,
data->minorversion, data->patchlevel);
if (data->moduleclass)
LogWrite(2, "\tModule class: %s\n", data->moduleclass);
LogMessageVerb(X_NONE, 2, "\tModule class: %s\n", data->moduleclass);
ver = -1;
if (data->abiclass) {
@ -463,7 +463,7 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
abimaj = GET_ABI_MAJOR(data->abiversion);
abimin = GET_ABI_MINOR(data->abiversion);
LogWrite(2, "\tABI class: %s, version %d.%d\n",
LogMessageVerb(X_NONE, 2, "\tABI class: %s, version %d.%d\n",
data->abiclass, abimaj, abimin);
if (ver != -1) {
vermaj = GET_ABI_MAJOR(ver);
@ -686,14 +686,14 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq,
name = LoaderGetCanonicalName(module, patterns);
noncanonical = (name && strcmp(module, name) != 0);
if (noncanonical) {
LogWrite(3, " (%s)\n", name);
LogMessageVerb(X_NONE, 3, " (%s)\n", name);
LogMessageVerb(X_WARNING, 1,
"LoadModule: given non-canonical module name \"%s\"\n",
module);
m = name;
}
else {
LogWrite(3, "\n");
LogMessageVerb(X_NONE, 3, "\n");
m = (char *) module;
}

View File

@ -71,7 +71,7 @@ dense_base(void)
init_abw();
/* XXX check abst_flags for ABST_DENSE just to be safe? */
xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
LogMessageVerb(X_INFO, 1, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start);
return abw[0].abw_abst.abst_sys_start;
}
@ -120,14 +120,14 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
LogMessageVerb(X_INFO, 1, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
return;
}
else {
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_APERTURE, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to mmap %s (%s)\n",
DEV_APERTURE, strerror(errno));
}
}
}
@ -144,23 +144,23 @@ checkDevMem(Bool warn)
}
else {
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
}
}
}
if (warn) {
#ifndef HAS_APERTURE_DRV
xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open/mmap %s (%s)\n",
DEV_MEM, strerror(errno));
#else
#ifndef __OpenBSD__
xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
#else /* __OpenBSD__ */
xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
SYSCTL_MSG);
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
SYSCTL_MSG);
#endif /* __OpenBSD__ */
#endif
xf86ErrorF("\tlinear framebuffer access unavailable\n");

View File

@ -113,15 +113,15 @@ checkDevMem(Bool warn)
else {
/* This should not happen */
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
}
return;
}
}
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
return;
}
@ -144,8 +144,8 @@ xf86EnableIO()
return TRUE;
if ((IoFd = open("/dev/io", O_RDWR)) == -1) {
xf86Msg(X_WARNING, "xf86EnableIO: "
"Failed to open /dev/io for extended I/O\n");
LogMessageVerb(X_WARNING, 1,
"xf86EnableIO: Failed to open /dev/io for extended I/O\n");
return FALSE;
}
return TRUE;
@ -186,14 +186,16 @@ xf86EnableIO()
IOPortBase = base;
}
else {
xf86Msg(X_WARNING, "EnableIO: failed to mmap %s (%s)\n",
"/dev/ttyC0", strerror(errno));
LogMessageVerb(X_WARNING, 1,
"EnableIO: failed to mmap /dev/ttyC0 (%s)\n",
strerror(errno));
return FALSE;
}
}
else {
xf86Msg("EnableIO: failed to open %s (%s)\n",
"/dev/ttyC0", strerror(errno));
LogMessageVerb(X_WARNING, 1,
"EnableIO: failed to open /dev/ttyC0 (%s)\n",
strerror(errno));
return FALSE;
}

View File

@ -221,9 +221,9 @@ xf86OpenConsole(void)
* /dev/console
*/
if ((devConsoleFd = open("/dev/console", O_WRONLY, 0)) < 0) {
xf86Msg(X_WARNING,
"xf86OpenConsole: couldn't open /dev/console (%s)\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86OpenConsole: couldn't open /dev/console (%s)\n",
strerror(errno));
}
break;
#endif
@ -250,7 +250,7 @@ xf86OpenConsole(void)
if (initialVT != 1) {
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) {
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
sleep(1);
}
@ -265,14 +265,14 @@ xf86OpenConsole(void)
SYSCALL(result =
ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
if (result != 0) {
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
SYSCALL(result =
ioctl(xf86Info.consoleFd, VT_WAITACTIVE,
xf86Info.vtno));
if (result != 0) {
xf86Msg(X_WARNING,
"xf86OpenConsole: VT_WAITACTIVE failed\n");
LogMessageVerb(X_WARNING, 1,
"xf86OpenConsole: VT_WAITACTIVE failed\n");
}
OsSignal(SIGUSR1, xf86VTRequest);
@ -312,7 +312,7 @@ xf86OpenConsole(void)
if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch &&
(xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)) {
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
}
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
@ -338,7 +338,7 @@ xf86OpenPccons(void)
CHECK_DRIVER_MSG);
}
xf86Info.consType = PCCONS;
xf86Msg(X_PROBED, "Using pccons driver with X support\n");
LogMessageVerb(X_PROBED, 1, "Using pccons driver with X support\n");
}
return fd;
}
@ -430,7 +430,7 @@ xf86OpenSyscons(void)
FatalError("xf86OpenSyscons: VT_GETMODE failed");
}
xf86Info.consType = SYSCONS;
xf86Msg(X_PROBED, "Using syscons driver with X support");
LogMessageVerb(X_PROBED, 1, "Using syscons driver with X support");
if (syscons_version >= 0x100) {
xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
syscons_version & 0xFF);
@ -438,7 +438,7 @@ xf86OpenSyscons(void)
else {
xf86ErrorF(" (version 0.x)\n");
}
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
LogMessageVerb(from, 1, "using VT number %d\n\n", xf86Info.vtno);
}
else {
/* VT_GETMODE failed, probably not syscons */
@ -533,21 +533,21 @@ xf86OpenPcvt(void)
xf86Info.consType = PCVT;
#ifdef WSCONS_SUPPORT
#ifdef __NetBSD__
xf86Msg(X_PROBED,
"Using wscons driver on %s in pcvt compatibility mode "
"(version %d.%d)\n", vtname,
pcvt_version.rmajor, pcvt_version.rminor);
LogMessageVerb(X_PROBED, 1,
"Using wscons driver on %s in pcvt compatibility mode "
"(version %d.%d)\n", vtname,
pcvt_version.rmajor, pcvt_version.rminor);
#else
xf86Msg(X_PROBED,
"Using wscons driver on %s in pcvt compatibility mode ",
vtname);
LogMessageVerb(X_PROBED, 1,
"Using wscons driver on %s in pcvt compatibility mode ",
vtname);
#endif
#else
# ifdef __NetBSD__
xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
pcvt_version.rmajor, pcvt_version.rminor);
LogMessageVerb(X_PROBED, 1, "Using pcvt driver (version %d.%d)\n",
pcvt_version.rmajor, pcvt_version.rminor);
# else
xf86Msg(X_PROBED, "Using pcvt driver\n");
LogMessageVerb(X_PROBED, 1, "Using pcvt driver\n");
# endif
#endif
#ifdef __NetBSD__
@ -590,7 +590,7 @@ xf86OpenWScons(void)
"xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG);
}
xf86Info.consType = WSCONS;
xf86Msg(X_PROBED, "Using wscons driver\n");
LogMessageVerb(X_PROBED, 1, "Using wscons driver\n");
}
return fd;
}

View File

@ -92,8 +92,8 @@ checkDevMem(Bool warn)
else {
/* This should not happen */
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
}
useDevMem = FALSE;
return;
@ -101,8 +101,8 @@ checkDevMem(Bool warn)
}
#ifndef HAS_APERTURE_DRV
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
useDevMem = FALSE;
return;
@ -117,27 +117,27 @@ checkDevMem(Bool warn)
munmap((caddr_t) base, 4096);
devMemFd = fd;
useDevMem = TRUE;
xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
LogMessageVerb(X_INFO, 1, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
return;
}
else {
if (warn) {
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_APERTURE, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to mmap %s (%s)\n",
DEV_APERTURE, strerror(errno));
}
}
}
else {
if (warn) {
#ifndef __OpenBSD__
xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno));
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno));
#else /* __OpenBSD__ */
xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno),
SYSCTL_MSG);
LogMessageVerb(X_WARNING, 1, "checkDevMem: failed to open %s and %s\n"
"\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno),
SYSCTL_MSG);
#endif /* __OpenBSD__ */
}
}
@ -173,11 +173,9 @@ xf86EnableIO(void)
if (i386_iopl(TRUE) < 0) {
#ifndef __OpenBSD__
xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O",
"xf86EnableIO");
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to set IOPL for extended I/O");
#else
xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s",
"xf86EnableIO", SYSCTL_MSG);
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to set IOPL for extended I/O\n%s", SYSCTL_MSG);
#endif
return FALSE;
}
@ -218,11 +216,9 @@ xf86EnableIO(void)
if (amd64_iopl(TRUE) < 0) {
#ifndef __OpenBSD__
xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O",
"xf86EnableIO");
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to set IOPL for extended I/O");
#else
xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s",
"xf86EnableIO", SYSCTL_MSG);
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to set IOPL for extended I/O\n%s", SYSCTL_MSG);
#endif
return FALSE;
}
@ -258,8 +254,7 @@ xf86EnableIO(void)
return TRUE;
if ((IoFd = open("/dev/io", O_RDWR)) == -1) {
xf86Msg(X_WARNING, "xf86EnableIO: "
"Failed to open /dev/io for extended I/O");
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to open /dev/io for extended I/O");
return FALSE;
}
return TRUE;
@ -290,9 +285,9 @@ xf86SetTVOut(int mode)
case PCCONS:{
if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) {
xf86Msg(X_WARNING,
"xf86SetTVOut: Could not set console to TV output, %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86SetTVOut: Could not set console to TV output, %s\n",
strerror(errno));
}
}
break;
@ -313,9 +308,9 @@ xf86SetRGBOut(void)
case PCCONS:{
if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) {
xf86Msg(X_WARNING,
"xf86SetTVOut: Could not set console to RGB output, %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86SetTVOut: Could not set console to RGB output, %s\n",
strerror(errno));
}
}
break;

View File

@ -58,13 +58,13 @@ xf86EnableIO()
{
int fd = xf86Info.consoleFd;
xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
LogMessageVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
if (ioBase == MAP_FAILED) {
ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
0xf2000000);
xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
LogMessageVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
if (ioBase == MAP_FAILED) {
xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n");
LogMessageVerb(X_WARNING, 3, "Can't map IO space!\n");
return FALSE;
}
}

View File

@ -10,6 +10,8 @@
#include <fcntl.h>
#include <errno.h>
#include "os/log_priv.h"
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
@ -149,7 +151,7 @@ lnxACPIOpen(void)
strcpy(addr.sun_path, ACPI_SOCKET);
if ((r = connect(fd, (struct sockaddr *) &addr, sizeof(addr))) == -1) {
if (!warned)
xf86MsgVerb(X_WARNING, 3, "Open ACPI failed (%s) (%s)\n",
LogMessageVerb(X_WARNING, 3, "Open ACPI failed (%s) (%s)\n",
ACPI_SOCKET, strerror(errno));
warned = 1;
shutdown(fd, 2);
@ -161,7 +163,7 @@ lnxACPIOpen(void)
xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
xf86MsgVerb(X_INFO, 3, "Open ACPI successful (%s)\n", ACPI_SOCKET);
LogMessageVerb(X_INFO, 3, "Open ACPI successful (%s)\n", ACPI_SOCKET);
warned = 0;
return lnxCloseACPI;

View File

@ -4,6 +4,9 @@
#endif
#include <X11/X.h>
#include "os/log_priv.h"
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
@ -165,7 +168,7 @@ lnxAPMOpen(void)
DebugF("APM: Opening device\n");
if ((fd = open(APM_DEVICE, O_RDWR)) > -1) {
if (access(APM_PROC, R_OK) || ((pfd = open(APM_PROC, O_RDONLY)) == -1)) {
xf86MsgVerb(X_WARNING, 3, "Cannot open APM (%s) (%s)\n",
LogMessageVerb(X_WARNING, 3, "Cannot open APM (%s) (%s)\n",
APM_PROC, strerror(errno));
close(fd);
return NULL;
@ -175,7 +178,7 @@ lnxAPMOpen(void)
xf86PMGetEventFromOs = lnxPMGetEventFromOs;
xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
xf86MsgVerb(X_INFO, 3, "Open APM successful\n");
LogMessageVerb(X_INFO, 3, "Open APM successful\n");
return lnxCloseAPM;
}
return NULL;

View File

@ -73,13 +73,13 @@ switch_to(int vt, const char *from)
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret < 0) {
xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
LogMessageVerb(X_WARNING, 1, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
return 0;
}
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret < 0) {
xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
LogMessageVerb(X_WARNING, 1, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
return 0;
}
@ -145,7 +145,7 @@ linux_parse_vt_settings(int may_fail)
close(fd);
}
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
LogMessageVerb(from, 1, "using VT number %d\n\n", xf86Info.vtno);
/* Some of stdin / stdout / stderr maybe redirected to a file */
for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
@ -157,9 +157,9 @@ linux_parse_vt_settings(int may_fail)
}
if (!KeepTty && current_vt == xf86Info.vtno) {
xf86Msg(X_PROBED,
"controlling tty is VT number %d, auto-enabling KeepTty\n",
current_vt);
LogMessageVerb(X_PROBED, 1,
"controlling tty is VT number %d, auto-enabling KeepTty\n",
current_vt);
KeepTty = TRUE;
}
@ -196,13 +196,13 @@ xf86OpenConsole(void)
* group leader
*/
if (setpgid(0, ppgid) < 0)
xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: setpgid failed: %s\n",
strerror(errno));
/* become process group leader */
if ((setsid() < 0))
xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: setsid failed: %s\n",
strerror(errno));
}
i = 0;
@ -223,8 +223,8 @@ xf86OpenConsole(void)
*/
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
if (ret < 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
strerror(errno));
else
activeVT = vts.v_active;
@ -320,23 +320,23 @@ xf86CloseConsole(void)
/* Back to text mode ... */
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
if (ret < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86CloseConsole: KDSETMODE failed: %s\n",
strerror(errno));
SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
if (ret < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86CloseConsole: VT_GETMODE failed: %s\n",
strerror(errno));
else {
/* set dflt vt handling */
VT.mode = VT_AUTO;
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
if (ret < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86CloseConsole: VT_SETMODE failed: %s\n",
strerror(errno));
}
if (xf86Info.autoVTSwitch) {
@ -347,8 +347,8 @@ xf86CloseConsole(void)
if (activeVT >= 0) {
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
if (ret < 0) {
xf86Msg(X_WARNING, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
strerror(errno));
} else {
if (vts.v_active == xf86Info.vtno) {
switch_to(activeVT, "xf86CloseConsole");

View File

@ -72,12 +72,12 @@ xf86LoadKernelModule(const char *modName)
* preinstall agpgart module for some DRM modules
*/
if (setreuid(0, 0)) {
xf86Msg(X_WARNING, "LoadKernelModule: "
"Setting of real/effective user Id to 0/0 failed");
LogMessageVerb(X_WARNING, 1, "LoadKernelModule: "
"Setting of real/effective user Id to 0/0 failed");
}
setenv("PATH", "/sbin", 1);
execl(mpPath, "modprobe", modName, NULL);
xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno));
LogMessageVerb(X_WARNING, 1, "LoadKernelModule %s\n", strerror(errno));
exit(EXIT_FAILURE); /* if we get here the child's exec failed */
break;
case -1: /* fork failed */

View File

@ -60,7 +60,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
v = drmGetVersion(fd);
if (!v) {
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
LogMessageVerb(X_ERROR, 1, "%s: failed to query DRM version\n", path);
goto out;
}

View File

@ -59,6 +59,7 @@
#include <errno.h>
#include <X11/X.h>
#include "os/log_priv.h"
#include "os/xserver_poll.h"
#include "xf86.h"
@ -124,7 +125,7 @@ xf86OpenSerial(XF86OptionPtr options)
dev = xf86SetStrOption(options, "Device", NULL);
if (!dev) {
xf86Msg(X_ERROR, "xf86OpenSerial: No Device specified.\n");
LogMessageVerb(X_ERROR, 1, "xf86OpenSerial: No Device specified.\n");
return -1;
}
@ -134,9 +135,9 @@ xf86OpenSerial(XF86OptionPtr options)
SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK));
if (fd == -1) {
xf86Msg(X_ERROR,
"xf86OpenSerial: Cannot open device %s\n\t%s.\n",
dev, strerror(errno));
LogMessageVerb(X_ERROR, 1,
"xf86OpenSerial: Cannot open device %s\n\t%s.\n",
dev, strerror(errno));
free(dev);
return -1;
}
@ -209,7 +210,7 @@ xf86SetSerial(int fd, XF86OptionPtr options)
cfsetospeed(&t, baud);
}
else {
xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", val);
LogMessageVerb(X_ERROR, 1, "Invalid Option BaudRate value: %d\n", val);
return -1;
}
}
@ -223,7 +224,7 @@ xf86SetSerial(int fd, XF86OptionPtr options)
t.c_cflag |= CSTOPB;
break;
default:
xf86Msg(X_ERROR, "Invalid Option StopBits value: %d\n", val);
LogMessageVerb(X_ERROR, 1, "Invalid Option StopBits value: %d\n", val);
return -1;
break;
}
@ -248,7 +249,7 @@ xf86SetSerial(int fd, XF86OptionPtr options)
t.c_cflag |= CS8;
break;
default:
xf86Msg(X_ERROR, "Invalid Option DataBits value: %d\n", val);
LogMessageVerb(X_ERROR, 1, "Invalid Option DataBits value: %d\n", val);
return -1;
break;
}
@ -266,7 +267,7 @@ xf86SetSerial(int fd, XF86OptionPtr options)
t.c_cflag &= ~(PARENB);
}
else {
xf86Msg(X_ERROR, "Invalid Option Parity value: %s\n", s);
LogMessageVerb(X_ERROR, 1, "Invalid Option Parity value: %s\n", s);
free(s);
return -1;
}
@ -295,7 +296,7 @@ xf86SetSerial(int fd, XF86OptionPtr options)
t.c_iflag &= ~(IXON | IXOFF);
}
else {
xf86Msg(X_ERROR, "Invalid Option FlowControl value: %s\n", s);
LogMessageVerb(X_ERROR, 1, "Invalid Option FlowControl value: %s\n", s);
free(s);
return -1;
}
@ -311,14 +312,14 @@ xf86SetSerial(int fd, XF86OptionPtr options)
SYSCALL(ioctl(fd, TIOCCDTR, NULL));
#endif
#else
xf86Msg(X_WARNING, "Option ClearDTR not supported on this OS\n");
LogMessageVerb(X_WARNING, 1, "Option ClearDTR not supported on this OS\n");
return -1;
#endif
xf86MarkOptionUsedByName(options, "ClearDTR");
}
if ((xf86SetBoolOption(options, "ClearRTS", FALSE))) {
xf86Msg(X_WARNING, "Option ClearRTS not supported on this OS\n");
LogMessageVerb(X_WARNING, 1, "Option ClearRTS not supported on this OS\n");
return -1;
xf86MarkOptionUsedByName(options, "ClearRTS");
}
@ -347,7 +348,7 @@ xf86SetSerialSpeed(int fd, int speed)
cfsetospeed(&t, baud);
}
else {
xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", speed);
LogMessageVerb(X_ERROR, 1, "Invalid Option BaudRate value: %d\n", speed);
return -1;
}

View File

@ -145,7 +145,7 @@ xf86SIGIO(int sig)
}
}
if (r > 0) {
xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
LogMessageVerb(X_ERROR, 1, "SIGIO %d descriptors not handled\n", r);
}
/* restore global errno */
errno = save_errno;
@ -198,13 +198,13 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure)
block_sigio();
#ifdef O_ASYNC
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
fd, strerror(errno));
LogMessageVerb(X_WARNING, 1, "fcntl(%d, O_ASYNC): %s\n",
fd, strerror(errno));
}
else {
if (fcntl(fd, F_SETOWN, getpid()) == -1) {
xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
fd, strerror(errno));
LogMessageVerb(X_WARNING, 1, "fcntl(%d, F_SETOWN): %s\n",
fd, strerror(errno));
}
else {
installed = TRUE;
@ -215,8 +215,8 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure)
/* System V Streams - used on Solaris for input devices */
if (!installed && isastream(fd)) {
if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
fd, strerror(errno));
LogMessageVerb(X_WARNING, 1, "fcntl(%d, I_SETSIG): %s\n",
fd, strerror(errno));
}
else {
installed = TRUE;
@ -283,8 +283,8 @@ xf86RemoveSIGIOHandler(int fd)
#if defined(I_SETSIG) && defined(HAVE_ISASTREAM)
if (isastream(fd)) {
if (ioctl(fd, I_SETSIG, 0) == -1) {
xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
fd, strerror(errno));
LogMessageVerb(X_WARNING, 1, "fcntl(%d, I_SETSIG, 0): %s\n",
fd, strerror(errno));
}
}
#endif

View File

@ -116,14 +116,14 @@ sunPMGetEventFromOS(int fd, pmEvent * events, int num)
if (ioctl(fd, SRN_IOC_NEXTEVENT, &sunEvent) < 0) {
if (errno != EAGAIN) {
xf86Msg(X_WARNING, "sunPMGetEventFromOS: SRN_IOC_NEXTEVENT"
" %s\n", strerror(errno));
LogMessageVerb(X_WARNING, 1, "sunPMGetEventFromOS: SRN_IOC_NEXTEVENT"
" %s\n", strerror(errno));
}
break;
}
events[i] = sunToXF86(sunEvent.type);
}
xf86Msg(X_WARNING, "Got some events\n");
LogMessageVerb(X_WARNING, 1, "Got some events\n");
return i;
}
@ -141,11 +141,11 @@ sunPMConfirmEventToOs(int fd, pmEvent event)
case XF86_APM_SYS_SUSPEND:
case XF86_APM_CRITICAL_SUSPEND:
case XF86_APM_USER_SUSPEND:
xf86Msg(X_WARNING, "Got SUSPENDED\n");
LogMessageVerb(X_WARNING, 1, "Got SUSPENDED\n");
if (ioctl(fd, SRN_IOC_SUSPEND, NULL) == 0)
return PM_CONTINUE;
else {
xf86Msg(X_WARNING, "sunPMConfirmEventToOs: SRN_IOC_SUSPEND"
LogMessageVerb(X_WARNING, 1, "sunPMConfirmEventToOs: SRN_IOC_SUSPEND"
" %s\n", strerror(errno));
return PM_FAILED;
}
@ -154,11 +154,11 @@ sunPMConfirmEventToOs(int fd, pmEvent event)
case XF86_APM_CRITICAL_RESUME:
case XF86_APM_STANDBY_FAILED:
case XF86_APM_SUSPEND_FAILED:
xf86Msg(X_WARNING, "Got RESUME\n");
LogMessageVerb(X_WARNING, 1, "Got RESUME\n");
if (ioctl(fd, SRN_IOC_RESUME, NULL) == 0)
return PM_CONTINUE;
else {
xf86Msg(X_WARNING, "sunPMConfirmEventToOs: SRN_IOC_RESUME"
LogMessageVerb(X_WARNING, 1, "sunPMConfirmEventToOs: SRN_IOC_RESUME"
" %s\n", strerror(errno));
return PM_FAILED;
}

View File

@ -71,8 +71,8 @@ xf86OSRingBell(int loudness, int pitch, int duration)
audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
if (audioFD == -1) {
xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
LogMessageVerb(X_ERROR, 1, "Bell: cannot open audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
return;
}
@ -119,9 +119,9 @@ xf86OSRingBell(int loudness, int pitch, int duration)
audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0) {
xf86Msg(X_ERROR,
"Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
LogMessageVerb(X_ERROR, 1,
"Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
close(audioFD);
return;
}
@ -150,9 +150,9 @@ xf86OSRingBell(int loudness, int pitch, int duration)
if (written == -1) {
if (errno != EAGAIN) {
xf86Msg(X_ERROR,
"Bell: writev failed on audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
LogMessageVerb(X_ERROR, 1,
"Bell: writev failed on audio device \"%s\": %s\n",
AUDIO_DEVICE, strerror(errno));
close(audioFD);
return;
}

View File

@ -77,13 +77,13 @@ switch_to(int vt, const char *from)
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n",
from, strerror(errno));
LogMessageVerb(X_WARNING, 1, "%s: VT_ACTIVATE failed: %s\n",
from, strerror(errno));
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n",
from, strerror(errno));
LogMessageVerb(X_WARNING, 1, "%s: VT_WAITACTIVE failed: %s\n",
from, strerror(errno));
}
#endif
@ -146,7 +146,7 @@ xf86OpenConsole(void)
if (vtEnabled == 0) {
/* VT not enabled - kernel too old or Sparc platforms
without visual_io support */
xf86Msg(from, "VT infrastructure is not available\n");
LogMessageVerb(from, 1, "VT infrastructure is not available\n");
xf86StartVT = 0;
xf86Info.vtno = 0;
@ -174,7 +174,7 @@ xf86OpenConsole(void)
}
}
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
LogMessageVerb(from, 1, "using VT number %d\n\n", xf86Info.vtno);
snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
if (fd != -1) {
@ -207,8 +207,8 @@ xf86OpenConsole(void)
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
xf86Msg(X_WARNING,
"xf86OpenConsole: VT_SET_CONSUSER failed\n");
LogMessageVerb(X_WARNING, 1,
"xf86OpenConsole: VT_SET_CONSUSER failed\n");
#endif
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
@ -225,16 +225,16 @@ xf86OpenConsole(void)
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n");
LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_SETDISPINFO failed\n");
}
#endif
#ifdef KDSETMODE
SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
if (i < 0) {
xf86Msg(X_WARNING,
"xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
consoleDev, strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
consoleDev, strerror(errno));
}
#endif
}
@ -251,8 +251,8 @@ xf86OpenConsole(void)
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
xf86Msg(X_WARNING,
"xf86OpenConsole: VT_SET_CONSUSER failed\n");
LogMessageVerb(X_WARNING, 1,
"xf86OpenConsole: VT_SET_CONSUSER failed\n");
#endif
/*
@ -288,18 +288,18 @@ xf86CloseConsole(void)
* the system, rather than only the console.
*/
if ((fd = open(xf86SolarisFbDev, O_RDWR, 0)) < 0) {
xf86Msg(X_WARNING,
"xf86CloseConsole(): unable to open framebuffer (%s)\n",
strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86CloseConsole(): unable to open framebuffer (%s)\n",
strerror(errno));
}
else {
struct fbgattr fbattr;
if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) &&
(ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) {
xf86Msg(X_WARNING,
"xf86CloseConsole(): unable to retrieve framebuffer"
" attributes (%s)\n", strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86CloseConsole(): unable to retrieve framebuffer"
" attributes (%s)\n", strerror(errno));
}
else {
void *fbdata;
@ -307,9 +307,9 @@ xf86CloseConsole(void)
fbdata = mmap(NULL, fbattr.fbtype.fb_size,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (fbdata == MAP_FAILED) {
xf86Msg(X_WARNING,
"xf86CloseConsole(): unable to mmap framebuffer"
" (%s)\n", strerror(errno));
LogMessageVerb(X_WARNING, 1,
"xf86CloseConsole(): unable to mmap framebuffer"
" (%s)\n", strerror(errno));
}
else {
memset(fbdata, 0, fbattr.fbtype.fb_size);

View File

@ -92,7 +92,7 @@ xf86EnableIO(void)
{
#if defined(__i386__) || defined(__i386) || defined(__x86)
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
xf86Msg(X_WARNING, "xf86EnableIO: Failed to set IOPL for I/O\n");
LogMessageVerb(X_WARNING, 1, "xf86EnableIO: Failed to set IOPL for I/O\n");
return FALSE;
}
#endif /* i386 */

View File

@ -16,6 +16,9 @@
#include <unistd.h>
#include <X11/X.h>
#include "os/log_priv.h"
#include "misc.h"
#include "xf86.h"

View File

@ -25,6 +25,7 @@ is" without express or implied warranty.
#include "dix/screenint_priv.h"
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "screenint.h"

View File

@ -37,6 +37,7 @@
#include <X11/Xproto.h>
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "os.h"

View File

@ -30,6 +30,8 @@
#include <drm_fourcc.h>
#include <wayland-util.h>
#include "os/log_priv.h"
#include "xwayland-dmabuf.h"
#include "xwayland-glamor-gbm.h"
#include "xwayland-screen.h"

View File

@ -32,6 +32,7 @@
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "randr/randrstr_priv.h"
#include "os/log_priv.h"
#include "xwayland-cvt.h"
#include "xwayland-output.h"

View File

@ -39,6 +39,7 @@
#include "dix/input_priv.h"
#include "dix/property_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "os/xserver_poll.h"

View File

@ -36,6 +36,7 @@
#include "dix/dix_priv.h"
#include "dix/property_priv.h"
#include "os/log_priv.h"
#include "compositeext.h"
#include "compint.h"

View File

@ -32,6 +32,7 @@
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include <inputstr.h>
#include <inpututils.h>

View File

@ -39,6 +39,7 @@
#include "dix/screenint_priv.h"
#include "os/cmdline.h"
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "os/xserver_poll.h"
@ -235,11 +236,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
val = strtol(argv[i], &end, 0);
if (*end == '\0') {
verbosity = val;
LogSetParameter(XLOG_VERBOSITY, verbosity);
xorgLogVerbosity = verbosity;
return 2;
}
}
LogSetParameter(XLOG_VERBOSITY, ++verbosity);
xorgLogVerbosity = ++verbosity;
return 1;
}
else if (strcmp(argv[i], "-version") == 0) {

View File

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

View File

@ -109,7 +109,7 @@ srcs_windows += [
rsrc = windows.compile_resources(
'XWin.rc',
include_directories: include_directories('../../include/'),
include_directories: include_directories('../../include/', '../..'),
depend_files: ['XWin.exe.manifest', 'X.ico'],
)
srcs_windows += rsrc

View File

@ -32,6 +32,7 @@
#include <xwin-config.h>
#endif
#include "os/log_priv.h"
#include "os/osdep.h"
#include <../xfree86/common/xorgVersion.h>
@ -50,7 +51,7 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
pthread_mutex_lock(&s_pmPrinting);
/* Print the error message to a log file, could be stderr */
LogVWrite(0, pszFormat, va_args);
LogVMessageVerb(X_NONE, 0, pszFormat, va_args);
/* Unlock the printing mutex */
pthread_mutex_unlock(&s_pmPrinting);

View File

@ -325,15 +325,6 @@ conf_data.set('WSCONS_SUPPORT', supports_wscons ? '1' : false)
conf_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess') ? '1' : false)
conf_data.set('XSERVER_PLATFORM_BUS', build_udev_kms ? '1' : false)
configure_file(output : 'dix-config.h',
configuration : conf_data)
configure_file(output : 'xorg-server.h',
input : 'xorg-server.h.meson.in',
configuration : conf_data,
install: build_xorg,
install_dir: xorgsdkdir)
version_data = configuration_data()
version_data.set('VENDOR_RELEASE', '@0@'.format(release))
version_data.set_quoted('VENDOR_NAME', get_option('vendor_name'))

View File

@ -324,14 +324,6 @@ extern _X_EXPORT int
timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
/* Logging. */
typedef enum _LogParameter {
XLOG_FLUSH,
XLOG_SYNC,
XLOG_VERBOSITY,
XLOG_FILE_VERBOSITY
} LogParameter;
/* Flags for log messages. */
typedef enum {
X_PROBED, /* Value was probed */
@ -348,20 +340,6 @@ typedef enum {
X_UNKNOWN = -1 /* unknown -- this must always be last */
} MessageType;
extern _X_EXPORT const char *
LogInit(const char *fname, const char *backup);
extern void
LogSetDisplay(void);
extern _X_EXPORT void
LogClose(enum ExitCode error);
extern _X_EXPORT Bool
LogSetParameter(LogParameter param, int value);
extern _X_EXPORT void
LogVWrite(int verb, const char *f, va_list args)
_X_ATTRIBUTE_PRINTF(2, 0);
extern _X_EXPORT void
LogWrite(int verb, const char *f, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(3, 0);
@ -378,7 +356,7 @@ extern _X_EXPORT void
LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(3, 0);
extern _X_EXPORT void
void
LogVHdrMessageVerb(MessageType type, int verb,
const char *msg_format, va_list msg_args,
const char *hdr_format, va_list hdr_args)
@ -390,23 +368,12 @@ LogHdrMessageVerb(MessageType type, int verb,
const char *hdr_format, ...)
_X_ATTRIBUTE_PRINTF(3, 0)
_X_ATTRIBUTE_PRINTF(5, 6);
extern _X_EXPORT void
LogHdrMessage(MessageType type, const char *msg_format,
va_list msg_args, const char *hdr_format, ...)
_X_ATTRIBUTE_PRINTF(2, 0)
_X_ATTRIBUTE_PRINTF(4, 5);
extern _X_EXPORT void
FatalError(const char *f, ...)
_X_ATTRIBUTE_PRINTF(1, 2)
_X_NORETURN;
#ifdef DEBUG
#define DebugF ErrorF
#else
#define DebugF(...) /* */
#endif
extern _X_EXPORT void
VErrorF(const char *f, va_list args)
_X_ATTRIBUTE_PRINTF(1, 0);
@ -419,7 +386,7 @@ _X_ATTRIBUTE_PRINTF(1, 0);
extern _X_EXPORT void
ErrorFSigSafe(const char *f, ...)
_X_ATTRIBUTE_PRINTF(1, 2);
extern _X_EXPORT void
void
LogPrintMarkers(void);
extern _X_EXPORT void

View File

@ -907,3 +907,14 @@ if build_docs or build_docs_devel
configuration: docxmlconfig
)
endif
# finally write config files. doing that very late, so other subdirs still
# have a change to add config items
configure_file(output : 'dix-config.h',
configuration : conf_data)
configure_file(output : 'xorg-server.h',
input : 'include/xorg-server.h.meson.in',
configuration : conf_data,
install: build_xorg,
install_dir: xorgsdkdir)

View File

@ -85,6 +85,7 @@
#endif
#include "os/auth.h"
#include "os/log_priv.h"
/**
* Try to determine a PID for a client from its connection

32
os/cmdline.c Normal file
View File

@ -0,0 +1,32 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* @brief command line helper functions
*/
#include <dix-config.h>
#include <string.h>
#include <stdlib.h>
#include "os/cmdline.h"
int ProcessCmdLineMultiInt(int argc, char *argv[], int *idx, const char* name, int *value)
{
if (strcmp(argv[*idx], name))
return 0;
int i2 = *idx+1;
if (i2 < argc && argv[i2]) {
char *end;
long val = strtol(argv[i2], &end, 0);
if (*end == '\0') {
(*idx)++;
(*value) = val;
return 1;
}
}
(*value)++;
return 1;
}

View File

@ -17,4 +17,19 @@ void UseMsg(void);
void ProcessCommandLine(int argc, char * argv[]);
void CheckUserParameters(int argc, char **argv, char **envp);
/*
* @brief check for and parse an counting-flag or value-flag option
*
* Parses an option that may either be used for setting an integer value or
* given one or multiple times (without argument) to increase an value
*
* @param argc total number of elements in argv
* @param argv array of pointers to cmdline argument strings
* @param idx pointer to current index in argv -- eventually will be modified
* @param name the command line argument name
* @param value pointer to the field holding the setting value
* @return non-zero if the flag was found and parsed
*/
int ProcessCmdLineMultiInt(int argc, char *argv[], int *idx, const char* name, int *value);
#endif /* _XSERVER_OS_CMELINE_H */

View File

@ -99,6 +99,7 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "misc.h" /* for typedef of pointer */

View File

@ -37,6 +37,7 @@
#include "dix/input_priv.h"
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "inputstr.h"
#include "opaque.h"

203
os/log.c
View File

@ -75,9 +75,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <errno.h>
#include <stdio.h>
@ -88,11 +86,16 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xfuncproto.h>
#include <X11/Xos.h>
#ifdef CONFIG_SYSLOG
#include <syslog.h>
#endif
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "os/audit.h"
#include "os/ddx_priv.h"
#include "os/fmt.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "opaque.h"
@ -113,19 +116,18 @@ OR PERFORMANCE OF THIS SOFTWARE.
void (*OsVendorVErrorFProc) (const char *, va_list args) = NULL;
/* Default logging parameters. */
#ifndef DEFAULT_LOG_VERBOSITY
#define DEFAULT_LOG_VERBOSITY 0
#endif
#ifndef DEFAULT_LOG_FILE_VERBOSITY
#define DEFAULT_LOG_FILE_VERBOSITY 3
#endif
#define DEFAULT_SYSLOG_VERBOSITY 0
static FILE *logFile = NULL;
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;
Bool xorgLogSync = FALSE;
int xorgLogVerbosity = DEFAULT_LOG_VERBOSITY;
int xorgLogFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY;
#ifdef CONFIG_SYSLOG
int xorgSyslogVerbosity = DEFAULT_SYSLOG_VERBOSITY;
const char *xorgSyslogIdent = "X";
#endif
/* Buffer to information logged before the log file is opened. */
static char *saveBuffer = NULL;
@ -141,42 +143,18 @@ asm(".desc ___crashreporter_info__, 0x10");
#endif
/* Prefix strings for log messages. */
#ifndef X_UNKNOWN_STRING
#define X_UNKNOWN_STRING "(\?\?)"
#endif
#ifndef X_PROBE_STRING
#define X_PROBE_STRING "(--)"
#endif
#ifndef X_CONFIG_STRING
#define X_CONFIG_STRING "(**)"
#endif
#ifndef X_DEFAULT_STRING
#define X_DEFAULT_STRING "(==)"
#endif
#ifndef X_CMDLINE_STRING
#define X_CMDLINE_STRING "(++)"
#endif
#ifndef X_NOTICE_STRING
#define X_NOTICE_STRING "(!!)"
#endif
#ifndef X_ERROR_STRING
#define X_ERROR_STRING "(EE)"
#endif
#ifndef X_WARNING_STRING
#define X_WARNING_STRING "(WW)"
#endif
#ifndef X_INFO_STRING
#define X_INFO_STRING "(II)"
#endif
#ifndef X_NOT_IMPLEMENTED_STRING
#define X_NOT_IMPLEMENTED_STRING "(NI)"
#endif
#ifndef X_DEBUG_STRING
#define X_DEBUG_STRING "(DB)"
#endif
#ifndef X_NONE_STRING
#define X_NONE_STRING ""
#endif
static size_t
strlen_sigsafe(const char *s)
@ -235,6 +213,24 @@ LogFilePrep(const char *fname, const char *backup, const char *idstring)
}
#pragma GCC diagnostic pop
static inline void doLogSync(void) {
#ifndef WIN32
fsync(logFileFd);
#endif
}
static void initSyslog(void) {
#ifdef CONFIG_SYSLOG
char buffer[4096];
strcpy(buffer, xorgSyslogIdent);
snprintf(buffer, sizeof(buffer), "%s :%s", xorgSyslogIdent, (display ? display : "<>"));
/* initialize syslog */
openlog(buffer, LOG_PID, LOG_LOCAL1);
#endif
}
/*
* LogInit is called to start logging to a file. It is also called (with
* NULL arguments) when logging to a file is not wanted. It must always be
@ -270,19 +266,14 @@ LogInit(const char *fname, const char *backup)
saved_log_backup = strdup(backup);
} else
logFileName = LogFilePrep(fname, backup, display);
if ((logFile = fopen(logFileName, "w")) == NULL)
FatalError("Cannot open log file \"%s\"\n", logFileName);
setvbuf(logFile, NULL, _IONBF, 0);
logFileFd = fileno(logFile);
if ((logFileFd = open(logFileName, O_WRONLY | O_CREAT)) == -1)
FatalError("Cannot open log file \"%s\": %s\n", logFileName, strerror(errno));
/* Flush saved log information. */
if (saveBuffer && bufferSize > 0) {
fwrite(saveBuffer, bufferPos, 1, logFile);
fflush(logFile);
#ifndef WIN32
fsync(fileno(logFile));
#endif
write(logFileFd, saveBuffer, bufferPos);
doLogSync();
}
}
@ -297,6 +288,7 @@ LogInit(const char *fname, const char *backup)
}
needBuffer = FALSE;
initSyslog();
return logFileName;
}
@ -328,44 +320,23 @@ LogSetDisplay(void)
free(saved_log_fname);
free(saved_log_backup);
}
initSyslog();
}
void
LogClose(enum ExitCode error)
{
if (logFile) {
if (logFileFd != -1) {
int msgtype = (error == EXIT_NO_ERROR) ? X_INFO : X_ERROR;
LogMessageVerbSigSafe(msgtype, -1,
"Server terminated %s (%d). Closing log file.\n",
(error == EXIT_NO_ERROR) ? "successfully" : "with error",
error);
fclose(logFile);
logFile = NULL;
close(logFileFd);
logFileFd = -1;
}
}
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;
case XLOG_VERBOSITY:
logVerbosity = value;
return TRUE;
case XLOG_FILE_VERBOSITY:
logFileVerbosity = value;
return TRUE;
default:
return FALSE;
}
}
enum {
LMOD_LONG = 0x1,
LMOD_LONGLONG = 0x2,
@ -596,6 +567,19 @@ pnprintf(char *string, int size, const char *f, ...)
return rc;
}
static void
LogSyslogWrite(int verb, const char *buf, size_t len, Bool end_line) {
#ifdef CONFIG_SYSLOG
if (inSignalContext) // syslog() ins't signal-safe yet :(
return; // shall we try syslog(2) syscall instead ?
if (verb >= 0 && xorgSyslogVerbosity < verb)
return;
syslog(LOG_PID, "%.*s", (int)len, buf);
#endif
}
/* This function does the actual log message writes. It must be signal safe.
* When attempting to call non-signal-safe functions, guard them with a check
* of the inSignalContext global variable. */
@ -605,18 +589,18 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
static Bool newline = TRUE;
int ret;
if (verb < 0 || logVerbosity >= verb)
LogSyslogWrite(verb, buf, len, end_line);
if (verb < 0 || xorgLogVerbosity >= verb)
ret = write(2, buf, len);
if (verb < 0 || logFileVerbosity >= verb) {
if (verb < 0 || xorgLogFileVerbosity >= verb) {
if (inSignalContext && logFileFd >= 0) {
ret = write(logFileFd, buf, len);
#ifndef WIN32
if (logFlush && logSync)
fsync(logFileFd);
#endif
if (xorgLogSync)
doLogSync();
}
else if (!inSignalContext && logFile) {
else if (!inSignalContext && logFileFd != -1) {
if (newline) {
time_t t = time(NULL);
struct tm tm;
@ -627,19 +611,13 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
#else
localtime_r(&t, &tm);
#endif
strftime(fmt_tm, sizeof(fmt_tm) - 1, "%Y-%m-%d %H:%M:%S", &tm);
fprintf(logFile, "[%s] ", fmt_tm);
strftime(fmt_tm, sizeof(fmt_tm) - 1, "[%Y-%m-%d %H:%M:%S] ", &tm);
write(logFileFd, fmt_tm, strlen(fmt_tm));
}
newline = end_line;
fwrite(buf, len, 1, logFile);
if (logFlush) {
fflush(logFile);
#ifndef WIN32
if (logSync)
fsync(fileno(logFile));
#endif
}
write(logFileFd, buf, len);
if (xorgLogSync)
doLogSync();
}
else if (!inSignalContext && needBuffer) {
if (len > bufferUnused) {
@ -661,22 +639,6 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
(void) ret;
}
void
LogVWrite(int verb, const char *f, va_list args)
{
return LogVMessageVerb(X_NONE, verb, f, args);
}
void
LogWrite(int verb, const char *f, ...)
{
va_list args;
va_start(args, f);
LogVWrite(verb, f, args);
va_end(args);
}
/* Returns the Message Type string to prepend to a logging message, or NULL
* if the message will be dropped due to insufficient verbosity. */
static const char *
@ -685,7 +647,7 @@ LogMessageTypeVerbString(MessageType type, int verb)
if (type == X_ERROR)
verb = 0;
if (logVerbosity < verb && logFileVerbosity < verb)
if (xorgLogVerbosity < verb && xorgLogFileVerbosity < verb)
return NULL;
switch (type) {
@ -866,37 +828,6 @@ LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
va_end(hdr_args);
}
void
LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args,
const char *hdr_format, ...)
{
va_list hdr_args;
va_start(hdr_args, hdr_format);
LogVHdrMessageVerb(type, 1, msg_format, msg_args, hdr_format, hdr_args);
va_end(hdr_args);
}
void
AbortServer(void)
_X_NORETURN;
void
AbortServer(void)
{
#ifdef XF86BIGFONT
XF86BigfontCleanup();
#endif
CloseWellKnownConnections();
OsCleanup(TRUE);
AbortDevices();
ddxGiveUp(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
OsAbort();
exit(1);
}
#define AUDIT_PREFIX "AUDIT: %s: %ld: "
#ifndef AUDIT_TIMEOUT
#define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */
@ -1045,7 +976,7 @@ VErrorF(const char *f, va_list args)
if (OsVendorVErrorFProc)
OsVendorVErrorFProc(f, args);
else
LogVWrite(-1, f, args);
LogVMessageVerb(X_NONE, -1, f, args);
}
void
@ -1078,7 +1009,7 @@ void
LogPrintMarkers(void)
{
/* Show what the message marker symbols mean. */
LogWrite(0, "Markers: ");
LogMessageVerb(X_NONE, 0, "Markers: ");
LogMessageVerb(X_PROBED, 0, "probed, ");
LogMessageVerb(X_CONFIG, 0, "from config file, ");
LogMessageVerb(X_DEFAULT, 0, "default setting,\n\t");

92
os/log_priv.h Normal file
View File

@ -0,0 +1,92 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef __XORG_OS_LOGGING_H
#define __XORG_OS_LOGGING_H
#include "include/os.h"
/**
* @brief initialize logging and open log files
*
* Make backup of existing log file, create a new one and open it for logging.
*
* - May be called with NULL or "", if no logging is desired.
*
* - Must always be called, otherwise log messages will fill up the buffer and
* let it grow infinitely.
*
* - if "%s" is present in fname, it will be replaced with the display string or pid
*
* @param fname log file name template. if NULL, dont write any log.
* @param backup name for the old logfile.
* @return new log file name
*/
const char* LogInit(const char *fname, const char *backup);
/**
* @brief rename the current log file according display name
*
* Renames the current log file with per display prefix (e.g. "Xorg.log.0")
*
*/
void LogSetDisplay(void);
/**
* @brief log exit code, then flush and close log file and write
*
* Logs the exit code (and success/error state), then flush and close log file.
*/
void LogClose(enum ExitCode error);
#ifdef DEBUG
/**
* @brief log debug messages (like errors) if symbol DEBUG is defined
*/
#define DebugF ErrorF
#else
#define DebugF(...) /* */
#endif
/**
* @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 xorgLogVerbosity;
/**
* @brief log file verbosity
*
* The verbosity level of logging to per-display file. All messages with
* verbosity level below this one will be written to the log file.
*/
extern int xorgLogFileVerbosity;
/**
* @brief force fsync() on each log write
*
* If set to TRUE, force fsync() on each log write.
*/
extern Bool xorgLogSync;
/**
* @brief syslog verbosity
*
* The verbosity level of logging to syslog. All messages with
* verbosity level below this one will be sent to local syslog daemon.
*/
extern int xorgSyslogVerbosity;
/**
* @brief syslog identifier
*
* The identifier prefix used for syslog logging.
* Per default will be filled with basename(argv[0]). DDX'es can override
* this before calling LogInit()
*/
extern const char *xorgSyslogIdent;
#endif /* __XORG_OS_LOGGING_H */

View File

@ -5,6 +5,7 @@ srcs_os = [
'auth.c',
'backtrace.c',
'client.c',
'cmdline.c',
'connection.c',
'fmt.c',
'inputthread.c',
@ -22,6 +23,8 @@ srcs_os = [
'log.c',
]
conf_data.set('CONFIG_SYSLOG', cc.has_header('syslog.h') ? '1' : false)
# Wrapper code for missing C library functions. Note that conf_data contains either '1' or false.
srcs_libc = []
if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0

View File

@ -189,6 +189,7 @@ void OsBlockSignals(void);
void OsReleaseSignals(void);
void OsResetSignals(void);
void OsAbort(void) _X_NORETURN;
void AbortServer(void) _X_NORETURN;
void MakeClientGrabPervious(ClientPtr client);
void MakeClientGrabImpervious(ClientPtr client);

View File

@ -62,6 +62,7 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "os/busfault.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "os/serverlock.h"

View File

@ -79,7 +79,7 @@ __stdcall unsigned long GetTickCount(void);
#define TRANS_REOPEN
#include <X11/Xtrans/Xtrans.h>
#include "os/audit.h"
#include <libgen.h>
#include "input.h"
#include "dixfont.h"
@ -107,9 +107,11 @@ __stdcall unsigned long GetTickCount(void);
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/cmdline.h"
#include "os/ddx_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "os/serverlock.h"
@ -498,6 +500,12 @@ ProcessCommandLine(int argc, char *argv[])
}
SeatId = getenv("XDG_SEAT");
#ifdef CONFIG_SYSLOG
xorgSyslogIdent = getenv("SYSLOG_IDENT");
if (!xorgSyslogIdent)
xorgSyslogIdent = strdup(basename(argv[0]));
#endif
for (i = 1; i < argc; i++) {
/* call ddx first, so it can peek/override if it wants */
if ((skip = ddxProcessArgument(argc, argv, i))) {
@ -867,6 +875,9 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
#ifdef CONFIG_SYSLOG
else if (ProcessCmdLineMultiInt(argc, argv, &i, "-syslogverbose", &xorgSyslogVerbosity));
#endif
else {
ErrorF("Unrecognized option: %s\n", argv[i]);
UseMsg();
@ -1602,3 +1613,19 @@ os_move_fd(int fd)
return newfd;
}
#endif
void
AbortServer(void)
{
#ifdef XF86BIGFONT
XF86BigfontCleanup();
#endif
CloseWellKnownConnections();
OsCleanup(TRUE);
AbortDevices();
ddxGiveUp(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
OsAbort();
exit(1);
}

View File

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

View File

@ -31,9 +31,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include "os/log_priv.h"
#include "misc.h"
#include "inputstr.h"
#include <X11/keysym.h>
#include <xkbsrv.h>
/***====================================================================***/

View File

@ -41,6 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKM.h>
#include "dix/dix_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "inputstr.h"

View File

@ -42,6 +42,9 @@
#include <X11/Xfuncs.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include "os/log_priv.h"
#include "misc.h"
#include "inputstr.h"
#include "dix.h"

View File

@ -39,6 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "exglobals.h"

View File

@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "os/log_priv.h"
#include "inputstr.h"
#include "exglobals.h"

View File

@ -42,6 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKMformat.h>
#include "os/cmdline.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "misc.h"

View File

@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include "dix/input_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "misc.h"

View File

@ -60,6 +60,7 @@ DEALINGS IN THE SOFTWARE.
#define XK_CYRILLIC
#include <X11/keysym.h>
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "os.h"

View File

@ -32,11 +32,13 @@
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include <X11/extensions/XKMformat.h>
#include "os/log_priv.h"
#include "misc.h"
#include "inputstr.h"
#include "xkbstr.h"