ret = sscanf(line, "%lx-%lx %*s %*s %*s %*s %s",
&start, &end, name);
- printf("%x, start %lx, end %lx, str: %s\n",
- ret, start, end, ret >= 3 ? name : "");
-
if (ret < 2) {
printf("Error reading input: %s\n", line);
break;
start = map->start >> (PAGE_SHIFT - 3);
len = map->size >> (PAGE_SHIFT - 3);
- printf("start: %lx len %lx: name: %s\n",
- start, len, map->name);
-
ret = fseek(file, start, SEEK_SET);
if (ret) {
error = errno;
ret = fread(&pf, 1, sizeof(pf), file);
if (ret != sizeof(pf)) {
error = errno;
- fprintf(stderr,
- "Error reading %ld bytes, got %d: %s\n",
- sizeof(pf), ret, strerror(errno));
continue;
}
if (!pageframe)
{
struct maps *maps;
FILE *file;
- int error;
char path[512];
snprintf(path, sizeof(path), "/proc/%d/maps", pid);
file = fopen(path, "rb");
if (!file)
- goto err_out;
+ return;
maps = parse_maps(file, pid);
+ fclose(file);
snprintf(path, sizeof(path), "/proc/%d/pagemap", pid);
file = fopen(path, "rb");
if (!file)
- goto err_out;
+ return;
parse_pageframe(file, pageframe, maps, add_to_tree);
-
- return;
-err_out:
- error = errno;
- fprintf(stderr, "Failed to open file %s: %s\n", path, strerror(error));
+ fclose(file);
return;
}
return 0;
}
error = errno;
- printf("Failed to read directory: %s\n", strerror(error));
+ printf("Failed to read /proc directory: %s\n", strerror(error));
return -1;
}