Add modify timestamp check for libbcc and libRS.
diff --git a/lib/bcc/Compiler.cpp b/lib/bcc/Compiler.cpp
index 1bb5797..01c513a 100644
--- a/lib/bcc/Compiler.cpp
+++ b/lib/bcc/Compiler.cpp
@@ -106,7 +106,6 @@
#include <string>
#include <vector>
-
namespace {
#define TEMP_FAILURE_RETRY1(exp) ({ \
@@ -135,6 +134,21 @@
return 0;
}
+inline uint32_t statModifyTime(char const *filepath) {
+ struct stat st;
+
+ if (stat(filepath, &st) < 0) {
+ LOGE("Unable to stat \'%s\', with reason: %s\n", filepath, strerror(errno));
+ return 0;
+ }
+
+ return static_cast<uint32_t>(st.st_mtime);
+}
+
+static char const libRSPath[] = "/system/lib/libRS.so";
+
+static char const libBccPath[] = "/system/lib/libbcc.so";
+
} // namespace anonymous
@@ -1297,8 +1311,8 @@
// Timestamp
hdr->sourceWhen = 0; // TODO(all)
hdr->rslibWhen = 0; // TODO(all)
- hdr->libRSWhen = 0; // TODO(all)
- hdr->libbccWhen = 0; // TODO(all)
+ hdr->libRSWhen = statModifyTime(libRSPath);
+ hdr->libbccWhen = statModifyTime(libBccPath);
// Current Memory Address (Saved for Recalculation)
hdr->cachedCodeDataAddr = reinterpret_cast<uint32_t>(mCodeDataAddr);
@@ -1597,8 +1611,8 @@
// XXX
uint32_t sourceWhen = 0;
uint32_t rslibWhen = 0;
- uint32_t libRSWhen = 0;
- uint32_t libbccWhen = 0;
+ uint32_t libRSWhen = statModifyTime(libRSPath);
+ uint32_t libbccWhen = statModifyTime(libBccPath);
if (!checkHeaderAndDependencies(fd,
sourceWhen,
rslibWhen,