diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-12-23 11:56:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-12-24 00:29:39 +0100 |
commit | b08121d00467874ac9aa0dc6f59787877f1bb427 (patch) | |
tree | 02ec43591a75af54925396411ada914dabe01e22 /src/shared/cgroup-util.c | |
parent | 81dc4bde12acd0a59ad96a505dbb109a9e4f320e (diff) |
systemctl: don't show cgroup field for a unit if cgroup is empty
Diffstat (limited to 'src/shared/cgroup-util.c')
-rw-r--r-- | src/shared/cgroup-util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index b0d378de5a..18cbf0412a 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -934,6 +934,20 @@ int cg_is_empty(const char *controller, const char *path, bool ignore_self) { return !found; } +int cg_is_empty_by_spec(const char *spec, bool ignore_self) { + int r; + _cleanup_free_ char *controller = NULL, *path = NULL; + + assert(spec); + + r = cg_split_spec(spec, &controller, &path); + if (r < 0) + return r; + + return cg_is_empty(controller, path, ignore_self); +} + + int cg_is_empty_recursive(const char *controller, const char *path, bool ignore_self) { int r; DIR *d = NULL; |