chiark / gitweb /
Prep v231.2: login/elogind.c: Remove bus_forward_agent_released()
authorSven Eden <yamakuzure@gmx.net>
Tue, 20 Jun 2017 04:48:14 +0000 (06:48 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 20 Jun 2017 04:48:14 +0000 (06:48 +0200)
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
src/login/elogind.c

index 73134caa515d572e18cf717ba754f8440ec3b02b..5e53f447d03b63c18906000f58687926c503e484 100644 (file)
@@ -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
index e76654b6008dd1db0a8319450f150881ff0184b7..de12c8119e2008c1a72e864f096363e076529789 100644 (file)
@@ -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