#include <iostream>
#include <fstream>
#include <unistd.h>
-#include <sys/types.h>
#include <sstream>
#include <cstring>
#include <string>
#define MYBINARYNAME "model"
#define MYLIBRARYNAME "libmodel.so"
-#define MAPFILE_FORMAT "/proc/%d/maps"
+#define MAPFILE "/proc/self/maps"
SnapshotStack * snapshotObject;
* library to snapshot them.
*/
static void SnapshotGlobalSegments(){
- int pid = getpid();
- char buf[9000], filename[100];
+ char buf[9000];
FILE *map;
- sprintf(filename, MAPFILE_FORMAT, pid);
- map = fopen(filename, "r");
+ map = fopen(MAPFILE, "r");
if (!map) {
perror("fopen");
exit(EXIT_FAILURE);