10 void read_args(int argc, char *argv[], struct parse_opts *opts)
13 static struct option long_options[] = {
14 { .val = 'p', .name = "pid", .has_arg = 1, },
15 { .val = 'm', .name = "map", .has_arg = 1, },
17 char short_options[] = "p:m:";
21 c = getopt_long(argc, argv, short_options, long_options,
27 printf("%c: %s\n", c, optarg);
30 opts->pid = atoi(optarg);
31 opts->parse_mask |= PARSE_PID;
34 opts->parse_mask |= PARSE_MAP_NAME;
35 opts->map_name = optarg;
41 int main(int argc, char *argv[])
44 struct process *process_list = NULL;
45 struct parse_opts opts;
48 printf("A pid needs to be given as an argument\n");
52 read_args(argc, argv, &opts);
54 memset(&pf, 0, sizeof(pf));
56 scan_all_pids(&pf, &process_list, &opts);
57 print_pid_stats(&pf, process_list);
58 print_page_stats(&pf);