From b69d29ce049f12d463a589e18561dd10ee8c09f1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 16 Apr 2012 18:56:18 +0200 Subject: systemctl: show main and control PID explicitly in cgroup-show In some cases the main/control PID of a service can be outside of the services cgroups (for example, if logind readjusts the processes' cgroup). In order to clarify this for the user show the main/control PID in the cgroup tree nonetheless, but mark them specially. --- src/shared/cgroup-util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/shared/cgroup-util.c') diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 48da4cb3b7..8ceb382820 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -1050,11 +1050,11 @@ int cg_fix_path(const char *path, char **result) { assert(result); /* First check if it already is a filesystem path */ - if (path_is_absolute(path) && - path_startswith(path, "/sys/fs/cgroup") && + if (path_startswith(path, "/sys/fs/cgroup") && access(path, F_OK) >= 0) { - if (!(t = strdup(path))) + t = strdup(path); + if (!t) return -ENOMEM; *result = t; @@ -1062,7 +1062,8 @@ int cg_fix_path(const char *path, char **result) { } /* Otherwise treat it as cg spec */ - if ((r = cg_split_spec(path, &c, &p)) < 0) + r = cg_split_spec(path, &c, &p); + if (r < 0) return r; r = cg_get_path(c ? c : SYSTEMD_CGROUP_CONTROLLER, p ? p : "/", NULL, result); -- cgit v1.2.3-54-g00ecf