#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "unit-name.h"
#include "user-util.h"
if (r > 0 && streq(controller, SYSTEMD_CGROUP_CONTROLLER)) {
r = cg_attach(SYSTEMD_CGROUP_CONTROLLER_LEGACY, path, pid);
if (r < 0)
- log_warning_errno(r, "Failed to attach %d to compat systemd cgroup %s: %m", pid, path);
+ log_warning_errno(r, "Failed to attach "PID_FMT" to compat systemd cgroup %s: %m", pid, path);
}
return 0;
int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
_cleanup_fclose_ FILE *f = NULL;
char line[LINE_MAX];
- const char *fs, *controller_str;
+ const char *fs, *controller_str = NULL;
size_t cs = 0;
int unified;
return -ENODATA;
}
+#if 0 /// UNNEEDED by elogind
int cg_install_release_agent(const char *controller, const char *agent) {
_cleanup_free_ char *fs = NULL, *contents = NULL;
const char *sc;
return r;
sc = strstrip(contents);
+
if (isempty(sc)) {
r = write_string_file(fs, agent, 0);
if (r < 0)
return 0;
}
+#endif // 0
int cg_is_empty(const char *controller, const char *path) {
_cleanup_fclose_ FILE *f = NULL;
}
int cg_get_root_path(char **path) {
-#if 0 /// elogind does not support systemd scopes and slices
char *p, *e;
int r;
if (r < 0)
return r;
+#if 0 /// elogind does not support systemd scopes and slices
e = endswith(p, "/" SPECIAL_INIT_SCOPE);
if (!e)
e = endswith(p, "/" SPECIAL_SYSTEM_SLICE); /* legacy */
if (!e)
e = endswith(p, "/system"); /* even more legacy */
+#else
+ e = endswith(p, "/elogind");
+#endif // 0
if (e)
*e = 0;
*path = p;
return 0;
-#else
- assert(path);
- return cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 1, path);
-#endif // 0
}
int cg_shift_path(const char *cgroup, const char *root, const char **shifted) {