fix tcflush EIO bug

This commit is contained in:
Adam Jackson 2010-08-25 11:11:10 -04:00
parent c6ce83d02a
commit dc8a7bc840
2 changed files with 41 additions and 1 deletions

View File

@ -30,7 +30,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.9.0
Release: 1%{?gitdate:.%{gitdate}}%{dist}
Release: 2%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -98,6 +98,8 @@ Patch6053: xserver-1.8-disable-vboxvideo.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=28672
Patch7000: xserver-1.8.0-no-xorg.patch
Patch7001: xserver-1.9.0-tcflush-fix.patch
%define moduledir %{_libdir}/xorg/modules
%define drimoduledir %{_libdir}/dri
%define sdkdir %{_includedir}/xorg
@ -546,6 +548,9 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
* Wed Aug 25 2010 Adam Jackson <ajax@redhat.com> 1.9.0-2
- xserver-1.9.0-tcflush-fix.patch: Fix 100% CPU usage bug.
* Mon Aug 23 2010 Peter Hutterer <peter.hutterer@redhat.com> 1.9.0-1
- xserver 1.9.0
- xserver-1.9-reset-root-null.patch: drop, upstream.

View File

@ -0,0 +1,35 @@
From 20e32420a2f75b58603eb1578c151d63e6b2e8ac Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 25 Aug 2010 11:06:38 -0400
Subject: [PATCH] linux: Fix CPU usage bug in console fd flushing
If the vt gets a vhangup from under us, then the tty will appear ready
in select(), but trying to tcflush() it will return -EIO, so we'll spin
around at 100% CPU for no reason. Notice this condition and unregister
the handler if it happens.
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
hw/xfree86/os-support/linux/lnx_init.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index c8cec2e..21f2220 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -85,7 +85,11 @@ static void *console_handler;
static void
drain_console(int fd, void *closure)
{
- tcflush(fd, TCIOFLUSH);
+ errno = 0;
+ if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
+ xf86RemoveGeneralHandler(console_handler);
+ console_handler = NULL;
+ }
}
void
--
1.7.2.1