aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/log.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-08 14:33:00 +0200
committermarha <marha@users.sourceforge.net>2014-06-08 14:33:00 +0200
commit2acb86c9b086bdb9a3897db0b93820652e07cb59 (patch)
tree02a43a0005c991c736f03de9a1c8ba98f0bbdf28 /xorg-server/os/log.c
parent816a5430313e07083c5325f0a430126a2e10ec41 (diff)
downloadvcxsrv-2acb86c9b086bdb9a3897db0b93820652e07cb59.tar.gz
vcxsrv-2acb86c9b086bdb9a3897db0b93820652e07cb59.tar.bz2
vcxsrv-2acb86c9b086bdb9a3897db0b93820652e07cb59.zip
xwininfo libX11 mesa mkfontscale xserver git updated 8 June 2014
xserver commit e27a839bf0488d5b1cc2e2a887f2ea0e3d790790 libxcb commit d978a4f69b30b630f28d07f1003cf290284d24d8 libxcb/xcb-proto commit 389889e2f95af19e7fc7ac89e7faeb2f28652415 xkeyboard-config commit bc3ac1b0d152e929b3532a541596cf9fe286bb9e libX11 commit d81fed46144d089bdfa1d916a28dffc9ebffe1e4 libXdmcp commit fe8eab93e9bcdbe8bb8052434bb5e676e3a0ee8f libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 pixman commit 9cd283b2eb8279824406bfd47b020d21fc00cf82 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit 48e541dc2f2fc3f4e99d3e168c28241ff5adff4d xwininfo commit 017b3736489985999d8dcf4d9e473e1fd6dd3647 libXft commit 214f9b5306d833e2787c75fe41dfdc9228fcb738 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit a57a7f62242e1ea972b81414741729bf3dbae0a4 fontconfig commit f44bfad235e63bb792c38e16ae1fbd281ec1453b mesa commit eb58aa9cf015e79a0fcf2e088676e6aa1d5dabce
Diffstat (limited to 'xorg-server/os/log.c')
-rw-r--r--xorg-server/os/log.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index a0f2a81f3..a368569d0 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -342,7 +342,7 @@ out:
* which directives you use.
*/
static int
-pnprintf(char *string, size_t size, const char *f, va_list args)
+vpnprintf(char *string, int size_in, const char *f, va_list args)
{
int f_idx = 0;
int s_idx = 0;
@@ -353,6 +353,7 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
int i;
uint64_t ui;
int64_t si;
+ size_t size = size_in;
for (; f_idx < f_len && s_idx < size - 1; f_idx++) {
int length_modifier = 0;
@@ -484,6 +485,19 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
return s_idx;
}
+static int
+pnprintf(char *string, int size, const char *f, ...)
+{
+ int rc;
+ va_list args;
+
+ va_start(args, f);
+ rc = vpnprintf(string, size, f, args);
+ va_end(args);
+
+ return rc;
+}
+
/* 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. */
@@ -597,7 +611,6 @@ LogMessageTypeVerbString(MessageType type, int verb)
void
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
{
- static unsigned int warned;
const char *type_str;
char buf[1024];
const size_t size = sizeof(buf);
@@ -605,17 +618,8 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
size_t len = 0;
if (inSignalContext) {
- if (warned < 3) {
- BUG_WARN_MSG(inSignalContext,
- "Warning: attempting to log data in a signal unsafe "
- "manner while in signal context.\nPlease update to check "
- "inSignalContext and/or use LogMessageVerbSigSafe() or "
- "ErrorFSigSafe().\nThe offending log format message is:\n"
- "%s\n", format);
- warned++;
- if (warned == 3)
- LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned);
- }
+ LogVMessageVerbSigSafe(type, verb, format, args);
+ return;
}
type_str = LogMessageTypeVerbString(type, verb);
@@ -687,7 +691,7 @@ LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list a
LogSWrite(verb, " ", 1, FALSE);
}
- len = pnprintf(buf, sizeof(buf), format, args);
+ len = vpnprintf(buf, sizeof(buf), format, args);
/* Force '\n' at end of truncated line */
if (sizeof(buf) - len == 1)
@@ -701,40 +705,37 @@ void
LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
va_list msg_args, const char *hdr_format, va_list hdr_args)
{
- static unsigned int warned;
const char *type_str;
char buf[1024];
const size_t size = sizeof(buf);
Bool newline;
size_t len = 0;
-
- if (inSignalContext) {
- if (warned < 3) {
- BUG_WARN_MSG(inSignalContext,
- "Warning: attempting to log data in a signal unsafe "
- "manner while in signal context.\nPlease update to check "
- "inSignalContext and/or use LogMessageVerbSigSafe().\nThe "
- "offending header and log message formats are:\n%s %s\n",
- hdr_format, msg_format);
- warned++;
- if (warned == 3)
- LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned);
- }
- }
+ int (*vprintf_func)(char *, int, const char* _X_RESTRICT_KYWD f, va_list args)
+ _X_ATTRIBUTE_PRINTF(3, 0);
+ int (*printf_func)(char *, int, const char* _X_RESTRICT_KYWD f, ...)
+ _X_ATTRIBUTE_PRINTF(3, 4);
type_str = LogMessageTypeVerbString(type, verb);
if (!type_str)
return;
+ if (inSignalContext) {
+ vprintf_func = vpnprintf;
+ printf_func = pnprintf;
+ } else {
+ vprintf_func = Xvscnprintf;
+ printf_func = Xscnprintf;
+ }
+
/* if type_str is not "", prepend it and ' ', to message */
if (type_str[0] != '\0')
- len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
+ len += printf_func(&buf[len], size - len, "%s ", type_str);
if (hdr_format && size - len > 1)
- len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args);
+ len += vprintf_func(&buf[len], size - len, hdr_format, hdr_args);
if (msg_format && size - len > 1)
- len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args);
+ len += vprintf_func(&buf[len], size - len, msg_format, msg_args);
/* Force '\n' at end of truncated line */
if (size - len == 1)