66
void cgroup_bonding_free(CGroupBonding *b, bool remove_or_trim) {
63
void cgroup_bonding_free(CGroupBonding *b, bool trim) {
72
LIST_REMOVE(CGroupBonding, by_unit, b->unit->meta.cgroup_bondings, b);
69
LIST_REMOVE(CGroupBonding, by_unit, b->unit->cgroup_bondings, b);
74
71
if (streq(b->controller, SYSTEMD_CGROUP_CONTROLLER)) {
75
assert_se(f = hashmap_get(b->unit->meta.manager->cgroup_bondings, b->path));
72
assert_se(f = hashmap_get(b->unit->manager->cgroup_bondings, b->path));
76
73
LIST_REMOVE(CGroupBonding, by_path, f, b);
79
hashmap_replace(b->unit->meta.manager->cgroup_bondings, b->path, f);
76
hashmap_replace(b->unit->manager->cgroup_bondings, b->path, f);
81
hashmap_remove(b->unit->meta.manager->cgroup_bondings, b->path);
78
hashmap_remove(b->unit->manager->cgroup_bondings, b->path);
85
if (b->realized && b->ours && remove_or_trim) {
87
if (cgroup_bonding_is_empty(b) > 0)
88
cg_delete(b->controller, b->path);
90
cg_trim(b->controller, b->path, false);
82
if (b->realized && b->ours && trim)
83
cg_trim(b->controller, b->path, false);
93
85
free(b->controller);
165
int cgroup_bonding_set_task_access(CGroupBonding *b, mode_t mode, uid_t uid, gid_t gid) {
157
int cgroup_bonding_set_task_access(CGroupBonding *b, mode_t mode, uid_t uid, gid_t gid, int sticky) {
168
160
if (!b->realized)
171
return cg_set_task_access(b->controller, b->path, mode, uid, gid);
163
return cg_set_task_access(b->controller, b->path, mode, uid, gid, sticky);
174
int cgroup_bonding_set_task_access_list(CGroupBonding *first, mode_t mode, uid_t uid, gid_t gid) {
166
int cgroup_bonding_set_task_access_list(CGroupBonding *first, mode_t mode, uid_t uid, gid_t gid, int sticky) {
175
167
CGroupBonding *b;
178
170
LIST_FOREACH(by_unit, b, first) {
179
r = cgroup_bonding_set_task_access(b, mode, uid, gid);
171
r = cgroup_bonding_set_task_access(b, mode, uid, gid, sticky);
360
355
m->cgroup_hierarchy = NULL;
358
int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding) {
366
b = hashmap_get(m->cgroup_bondings, cgroup);
388
b = hashmap_get(m->cgroup_bondings, p);
363
397
int cgroup_notify_empty(Manager *m, const char *group) {
364
398
CGroupBonding *l, *b;
369
if (!(l = hashmap_get(m->cgroup_bondings, group)))
404
r = cgroup_bonding_get(m, group, &l);
372
408
LIST_FOREACH(by_path, b, l) {
425
/* If it is empty, let's delete it */
426
cgroup_bonding_trim_list(b->unit->cgroup_bondings, true);
388
428
if (UNIT_VTABLE(b->unit)->cgroup_notify_empty)
389
429
UNIT_VTABLE(b->unit)->cgroup_notify_empty(b->unit);