ProcMapEntry
Description
One line of /proc/self/maps. path is borrowed from the ProcMaps.raw buffer and stays valid until ProcMapsDeinit. May be empty for anonymous mappings (heap, stacks, vdso, etc.).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ProcMaps.c:49:
// mapping of the test binary itself.
u64 self_addr = (u64)(uintptr_t)&test_procmaps_find_self;
const ProcMapEntry *entry = ProcMapsFindByAddr(&maps, self_addr);
bool ok = entry != NULL && (entry->perms & PROC_MAP_PERM_EXEC) != 0; u64 addr = (u64)(uintptr_t)runtime_addr;
const ProcMapEntry *entry = ProcMapsFindByAddr(&self->maps, addr);
if (!entry || !entry->path || entry->path[0] == '\0') {
return false;- In
ProcMaps.c:91:
// ---------------------------------------------------------------------------
static bool parse_one_line(char **cursor_inout, char *end, ProcMapEntry *out) {
const char *p = *cursor_inout;
const char *line_start = p;- In
ProcMaps.c:205:
char *end = out->raw.data + out->raw.length;
while (cursor < end) {
ProcMapEntry e = {0};
if (!parse_one_line(&cursor, end, &e)) {
// Skip past whatever line we couldn't parse.
- In
ProcMaps.c:231:
}
const ProcMapEntry *ProcMapsFindByAddr(const ProcMaps *self, u64 addr) {
if (!self)
return NULL;- In
ProcMaps.c:235:
return NULL;
for (u64 i = 0; i < self->entries.length; ++i) {
const ProcMapEntry *e = &self->entries.data[i];
if (addr >= e->start && addr < e->end) {
return e;- In
ProcMaps.h:41:
u64 file_offset; // offset within the backing file
const char *path; // backing file path, or "" if anonymous
} ProcMapEntry;
typedef Vec(ProcMapEntry) ProcMapEntries;- In
ProcMaps.h:43:
} ProcMapEntry;
typedef Vec(ProcMapEntry) ProcMapEntries;
typedef struct ProcMaps {- In
ProcMaps.h:78:
/// FAILURE : Returns NULL if `addr` is not in any mapping.
///
const ProcMapEntry *ProcMapsFindByAddr(const ProcMaps *self, u64 addr);
#endif // MISRA_SYS_PROC_MAPS_H
Last updated on