xserver: Branch 'server-21.1-branch'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 2 23:54:31 UTC 2021
hw/xfree86/common/xf86Init.c | 18 +++++++++++++++++-
hw/xfree86/common/xf86Priv.h | 2 ++
hw/xfree86/os-support/linux/systemd-logind.c | 3 ++-
3 files changed, 21 insertions(+), 2 deletions(-)
New commits:
commit 0ed7b1224ef17ff3d27e791e03e0d98dd6373c8a
Author: nerdopolis <bluescreen_avenger at verizon.net>
Date: Fri Oct 8 21:51:43 2021 -0400
xfree86: On Linux, while only seat0 can have TTYs, don't assmume all seat0s have TTYs
(cherry picked from commit b8c12aac651d626c5120e6e8e18b42e7528caf43)
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 2a0cfc361..361781e0e 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -85,6 +85,11 @@
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
+
+#ifdef __linux__
+#include <linux/major.h>
+#include <sys/sysmacros.h>
+#endif
#include <hotplug.h>
void (*xf86OSPMClose) (void) = NULL;
@@ -201,6 +206,17 @@ xf86PrivsElevated(void)
return PrivsElevated();
}
+Bool
+xf86HasTTYs(void)
+{
+#ifdef __linux__
+ struct stat tty0devAttributes;
+ return (stat("/dev/tty0", &tty0devAttributes) == 0 && major(tty0devAttributes.st_rdev) == TTY_MAJOR);
+#else
+ return TRUE;
+#endif
+}
+
static void
xf86AutoConfigOutputDevices(void)
{
@@ -425,7 +441,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
want_hw_access = TRUE;
/* Non-seat0 X servers should not open console */
- if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0())
+ if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0() && xf86HasTTYs())
xorgHWOpenConsole = TRUE;
}
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index dde458327..d5185d8df 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -158,6 +158,8 @@ extern _X_EXPORT Bool
xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
extern _X_EXPORT Bool
xf86PrivsElevated(void);
+extern _X_EXPORT Bool
+xf86HasTTYs(void);
#endif /* _NO_XF86_PROTOTYPES */
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 93428ba73..9f916aa7b 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -38,6 +38,7 @@
#include "xf86.h"
#include "xf86platformBus.h"
#include "xf86Xinput.h"
+#include "xf86Priv.h"
#include "globals.h"
#include "systemd-logind.h"
@@ -583,7 +584,7 @@ static struct dbus_core_hook core_hook = {
int
systemd_logind_init(void)
{
- if (!ServerIsNotSeat0() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
+ if (!ServerIsNotSeat0() && xf86HasTTYs() && 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");
More information about the xorg-commit
mailing list