From 5a549c957a873bd44ab351e627828905ee7dbf18 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Wed, 24 Jan 2018 04:05:47 +0100 Subject: [PATCH] Revert "systemd-logind: Monitor systemd-logind going away" systemd-logind since version 234 (released 2017-07-12) supports being restarted without losing state [1]. From the systemd NEWS file [2]: * systemd-logind may now be restarted without losing state. It stores the file descriptors for devices it manages in the system manager using the FDSTORE= mechanism. Please note that further changes in other components may be required to make use of this (for example Xorg has code to listen for stops of systemd-logind and terminate itself when logind is stopped or restarted, in order to avoid using stale file descriptors for graphical devices, which is now counterproductive and must be reverted in order for restarts of systemd-logind to be safe. See https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101.) This reverts commit dc48bd653c7e1013e2d69e3f59ae3cbc0c893473. Closes: #531 [1] https://github.com/systemd/systemd/pull/5600 [2] https://github.com/systemd/systemd/commit/9f09a95a7e6127f526c0ef7b6fd060cc0b01cdcc --- hw/xfree86/os-support/linux/systemd-logind.c | 35 +------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c index 13784d15c..93428ba73 100644 --- a/hw/xfree86/os-support/linux/systemd-logind.c +++ b/hw/xfree86/os-support/linux/systemd-logind.c @@ -313,35 +313,11 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) dbus_int32_t major, minor; char *pause_str; - if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL) + if (strcmp(dbus_message_get_path(message), info->session) != 0) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; dbus_error_init(&error); - if (dbus_message_is_signal(message, - "org.freedesktop.DBus", "NameOwnerChanged")) { - char *name, *old_owner, *new_owner; - - dbus_message_get_args(message, &error, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_STRING, &old_owner, - DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID); - if (dbus_error_is_set(&error)) { - LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n", - error.message); - dbus_error_free(&error); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - if (name && strcmp(name, "org.freedesktop.login1") == 0) - FatalError("systemd-logind disappeared (stopped/restarted?)\n"); - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - if (strcmp(dbus_message_get_path(message), info->session) != 0) - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", "PauseDevice")) { if (!dbus_message_get_args(message, &error, @@ -499,15 +475,6 @@ connect_hook(DBusConnection *connection, void *data) goto cleanup; } - dbus_bus_add_match(connection, - "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'", - &error); - if (dbus_error_is_set(&error)) { - LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", - error.message); - goto cleanup; - } - dbus_bus_add_match(connection, "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Session',member='PauseDevice'", &error);