int match = 0;
char *name;
- if (opts->parse_mask & PARSE_PROCESS_NAME) {
+ if (is_parse_option(opts, PARSE_PROCESS_NAME)) {
name = get_name_by_pid(process->pid);
if (!strcmp(opts->name, name ? name : ""))
match = 1;
}
- if (opts->parse_mask & PARSE_PID) {
+ if (is_parse_option(opts, PARSE_PID)) {
if (opts->pid == process->pid)
match = 1;
}
- if (opts->parse_mask & PARSE_MAP_NAME)
+ if (is_parse_option(opts, PARSE_MAP_NAME))
match = 1;
- if (opts->parse_mask & PARSE_NOADD_TREE)
+ if (is_parse_option(opts, PARSE_NOADD_TREE))
match = !match;
return match;
{
int match = 0;
- if (opts->parse_mask & PARSE_MAP_NAME) {
+ if (is_parse_option(opts, PARSE_MAP_NAME)) {
if (!strcmp(opts->name, map->name))
match = 1;
- if (opts->parse_mask & PARSE_NOADD_TREE)
+ if (is_parse_option(opts, PARSE_NOADD_TREE))
match = !match;
} else
match = 1;
static int should_add_to_tree(struct parse_opts *opts, struct pageframe *pf,
struct maps *map)
{
- if (opts->parse_mask & PARSE_NOADD_TREE)
+ if (is_parse_option(opts, PARSE_NOADD_TREE))
return 0;
return 1;
int pid;
int count = 0;
- if (opts->parse_mask & PARSE_PROCESS_NAME) {
+ if (is_parse_option(opts, PARSE_PROCESS_NAME)) {
while ((pid = get_next_pid_by_name(&dir, opts->name))) {
count += read_pageframe_with_threads(pid, pf,
process_list,
dir = NULL;
}
- if (opts->parse_mask & PARSE_PID)
+ if (is_parse_option(opts, PARSE_PID))
count = read_pageframe_with_threads(opts->pid, pf, process_list,
opts);
- if ((count == 0) && !(opts->parse_mask & PARSE_MAP_NAME)) {
+ if ((count == 0) && !(is_parse_option(opts, PARSE_MAP_NAME))) {
printf("Failed to find any matching processes "
"with given arguments\n");
return -1;
}
- if (opts->parse_mask & PARSE_DUMP)
+ if (is_parse_option(opts, PARSE_DUMP))
return 0;
- if (opts->parse_mask & PARSE_MAP_NAME) {
+ if (is_parse_option(opts, PARSE_MAP_NAME)) {
while (1) {
pid = get_next_pid(&dir);
if (pid <= 0)