return r;
}
-static int pakfire_cgroup_create_recursive(struct pakfire_cgroup** cgroup,
- struct pakfire_ctx* ctx, struct pakfire_cgroup* parent, const char* path, int flags) {
- struct pakfire_cgroup* child = NULL;
- char buffer[PATH_MAX];
- char* name = NULL;
- char* p = NULL;
- int r;
-
- // Copy the path to the buffer
- r = pakfire_string_set(buffer, path);
- if (r < 0)
- goto ERROR;
-
- // Split the path by /
- name = strtok_r(buffer, "/", &p);
-
- // Walk through all elements of the path
- while (name) {
- r = pakfire_cgroup_open(&child, parent->ctx, parent, name, flags);
- if (r < 0)
- goto ERROR;
-
- // Move on to the next round...
- pakfire_cgroup_unref(parent);
- parent = child; child = NULL;
-
- name = strtok_r(NULL, "/", &p);
- }
-
- // Return the pointer
- *cgroup = pakfire_cgroup_ref(parent);
-
-ERROR:
- // XXX We may free the passed parent here if we did zero iterations of the while loop
- if (parent)
- pakfire_cgroup_unref(parent);
-
- return r;
-}
-
int pakfire_cgroup_create(struct pakfire_cgroup** cgroup,
struct pakfire_ctx* ctx, struct pakfire_cgroup* parent, const char* name, int flags) {
struct pakfire_cgroup* root = NULL;
}
// Recursively create the new cgroup
- //r = pakfire_cgroup_create_recursive(cgroup, ctx, parent, name, flags);
r = pakfire_cgroup_open(cgroup, ctx, parent, name, flags);
// Cleanup