.compare = compare_pageframe,
};
-static int should_scan_process(struct parse_opts *opts, struct process *process)
+static int pid_is_match(int pidn, struct list_head *pidlist)
{
struct pidlist *pid;
+
+ list_for_each_entry(pid, pidlist, list) {
+ if (pid->pid == pidn)
+ return 1;
+ }
+
+ return 0;
+}
+
+static int should_scan_process(struct parse_opts *opts, struct process *process)
+{
int match = 0;
- if (is_parse_option(opts, PARSE_PID)) {
- list_for_each_entry(pid, &opts->pidlist, list) {
- if (pid->pid == process->pid) {
+ if (is_parse_option(opts, PARSE_PID) &&
+ is_parse_option(opts, PARSE_MAP_NAME)) {
+ if (pid_is_match(process->pid, &opts->pidlist))
+ match = 1;
+ } else {
+ if (is_parse_option(opts, PARSE_PID)) {
+ if (pid_is_match(process->pid, &opts->pidlist))
match = 1;
- break;
- }
}
- }
- if (is_parse_option(opts, PARSE_MAP_NAME))
- match = 1;
+ if (is_parse_option(opts, PARSE_MAP_NAME))
+ match = 1;
+ }
if (is_parse_option(opts, PARSE_NOADD_TREE))
match = !match;