This is only used for debugging.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
// Flags
int flags;
- // Store the name
- char name[PATH_MAX];
+ // Store the name & path
+ char name[NAME_MAX];
+ char path[PATH_MAX];
// File descriptor to cgroup
int fd;
return cgroup->name;
}
+static const char* pakfire_cgroup_path(struct pakfire_cgroup* cgroup) {
+ if (!*cgroup->path)
+ return "(root)";
+
+ return cgroup->path;
+}
+
static int pakfire_cgroup_setup_devices(struct pakfire_cgroup* cgroup) {
static char bpf_log_buffer[BPF_LOG_BUF_SIZE];
if (r < 0)
goto ERROR;
+ // Store path
+ if (c->parent) {
+ r = pakfire_path_append(c->path, c->parent->path, c->name);
+ if (r < 0)
+ goto ERROR;
+ }
+
// Copy flags
c->flags = flags;
goto ERROR;
#endif
+ DEBUG(c->ctx, "Created cgroup %s\n", pakfire_cgroup_path(c));
+
// Return the pointer
*cgroup = pakfire_cgroup_ref(c);