Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Access memory from another process
[simgrid.git] / src / mc / mc_memory_map.h
1 /* Copyright (c) 2007-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef MC_MEMORY_MAP_H
8 #define MC_MEMORY_MAP_H
9
10 #include <sys/types.h>
11
12 #include <simgrid_config.h>
13 #include "mc_forward.h"
14
15 SG_BEGIN_DECL()
16
17 /** \file
18  *   These functions and data structures implements a binary interface for
19  *   the proc maps ascii interface                                           */
20
21 /* Each field is defined as documented in proc's manual page  */
22 struct s_map_region {
23
24   void *start_addr;             /* Start address of the map */
25   void *end_addr;               /* End address of the map */
26   int prot;                     /* Memory protection */
27   int flags;                    /* Additional memory flags */
28   void *offset;                 /* Offset in the file/whatever */
29   char dev_major;               /* Major of the device */
30   char dev_minor;               /* Minor of the device */
31   unsigned long inode;          /* Inode in the device */
32   char *pathname;               /* Path name of the mapped file */
33
34 };
35 typedef struct s_map_region s_map_region_t, *map_region_t;
36
37 struct s_memory_map {
38
39   s_map_region_t *regions;      /* Pointer to an array of regions */
40   int mapsize;                  /* Number of regions in the memory */
41
42 };
43
44 memory_map_t MC_get_memory_map(pid_t pid);
45 void MC_free_memory_map(memory_map_t map);
46
47 SG_END_DECL()
48
49 #endif