xasprintf(&str, "%c%c%c",
file->mode & S_IRUSR? 'r': '-',
file->mode & S_IWUSR? 'w': '-',
- ((file->association == -ASSOC_SHM
- || file->association == -ASSOC_MEM)
+ (is_mapped_file(file)
&& file->mode & S_IXUSR)? 'x': '-');
else
xasprintf(&str, "---");
break;
}
case COL_MAPLEN:
- if (file->association != -ASSOC_SHM
- && file->association != -ASSOC_MEM)
+ if (!is_mapped_file(file))
return true;
xasprintf(&str, "%ju", (uintmax_t)get_map_length(file));
break;
};
#define is_opened_file(_f) ((_f)->association >= 0)
+#define is_mapped_file(_f) (is_association((_f), SHM) || is_association((_f), MEM))
#define is_association(_f, a) ((_f)->association < 0 && (_f)->association == -ASSOC_ ## a)
struct file_class {