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