xorg-x11-server/xorg-x11-server-1.1.1-vt-activate-is-a-terrible-api.patch
Adam Jackson eb5ef29d7a * Wed Sep 27 2006 Adam Jackson <ajackson@redhat.com> 1.1.1-43.fc6
- xorg-x11-server-1.1.1-vt-activate-is-a-terrible-api.patch: Since the
  VT_ACTIVATE/VT_WAITACTIVE pair are never guaranteed to successfully
  complete, set a 5 second timeout on the WAITACTIVE, and retry the pair
  until we win.  (#207746)
- xorg-x11-server-1.1.0-pci-scan-fixes.patch: Partial revert to unbreak some
  (but not all) domainful machines, including Pegasos. (#207659)
2006-09-28 16:38:24 +00:00

47 lines
1.6 KiB
Diff

--- xorg-server-1.1.1/hw/xfree86/os-support/linux/lnx_init.c.jx 2006-07-05 14:31:41.000000000 -0400
+++ xorg-server-1.1.1/hw/xfree86/os-support/linux/lnx_init.c 2006-09-26 17:53:04.000000000 -0400
@@ -248,14 +248,37 @@
#endif
/*
* now get the VT
+ *
+ * There's a race here, in that if someone else does a VT_ACTIVATE
+ * between our ACTIVATE/WAITACTIVE, we might never get the VT.
+ * So, just spin until we do. There's really no fixing this,
+ * it's a racy protocol.
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
- strerror(errno));
+ while (1) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
+ FatalError(X_WARNING,
+ "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
+ strerror(errno));
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
- strerror(errno));
+
+ alarm(5);
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
+ {
+ if (errno == EINTR) {
+ /* we lost the race and the alarm fired, try again */
+ xf86Msg(X_WARNING,
+ "Lost VT_WAITACTIVE race, retrying\n");
+ continue;
+ }
+
+ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
+ strerror(errno));
+ }
+ /* success, turn off the alarm */
+ alarm(0);
+
+ break;
+ }
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",