Fix "start -- vt7" not working fix breaking headless setups (#1203780)
This commit is contained in:
parent
56c41c9e82
commit
4f12635721
@ -1,7 +1,8 @@
|
||||
From cd7063aa899b56d407b57eab06b51925c913399d Mon Sep 17 00:00:00 2001
|
||||
From 92bc12b7085ff80d4f5a2389b5a00cda501e27c7 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 21 Jan 2015 09:31:39 +0100
|
||||
Subject: [PATCH 1/2] linux: Add linux_get_vtno and linux_get_keeptty helpers
|
||||
Subject: [PATCH v2 1/3] linux: Add linux_parse_vt_settings and
|
||||
linux_get_keeptty helpers
|
||||
|
||||
systemd-logind integration does not work when starting X on a new tty, as
|
||||
that detaches X from the current session and after hat systemd-logind revokes
|
||||
@ -24,13 +25,17 @@ these can be called earlier. Calling this earlier is safe as this code has
|
||||
no side effects other than setting xf86Info.vtno and keepTty.
|
||||
|
||||
Note this basically only moves a large chunk of xf86OpenConsole() into
|
||||
linux_get_vtno() without changing a single line of it, this is hard to see
|
||||
in the diff because the identation level has changed.
|
||||
linux_parse_vt_settings() without changing a single line of it, this is
|
||||
hard to see in the diff because the identation level has changed.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
---
|
||||
Changes in v2:
|
||||
-Rename linux_get_vtno to linux_parse_vt_settings
|
||||
Changes in v3:
|
||||
-Carry the rename of linux_get_vtno to linux_parse_vt_settings over into
|
||||
the commit msg
|
||||
---
|
||||
hw/xfree86/os-support/linux/linux.h | 32 +++++++++
|
||||
hw/xfree86/os-support/linux/lnx_init.c | 122 ++++++++++++++++++++-------------
|
||||
@ -232,5 +237,5 @@ index 9485307..22c61bf 100644
|
||||
if (!KeepTty) {
|
||||
pid_t ppid = getppid();
|
||||
--
|
||||
2.3.6
|
||||
2.4.0
|
||||
|
121
0002-linux-Add-a-may_fail-paramter-to-linux_parse_vt_sett.patch
Normal file
121
0002-linux-Add-a-may_fail-paramter-to-linux_parse_vt_sett.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From 4237375e8c159ce95ec77868f74edacc896f8714 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 13 May 2015 13:17:09 +0200
|
||||
Subject: [PATCH v2 2/3] linux: Add a may_fail paramter to
|
||||
linux_parse_vt_settings
|
||||
|
||||
linux_parse_vt_settings() was split out of xf86OpenConsole so that it can
|
||||
be called earlier during systemd-logind init, but it is possible to run
|
||||
the xserver in such a way that xf86OpenConsole() is never used.
|
||||
|
||||
The FatalError calls in linux_parse_vt_settings() may stop the Xorg xserver
|
||||
from working when e.g. no /dev/tty0 is present in such a setup.
|
||||
|
||||
This commit adds a may_fail parameter to linux_parse_vt_settings() which
|
||||
can be used to make linux_parse_vt_settings() fail silenty with an error
|
||||
return in this case, rather then calling FatalError().
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
hw/xfree86/os-support/linux/linux.h | 2 +-
|
||||
hw/xfree86/os-support/linux/lnx_init.c | 29 +++++++++++++++++++++--------
|
||||
2 files changed, 22 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/os-support/linux/linux.h b/hw/xfree86/os-support/linux/linux.h
|
||||
index 8cb8e3d..83506fd 100644
|
||||
--- a/hw/xfree86/os-support/linux/linux.h
|
||||
+++ b/hw/xfree86/os-support/linux/linux.h
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef XF86_LINUX_H
|
||||
#define XF86_LINUX_H
|
||||
|
||||
-void linux_parse_vt_settings(void);
|
||||
+int linux_parse_vt_settings(int may_fail);
|
||||
int linux_get_keeptty(void);
|
||||
|
||||
#endif
|
||||
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
|
||||
index 22c61bf..12ddf91 100644
|
||||
--- a/hw/xfree86/os-support/linux/lnx_init.c
|
||||
+++ b/hw/xfree86/os-support/linux/lnx_init.c
|
||||
@@ -80,8 +80,8 @@ switch_to(int vt, const char *from)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
-void
|
||||
-linux_parse_vt_settings(void)
|
||||
+int
|
||||
+linux_parse_vt_settings(int may_fail)
|
||||
{
|
||||
int i, fd = -1, ret, current_vt = -1;
|
||||
struct vt_stat vts;
|
||||
@@ -93,7 +93,7 @@ linux_parse_vt_settings(void)
|
||||
static int vt_settings_parsed = 0;
|
||||
|
||||
if (vt_settings_parsed)
|
||||
- return;
|
||||
+ return 1;
|
||||
|
||||
/*
|
||||
* setup the virtual terminal manager
|
||||
@@ -110,24 +110,36 @@ linux_parse_vt_settings(void)
|
||||
i++;
|
||||
}
|
||||
|
||||
- if (fd < 0)
|
||||
+ if (fd < 0) {
|
||||
+ if (may_fail)
|
||||
+ return 0;
|
||||
FatalError("parse_vt_settings: Cannot open /dev/tty0 (%s)\n",
|
||||
strerror(errno));
|
||||
+ }
|
||||
|
||||
if (xf86Info.ShareVTs) {
|
||||
SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
|
||||
- if (ret < 0)
|
||||
+ if (ret < 0) {
|
||||
+ if (may_fail)
|
||||
+ return 0;
|
||||
FatalError("parse_vt_settings: Cannot find the current"
|
||||
" VT (%s)\n", strerror(errno));
|
||||
+ }
|
||||
xf86Info.vtno = vts.v_active;
|
||||
}
|
||||
else {
|
||||
SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
|
||||
- if (ret < 0)
|
||||
+ if (ret < 0) {
|
||||
+ if (may_fail)
|
||||
+ return 0;
|
||||
FatalError("parse_vt_settings: Cannot find a free VT: "
|
||||
"%s\n", strerror(errno));
|
||||
- if (xf86Info.vtno == -1)
|
||||
+ }
|
||||
+ if (xf86Info.vtno == -1) {
|
||||
+ if (may_fail)
|
||||
+ return 0;
|
||||
FatalError("parse_vt_settings: Cannot find a free VT\n");
|
||||
+ }
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
@@ -151,6 +163,7 @@ linux_parse_vt_settings(void)
|
||||
}
|
||||
|
||||
vt_settings_parsed = 1;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -168,7 +181,7 @@ xf86OpenConsole(void)
|
||||
const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
|
||||
|
||||
if (serverGeneration == 1) {
|
||||
- linux_parse_vt_settings();
|
||||
+ linux_parse_vt_settings(FALSE);
|
||||
|
||||
if (!KeepTty) {
|
||||
pid_t ppid = getppid();
|
||||
--
|
||||
2.4.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 4c5a293c20394bad6abb695aaa0d8ef374ed1080 Mon Sep 17 00:00:00 2001
|
||||
From 816c85d0e8fc517db3382bce4a94bc5d859b3eca Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 21 Jan 2015 10:13:20 +0100
|
||||
Subject: [PATCH 2/2] systemd-logind: Only use systemd-logind integration
|
||||
Subject: [PATCH v2 3/3] systemd-logind: Only use systemd-logind integration
|
||||
together with keeptty
|
||||
|
||||
systemd-logind integration does not work when starting X on a new tty, as
|
||||
@ -16,13 +16,22 @@ not using KeepTty, or iow we may only use systemd-logind integration together
|
||||
with KeepTty.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
---
|
||||
Changes in v2:
|
||||
-Document that -keeptty must be passed for logind integration in man page
|
||||
-Print an INFO message when disabling logind integration due to -keeptty
|
||||
not being set
|
||||
Changes in v3:
|
||||
-Fix typo in manpage additions
|
||||
-Use new may_fail parameter to linux_parse_vt_settings
|
||||
---
|
||||
hw/xfree86/man/Xorg.man | 6 +++---
|
||||
hw/xfree86/os-support/linux/systemd-logind.c | 9 +++++++++
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
hw/xfree86/os-support/linux/systemd-logind.c | 8 ++++++++
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
|
||||
index 3ff6aef..0864a58 100644
|
||||
index 3ff6aef..ddf1358 100644
|
||||
--- a/hw/xfree86/man/Xorg.man
|
||||
+++ b/hw/xfree86/man/Xorg.man
|
||||
@@ -271,9 +271,9 @@ is ignored if
|
||||
@ -34,12 +43,12 @@ index 3ff6aef..0864a58 100644
|
||||
-support (or can use) this option.
|
||||
+Prevent the server from detaching its initial controlling terminal. If you
|
||||
+want to use systemd-logind integration you must specify this option.
|
||||
+Not all platorms support (or can use) this option.
|
||||
+Not all platforms support (or can use) this option.
|
||||
.TP 8
|
||||
.BI \-keyboard " keyboard-name"
|
||||
Use the xorg.conf(__filemansuffix__) file
|
||||
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
|
||||
index 4ad41a3..72f1ae3 100644
|
||||
index 4ad41a3..69e2f67 100644
|
||||
--- a/hw/xfree86/os-support/linux/systemd-logind.c
|
||||
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
|
||||
@@ -34,6 +34,7 @@
|
||||
@ -50,12 +59,11 @@ index 4ad41a3..72f1ae3 100644
|
||||
#include "xf86.h"
|
||||
#include "xf86platformBus.h"
|
||||
#include "xf86Xinput.h"
|
||||
@@ -596,6 +597,14 @@ static struct dbus_core_hook core_hook = {
|
||||
@@ -596,6 +597,13 @@ static struct dbus_core_hook core_hook = {
|
||||
int
|
||||
systemd_logind_init(void)
|
||||
{
|
||||
+ linux_parse_vt_settings();
|
||||
+ if (!linux_get_keeptty()) {
|
||||
+ if (linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
|
||||
+ LogMessage(X_INFO,
|
||||
+ "systemd-logind: logind integration requires -keeptty and "
|
||||
+ "-keeptty was not provided, disabling logind integration\n");
|
||||
@ -66,5 +74,5 @@ index 4ad41a3..72f1ae3 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.3.6
|
||||
2.4.0
|
||||
|
@ -45,7 +45,7 @@
|
||||
Summary: X.Org X11 X server
|
||||
Name: xorg-x11-server
|
||||
Version: 1.17.1
|
||||
Release: 11%{?gitdate:.%{gitdate}}%{dist}
|
||||
Release: 12%{?gitdate:.%{gitdate}}%{dist}
|
||||
URL: http://www.x.org
|
||||
License: MIT
|
||||
Group: User Interface/X
|
||||
@ -113,11 +113,12 @@ Patch10002: 0001-int10-Fix-mapping-the-interrupt-vector.patch
|
||||
Patch10003: 0001-include-Fix-endianness-setup.patch
|
||||
|
||||
# rhbz1203780, submitted upstream
|
||||
Patch10004: 0001-linux-Add-linux_get_vtno-and-linux_get_keeptty-helpe.patch
|
||||
Patch10005: 0002-systemd-logind-Only-use-systemd-logind-integration-t.patch
|
||||
Patch10004: 0001-linux-Add-linux_parse_vt_settings-and-linux_get_keep.patch
|
||||
Patch10005: 0002-linux-Add-a-may_fail-paramter-to-linux_parse_vt_sett.patch
|
||||
Patch10006: 0003-systemd-logind-Only-use-systemd-logind-integration-t.patch
|
||||
|
||||
# rhbz1205725, submitted upstream
|
||||
Patch10006: 0001-modesetting-Fix-software-cursor-fallback.patch
|
||||
Patch10007: 0001-modesetting-Fix-software-cursor-fallback.patch
|
||||
|
||||
%global moduledir %{_libdir}/xorg/modules
|
||||
%global drimoduledir %{_libdir}/dri
|
||||
@ -652,6 +653,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 19 2015 Hans de Goede <hdegoede@redhat.com> - 1.17.1-12
|
||||
- Fix "start -- vt7" not working fix breaking headless setups (#1203780)
|
||||
|
||||
* Sat May 02 2015 Adel Gadllah <adel.gadllah@gmail.com> - 1.17.1-11
|
||||
- modesetting: Fix software cursor fallback (#1205725)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user