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.
#else
/* elogind can not support the unified hierarchy as a controller,
* so always assume a classical hierarchy.
#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
* add such a support. */
if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC))
#endif // 0
}
/// Add-On for manager_connect_bus()
}
/// Add-On for manager_connect_bus()
+/// Original: src/core/dbus.c:bus_setup_system()
void elogind_bus_setup_system(Manager* m) {
int r;
void elogind_bus_setup_system(Manager* m) {
int r;
log_debug("Successfully connected to system bus.");
}
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];
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];
buf[n] = 0;
manager_notify_cgroup_empty(m, buf);
buf[n] = 0;
manager_notify_cgroup_empty(m, buf);
- bus_forward_agent_released(m, buf);
return 0;
}
/// Add-On for manager_connect_bus()
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 elogind_setup_cgroups_agent(Manager *m) {
static const union sockaddr_union sa = {
.un.sun_family = AF_UNIX,
.un.sun_path = "/run/systemd/cgroups-agent",
};
/* 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
/* 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