cgroup: implement task_cgroup_path_from_hierarchy()
kdbus folks want a sane way to determine the cgroup path that a given task belongs to on a given hierarchy, which is a reasonble thing to expect from cgroup core. Implement task_cgroup_path_from_hierarchy(). v2: Dropped unnecessary NULL check on the return value of task_cgroup_from_root() as suggested by Li Zefan. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Greg Kroah-Hartman <greg@kroah.com> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Lennart Poettering <lennart@poettering.net> Cc: Daniel Mack <daniel@zonque.org>
This commit is contained in:
parent
1a57423166
commit
857a2beb09
2 changed files with 34 additions and 0 deletions
|
@ -542,6 +542,8 @@ int cgroup_is_removed(const struct cgroup *cgrp);
|
|||
bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
|
||||
|
||||
int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
|
||||
int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id,
|
||||
char *buf, size_t buflen);
|
||||
|
||||
int cgroup_task_count(const struct cgroup *cgrp);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue