Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Cleanup mc_hash
[simgrid.git] / src / mc / mc_process.cpp
index 5fee155..1a799ae 100644 (file)
@@ -4,6 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#define _FILE_OFFSET_BITS 64
+
 #include <assert.h>
 #include <stddef.h>
 #include <stdbool.h>
@@ -47,27 +49,28 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc,
 #define VERSION_RE "-[\\.0-9-]*$"
 
 static const char *const FILTERED_LIBS[] = {
-  "libstdc++",
+  "ld",
+  "libbz2",
   "libboost_context",
+  "libc",
   "libc++",
   "libcdt",
-  "libm",
+  "libcgraph",
+  "libdl",
+  "libdw",
+  "libelf",
   "libgcc_s",
+  "liblua5.1",
+  "liblzma",
+  "libm",
   "libpthread",
+  "librt",
+  "libstdc++",
   "libunwind",
   "libunwind-x86_64",
   "libunwind-x86",
   "libunwind-ptrace",
-  "libdw",
-  "libdl",
-  "librt",
-  "liblzma",
-  "libelf",
-  "libbz2",
-  "libz",
-  "libelf",
-  "libc",
-  "ld"
+  "libz"
 };
 
 static bool MC_is_simgrid_lib(const char* libname)
@@ -108,12 +111,12 @@ static char* MC_get_lib_name(const char* pathname, struct s_mc_memory_map_re* re
   return libname;
 }
 
-static ssize_t pread_whole(int fd, void *buf, size_t count, off_t offset)
+static ssize_t pread_whole(int fd, void *buf, size_t count, std::uint64_t offset)
 {
   char* buffer = (char*) buf;
   ssize_t real_count = count;
   while (count) {
-    ssize_t res = pread(fd, buffer, count, offset);
+    ssize_t res = pread(fd, buffer, count, (std::int64_t) offset);
     if (res > 0) {
       count  -= res;
       buffer += res;
@@ -547,7 +550,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
       return buffer;
     }
   } else {
-    if (pread_whole(this->memory_file, buffer, size, (off_t) address.address()) < 0)
+    if (pread_whole(this->memory_file, buffer, size, address.address()) < 0)
       xbt_die("Read from process %lli failed", (long long) this->pid_);
     return buffer;
   }