// recursivity!!! void pid_print_tree(unsigned index, unsigned parent, int nowrap) { print_elem(index, nowrap); // Remove unused parameter warning (void)parent; unsigned i; for (i = index + 1; i < (unsigned)max_pids; i++) { if (pids[i].parent == (pid_t)index) pid_print_tree(i, index, nowrap); } for (i = 0; i < index; i++) { if (pids[i].parent == (pid_t)index) pid_print_tree(i, index, nowrap); } }
static void procevent_print_pids(void) { // print files int i; for (i = 0; i < MAX_PIDS; i++) { if (pids[i].level == 1) pid_print_tree(i, 0, 1); } printf("\n"); }
// recursivity!!! void pid_print_tree(unsigned index, unsigned parent, int nowrap) { print_elem(index, nowrap); int i; for (i = index + 1; i < MAX_PIDS; i++) { if (pids[i].parent == index) pid_print_tree(i, index, nowrap); } }
void tree(pid_t pid) { pid_read(pid); // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) pid_print_tree(i, 0, arg_nowrap); } printf("\n"); }
void tree(void) { if (getuid() == 0) firemon_drop_privs(); pid_read(0); // include all processes // print processes int i; for (i = 0; i < MAX_PIDS; i++) { if (pids[i].level == 1) pid_print_tree(i, 0, 0); } }