unsigned long end;
unsigned long size;
- /*
- * Name of the mapping, such as library name or something else
- */
+ /* Name of the mapping, such as library name or something else */
char name[128];
+ int pid; /* Process which address space the mapping belongs to */
};
#define list_to_maps(list_head) \
return map;
}
-static struct maps *parse_maps(FILE *file)
+static struct maps *parse_maps(FILE *file, int pid)
{
struct maps *the_map = NULL;
char line[1024];
map->start = start;
map->end = end;
map->size = end - start;
+ map->pid = pid;
if (ret >= 3)
strncpy(map->name, name, sizeof(map->name));
if (!file)
goto err_out;
- maps = parse_maps(file);
+ maps = parse_maps(file, pid);
snprintf(path, sizeof(path), "/proc/%d/pagemap", pid);
file = fopen(path, "rb");