From 83927bb0e678626bcc037e6880820531d7b90a4f Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 6 Jan 2022 09:27:21 -0600 Subject: [PATCH] launcher-logind: Remove systemd-logind support Many years ago (2014) systemd-logind was brought into libsystemd. We've supported old versions of systemd-logind ever since. Let's remove support for old versions of systemd-logind before the merge for a tiny code simplification. Signed-off-by: Derek Foreman --- libweston/launcher-logind.c | 25 +------------------------ libweston/meson.build | 9 ++------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c index 3fca1dff..77f43815 100644 --- a/libweston/launcher-logind.c +++ b/libweston/launcher-logind.c @@ -695,29 +695,6 @@ launcher_logind_release_control(struct launcher_logind *wl) } } -static int -weston_sd_session_get_vt(const char *sid, unsigned int *out) -{ -#ifdef HAVE_SYSTEMD_LOGIN_209 - return sd_session_get_vt(sid, out); -#else - int r; - char *tty; - - r = sd_session_get_tty(sid, &tty); - if (r < 0) - return r; - - r = sscanf(tty, "tty%u", out); - free(tty); - - if (r != 1) - return -EINVAL; - - return 0; -#endif -} - static int launcher_logind_activate(struct launcher_logind *wl) { @@ -803,7 +780,7 @@ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor * r = sd_seat_can_tty(t); free(t); if (r > 0) { - r = weston_sd_session_get_vt(wl->sid, &wl->vtnr); + r = sd_session_get_vt(wl->sid, &wl->vtnr); if (r < 0) { weston_log("logind: session not running on a VT\n"); goto err_session; diff --git a/libweston/meson.build b/libweston/meson.build index 186ae4a5..e7afabbc 100644 --- a/libweston/meson.build +++ b/libweston/meson.build @@ -156,13 +156,8 @@ endif systemd_dep = dependency('', required: false) if get_option('launcher-logind') systemd_dep = dependency('libsystemd', version: '>= 209', required: false) - if systemd_dep.found() - config_h.set('HAVE_SYSTEMD_LOGIN_209', '1') - else - systemd_dep = dependency('libsystemd-login', version: '>= 198', required: false) - if not systemd_dep.found() - error('logind support requires libsystemd or libsystemd-login but neither was found. Or, you can use \'-Dlauncher-logind=false\'') - endif + if not systemd_dep.found() + error('logind support requires libsystemd >= 209. Or, you can use \'-Dlauncher-logind=false\'') endif dbus_dep = dependency('dbus-1', version: '>= 1.6', required: false)