# | Line 29 | Line 29 | int main(){ | |
---|---|---|
29 | proc_state_t *ps; | |
30 | int ps_size; | |
31 | int x; | |
32 | < | char *state; |
32 | > | char *state = NULL; |
33 | ||
34 | /* Initialise statgrab */ | |
35 | statgrab_init(); | |
# | Line 42 | Line 42 | int main(){ | |
42 | ||
43 | ps_size = get_proc_snapshot(&ps); | |
44 | ||
45 | + | if(ps_size < 0){ |
46 | + | fprintf(stderr, "Failed to get process snapshot\n"); |
47 | + | exit(1); |
48 | + | } |
49 | + | |
50 | printf("%5s %5s %5s %5s %5s %5s %5s %6s %6s %9s %-10s %-4s %-8s %-20s %s\n", | |
51 | "pid", "ppid", "pgid", "uid", "euid", "gid", "egid", "size", "res", "time", "cpu", "nice", "state", "name", "title"); | |
52 | ||
# | Line 58 | Line 63 | int main(){ | |
63 | break; | |
64 | case ZOMBIE: | |
65 | state = "ZOMBIE"; | |
66 | + | break; |
67 | + | case UNKNOWN: |
68 | + | state = "UNKNOWN"; |
69 | break; | |
70 | } | |
71 | printf("%5d %5d %5d %5d %5d %5d %5d %5dM %5dM %8ds %10f %4d %-8s %-20s %s\n", |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |