ProcMapsLoad
Description
Read and parse /proc/self/maps. The full file is held inside out->raw for the lifetime of the ProcMaps so each entry’s path can borrow from it without a separate copy.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Populated on success. |
alloc |
in | Allocator for the raw buffer and entries vector. |
Success
Returns true; out->entries is populated.
Failure
Returns false; logs the failing step. out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
out->allocator = alloc;
out->cache = VecInitT(out->cache, alloc);
if (!ProcMapsLoad(&out->maps, alloc)) {
VecDeinit(&out->cache);
MemSet(out, 0, sizeof(*out));- In
ProcMaps.c:227:
bool proc_maps_load(ProcMaps *out, Allocator *alloc) {
if (!out || !alloc) {
LOG_FATAL("ProcMapsLoad: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
ProcMaps.c:237:
File f = FileOpen("/proc/self/maps", "rb");
if (!FileIsOpen(&f)) {
LOG_ERROR("ProcMapsLoad: FileOpen(/proc/self/maps) failed");
ProcMapsDeinit(out);
return false;- In
ProcMaps.c:244:
FileClose(&f);
if (!ok) {
LOG_ERROR("ProcMapsLoad: FileRead failed");
ProcMapsDeinit(out);
return false;- In
ProcMaps.c:249:
}
if (StrLen(&out->raw) == 0) {
LOG_ERROR("ProcMapsLoad: /proc/self/maps was empty");
ProcMapsDeinit(out);
return false; ProcMaps maps;
bool got = false;
if (ProcMapsLoad(&maps, ALLOCATOR_OF(&a))) {
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *m = VecPtrAt(&maps.entries, i);- In
Bias.c:34:
ProcMaps maps;
bool got = false;
if (ProcMapsLoad(&maps, ALLOCATOR_OF(&a))) {
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *m = VecPtrAt(&maps.entries, i);- In
ProcMaps.c:30:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:58:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:86:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:108:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:137:
volatile int local = 0xABCD;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:166:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:205:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:249:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:271:
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;- In
ProcMaps.c:393:
DefaultAllocator alloc = DefaultAllocatorInit();
ProcMaps maps;
if (!ProcMapsLoad(&maps, ALLOCATOR_OF(&alloc))) {
DefaultAllocatorDeinit(&alloc);
return false;
Last updated on