mirror of
https://github.com/troglobit/finit.git
synced 2026-10-20 11:19:35 +00:00
initctl: refactor pid_cgroup(), return allocated buffer
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+31
-9
No files matched your search
+5
-3
@@ -1135,14 +1135,14 @@ static int show_status(char *arg)
|
||||
printf(" Restarts : %d (%d/%d)\n", svc->restart_tot, svc->restart_cnt, svc->restart_max);
|
||||
printf(" Runlevels : %s\n", runlevel_string(runlevel, svc->runlevels));
|
||||
if (cgrp && svc->pid > 1) {
|
||||
char grbuf[128];
|
||||
const struct cg *cg;
|
||||
char path[256];
|
||||
struct cg *cg;
|
||||
char *group;
|
||||
|
||||
group = pid_cgroup(svc->pid, grbuf, sizeof(grbuf));
|
||||
group = pid_cgroup(svc->pid);
|
||||
if (!group)
|
||||
goto no_cgroup; /* ... or PID doesn't exist (anymore) */
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", FINIT_CGPATH, group);
|
||||
cg = cg_conf(path);
|
||||
|
||||
@@ -1151,6 +1151,8 @@ static int show_status(char *arg)
|
||||
group, cg->cg_cpu.set, cg->cg_cpu.weight, cg->cg_cpu.max,
|
||||
cg->cg_mem.min, cg->cg_mem.max);
|
||||
show_cgroup_tree(group, " ");
|
||||
|
||||
free(group);
|
||||
}
|
||||
no_cgroup:
|
||||
printf("\n");
|
||||
|
||||
Reference in new issue
Block a user