From 7f72c07c5a325307ae00fc6759912e096d2c8c82 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Tue, 20 Jun 2017 06:48:14 +0200 Subject: [PATCH] Prep v231.2: login/elogind.c: Remove bus_forward_agent_released() This method is called from a systemd manager that is the system instance to inform all user instances of systemd about the pending cgroup release. elogind on the other hand is always there just once. And the release of cgroups is handled by the local cgroups manager, which should be provided by the running init system. Even if there is no cgroup management, so elogind sets itself up as a small cgroups manager itself, there aren't any user instances that could react on the forwarding anyway. --- src/basic/cgroup-util.c | 4 ++-- src/login/elogind.c | 31 +++---------------------------- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 73134caa5..5e53f447d 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2240,8 +2240,8 @@ int cg_unified(void) { #else /* elogind can not support the unified hierarchy as a controller, * so always assume a classical hierarchy. - * If, ond only *if*, someone really wants to substitute systemd-login - * in an environment managed by systemd with elogin, we might have to + * If, and only *if*, someone really wants to substitute systemd-login + * in an environment managed by systemd with elogind, we might have to * add such a support. */ if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC)) #endif // 0 diff --git a/src/login/elogind.c b/src/login/elogind.c index e76654b60..de12c8119 100644 --- a/src/login/elogind.c +++ b/src/login/elogind.c @@ -64,6 +64,7 @@ static int signal_agent_released(sd_bus_message *message, void *userdata, sd_bus } /// Add-On for manager_connect_bus() +/// Original: src/core/dbus.c:bus_setup_system() void elogind_bus_setup_system(Manager* m) { int r; @@ -87,32 +88,6 @@ void elogind_bus_setup_system(Manager* m) { log_debug("Successfully connected to system bus."); } -static int bus_forward_agent_released(Manager *m, const char *path) { - int r; - - assert(m); - assert(path); - - if (!MANAGER_IS_SYSTEM(m)) - return 0; - - if (!m->bus) - return 0; - - /* If we are running a system instance we forward the agent message on the system bus, so that the user - * instances get notified about this, too */ - - r = sd_bus_emit_signal(m->bus, - "/org/freedesktop/elogind/agent", - "org.freedesktop.elogind.Agent", - "Released", - "s", path); - if (r < 0) - return log_warning_errno(r, "Failed to propagate agent release message: %m"); - - return 1; -} - static int manager_dispatch_cgroups_agent_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) { Manager *m = userdata; char buf[PATH_MAX+1]; @@ -137,19 +112,19 @@ static int manager_dispatch_cgroups_agent_fd(sd_event_source *source, int fd, ui buf[n] = 0; manager_notify_cgroup_empty(m, buf); - bus_forward_agent_released(m, buf); return 0; } /// Add-On for manager_connect_bus() +/// Original: src/core/manager.c:manager_setup_cgroups_agent() int elogind_setup_cgroups_agent(Manager *m) { static const union sockaddr_union sa = { .un.sun_family = AF_UNIX, .un.sun_path = "/run/systemd/cgroups-agent", }; - int r; + int r = 0; /* This creates a listening socket we receive cgroups agent messages on. We do not use D-Bus for delivering * these messages from the cgroups agent binary to PID 1, as the cgroups agent binary is very short-living, and -- 2.30.2