aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon/cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firemon/cgroup.c')
-rw-r--r--src/firemon/cgroup.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/firemon/cgroup.c b/src/firemon/cgroup.c
index 0b93390ae..e20e1d449 100644
--- a/src/firemon/cgroup.c
+++ b/src/firemon/cgroup.c
@@ -44,21 +44,20 @@ static void print_cgroup(int pid) {
44 free(file); 44 free(file);
45} 45}
46 46
47void cgroup(pid_t pid) { 47void cgroup(pid_t pid, int print_procs) {
48 if (getuid() == 0)
49 firemon_drop_privs();
50
51 pid_read(pid); 48 pid_read(pid);
52 49
53 // print processes 50 // print processes
54 int i; 51 int i;
55 for (i = 0; i < max_pids; i++) { 52 for (i = 0; i < max_pids; i++) {
56 if (pids[i].level == 1) { 53 if (pids[i].level == 1) {
57 pid_print_list(i, 0); 54 if (print_procs || pid == 0)
55 pid_print_list(i, 0);
58 int child = find_child(i); 56 int child = find_child(i);
59 if (child != -1) 57 if (child != -1)
60 print_cgroup(child); 58 print_cgroup(child);
61 } 59 }
62 } 60 }
61 printf("\n");
63} 62}
64 63