aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/selfmap.h
blob: 1690a74f4bfeb2acfb1e85752ec8141163c91d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Utility functions to read our own memory map
 *
 * Copyright (c) 2020 Linaro Ltd
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef SELFMAP_H
#define SELFMAP_H

#include "qemu/interval-tree.h"

typedef struct {
    IntervalTreeNode itree;

    /* flags */
    bool is_read;
    bool is_write;
    bool is_exec;
    bool is_priv;

    dev_t dev;
    ino_t inode;
    uint64_t offset;
    const char *path;
} MapInfo;

/**
 * read_self_maps:
 *
 * Read /proc/self/maps and return a tree of MapInfo structures.
 */
IntervalTreeRoot *read_self_maps(void);

/**
 * free_self_maps:
 * @info: an interval tree
 *
 * Free a tree of MapInfo structures.
 */
void free_self_maps(IntervalTreeRoot *root);

#endif /* SELFMAP_H */