From 27fa846e34edad06669abd8cacaa0705c1490257 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 28 Jan 2021 18:13:59 +0000 Subject: [PATCH] kms: unbreak on FreeBSD In file included from src/ws/atomic_kms_window_system.cpp:23: In file included from src/ws/atomic_kms_window_system.h:25: src/ws/kms_window_system.h:33:10: fatal error: 'linux/vt.h' file not found #include ^~~~~~~~~~~~ /dev/tty0 -> Error: Failed to open active VT /dev/ttyv0 -> Error: Failed to set VT process control mode: Operation not permitted {VT_PROCESS, 0, 0, 0, 0} -> Error: Failed to set VT process control mode: Invalid argument --- src/ws/kms_window_system.cpp | 4 ++-- src/ws/kms_window_system.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ws/kms_window_system.cpp b/src/ws/kms_window_system.cpp index ca8220f..50057f6 100644 --- a/src/ws/kms_window_system.cpp +++ b/src/ws/kms_window_system.cpp @@ -251,7 +251,7 @@ ManagedResource create_gbm_device(int drm_fd) ManagedResource open_active_vt() { - auto fd = open("/dev/tty0", O_RDONLY); + auto fd = open("/dev/tty", O_RDONLY); if (fd < 0) throw std::runtime_error{"Failed to open active VT"}; @@ -281,7 +281,7 @@ VTState::VTState() errno, std::system_category(), "Failed to get VT control mode"}; } - vt_mode const vtm{VT_PROCESS, 0, 0, 0, 0}; + vt_mode const vtm{VT_PROCESS, 0, SIGUSR1, SIGUSR2, SIGIO}; if (ioctl(vt_fd, VT_SETMODE, &vtm) < 0) { diff --git a/src/ws/kms_window_system.h b/src/ws/kms_window_system.h index 4389ef7..6a3311e 100644 --- a/src/ws/kms_window_system.h +++ b/src/ws/kms_window_system.h @@ -30,7 +30,13 @@ #include #include +#if __has_include() // DragonFly, FreeBSD +#include +#elif __has_include() // NetBSD, OpenBSD +#include +#else #include +#endif class VTState {