summaryrefslogtreecommitdiff
path: root/library/Process-linux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/Process-linux.cpp')
-rw-r--r--library/Process-linux.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp
index fe864784..1fecbab7 100644
--- a/library/Process-linux.cpp
+++ b/library/Process-linux.cpp
@@ -27,6 +27,7 @@ distribution.
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/time.h>
#include <string>
#include <vector>
@@ -126,6 +127,9 @@ void Process::getMemRanges( vector<t_memrange> & ranges )
char permissions[5]; // r/-, w/-, x/-, p/s, 0
FILE *mapFile = ::fopen("/proc/self/maps", "r");
+ if (!mapFile)
+ return;
+
size_t start, end, offset, device1, device2, node;
while (fgets(buffer, 1024, mapFile))
@@ -147,6 +151,8 @@ void Process::getMemRanges( vector<t_memrange> & ranges )
temp.valid = true;
ranges.push_back(temp);
}
+
+ fclose(mapFile);
}
uint32_t Process::getBase()
@@ -192,6 +198,13 @@ bool Process::getThreadIDs(vector<uint32_t> & threads )
return true;
}
+uint32_t Process::getTickCount()
+{
+ struct timeval tp;
+ gettimeofday(&tp, NULL);
+ return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}
+
string Process::getPath()
{
const char * cwd_name = "/proc/self/cwd";