]> git.itanic.dy.fi Git - scan-pagemap/blob - main.c
Store parse options in a structure
[scan-pagemap] / main.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <errno.h>
5
6 #include "parse.h"
7 #include "analyze.h"
8
9 int main(int argc, char *argv[])
10 {
11         struct pageframe pf;
12         struct process *process_list = NULL;
13         struct parse_opts opts;
14         int pid;
15
16         if (argc < 2) {
17                 printf("A pid needs to be given as an argument\n");
18                 return 1;
19         }
20
21         pid = atoi(argv[1]);
22
23         memset(&pf, 0, sizeof(pf));
24         opts.parse_mask = PARSE_PID;
25         opts.pid = pid;
26
27         scan_all_pids(&pf, &process_list, &opts);
28         print_pid_stats(&pf, process_list);
29         print_page_stats(&pf);
30
31         return 0;
32 }