| 1 | /* |
| 2 | * Utility functions to read our own memory map |
| 3 | * |
| 4 | * Copyright (c) 2020 Linaro Ltd |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef SELFMAP_H |
| 10 | #define SELFMAP_H |
| 11 | |
| 12 | #include "qemu/interval-tree.h" |
| 13 | |
| 14 | typedef struct { |
| 15 | IntervalTreeNode itree; |
| 16 | |
| 17 | /* flags */ |
| 18 | bool is_read; |
| 19 | bool is_write; |
| 20 | bool is_exec; |
| 21 | bool is_priv; |
| 22 | |
| 23 | dev_t dev; |
| 24 | ino_t inode; |
| 25 | uint64_t offset; |
| 26 | const char *path; |
| 27 | } MapInfo; |
| 28 | |
| 29 | /** |
| 30 | * read_self_maps: |
| 31 | * |
| 32 | * Read /proc/self/maps and return a tree of MapInfo structures. |
| 33 | */ |
| 34 | IntervalTreeRoot *read_self_maps(void); |
| 35 | |
| 36 | /** |
| 37 | * free_self_maps: |
| 38 | * @info: an interval tree |
| 39 | * |
| 40 | * Free a tree of MapInfo structures. |
| 41 | */ |
| 42 | void free_self_maps(IntervalTreeRoot *root); |
| 43 | |
| 44 | #endif /* SELFMAP_H */ |