summaryrefslogtreecommitdiff
path: root/daemon/gdm-x-session.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-03 20:07:18 +0200
committerRay Strode <rstrode@redhat.com>2015-06-03 15:17:21 -0400
commit37c30a497908c969898e4a15bea88aea91cb2db5 (patch)
tree480de02c08d55b3e51456ad0fc01cd2a858f1f01 /daemon/gdm-x-session.c
parentfd79a98717284435414633caf9a358c28bb6bf57 (diff)
downloadgdm-37c30a497908c969898e4a15bea88aea91cb2db5.tar.gz
gdm-{x,wayland}-session: don't start dbus-daemon if unneeded
Desktop sessions require a message bus to be present for IPC between the various desktop services and applications. GDM handles that by manually, unconditionally spawning an instance of dbus-daemon at login time before starting the user session (from the gdm-x-session and gdm-wayland-session launcher programs). Newer versions of the kernel will support this message bus functionality without needing to start dbus-daemon (via kdbus). The message bus is initialized as part of the login process by a kernel interface exercised from pam_systemd. Since gdm-x-session and gdm-wayland-session spawn a dbus-daemon unconditionally as part of session startup, users using kdbus end up with two message buses per session. The extra bus gets in the way, confusing programs and wasting resources. This commit changes gdm-x-session and gdm-wayland-session to check for DBUS_SESSION_BUS_ADDRESS in the environment, and if set, skip spawning a dbus-daemon based session bus. https://bugzilla.gnome.org/show_bug.cgi?id=750358
Diffstat (limited to 'daemon/gdm-x-session.c')
-rw-r--r--daemon/gdm-x-session.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
index 3cc7d405..bcb884ce 100644
--- a/daemon/gdm-x-session.c
+++ b/daemon/gdm-x-session.c
@@ -367,6 +367,7 @@ spawn_bus (State *state,
GInputStream *input_stream = NULL;
GDataInputStream *data_stream = NULL;
GError *error = NULL;
+ const char *bus_env = NULL;
char *bus_address_fd_string;
char *bus_address = NULL;
gsize bus_address_size;
@@ -377,6 +378,13 @@ spawn_bus (State *state,
g_debug ("Running session message bus");
+ bus_env = g_getenv ("DBUS_SESSION_BUS_ADDRESS");
+ if (bus_env != NULL) {
+ g_debug ("session message bus already running, not starting another one");
+ state->bus_address = g_strdup (bus_env);
+ return TRUE;
+ }
+
ret = g_unix_open_pipe (pipe_fds, FD_CLOEXEC, &error);
if (!ret) {