Log mieq enqueue overflow in a signal safe manner

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Chase Douglas 2012-04-06 16:17:41 -07:00 committed by Keith Packard
parent 7f4a69b628
commit 6fd5add005

View File

@ -276,23 +276,22 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
*/ */
miEventQueue.dropped++; miEventQueue.dropped++;
if (miEventQueue.dropped == 1) { if (miEventQueue.dropped == 1) {
ErrorF ErrorFSigSafe("[mi] EQ overflowing. Additional events will be "
("[mi] EQ overflowing. Additional events will be discarded until existing events are processed.\n"); "discarded until existing events are processed.\n");
xorg_backtrace(); xorg_backtrace();
ErrorF ErrorFSigSafe("[mi] These backtraces from mieqEnqueue may point to "
("[mi] These backtraces from mieqEnqueue may point to a culprit higher up the stack.\n"); "a culprit higher up the stack.\n");
ErrorF("[mi] mieq is *NOT* the cause. It is a victim.\n"); ErrorFSigSafe("[mi] mieq is *NOT* the cause. It is a victim.\n");
} }
else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 && else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 &&
miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <=
QUEUE_DROP_BACKTRACE_MAX) { QUEUE_DROP_BACKTRACE_MAX) {
ErrorF ErrorFSigSafe("[mi] EQ overflow continuing. %u events have been "
("[mi] EQ overflow continuing. %lu events have been dropped.\n", "dropped.\n", miEventQueue.dropped);
miEventQueue.dropped);
if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY ==
QUEUE_DROP_BACKTRACE_MAX) { QUEUE_DROP_BACKTRACE_MAX) {
ErrorF ErrorFSigSafe("[mi] No further overflow reports will be "
("[mi] No further overflow reports will be reported until the clog is cleared.\n"); "reported until the clog is cleared.\n");
} }
xorg_backtrace(); xorg_backtrace();
} }