Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Disable stream buffer when reading /proc/self/maps.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 10 Apr 2013 15:27:30 +0000 (17:27 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 10 Apr 2013 16:31:33 +0000 (18:31 +0200)
I don't fully  understand why it is necessary but, without this change, the MC
tests may terminate on a SIGSEGV.  It is likely because some memory regions are
unmapped on fclose, and then the real memory map is different from the
informations that were read.

src/mc/memory_map.c

index b431523..b0e84a6 100644 (file)
@@ -32,6 +32,8 @@ memory_map_t get_memory_map(void)
   xbt_assert(fp,
               "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug.");
 
+  setbuf(fp, NULL);
+
   ret = xbt_new0(s_memory_map_t, 1);
 
   /* Read one line at the time, parse it and add it to the memory map to be returned */