summaryrefslogtreecommitdiffstats
path: root/hash.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-07-23 12:43:03 -0400
committerDave Brolley <brolley@redhat.com>2009-07-23 12:43:03 -0400
commitc04c525de43003fb00612df635a7c819b5a1d645 (patch)
tree22cd1e41f84a66d7eaece8e17138bf83427f4bab /hash.cxx
parent6c456acd35009630facd95cca91483a92aa50e9f (diff)
parent4a8636a307a9a532dcc60b5ad8bf809a20dc24c3 (diff)
downloadsystemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.tar.gz
systemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.tar.xz
systemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'hash.cxx')
-rw-r--r--hash.cxx31
1 files changed, 16 insertions, 15 deletions
diff --git a/hash.cxx b/hash.cxx
index 45ae05eb..eac22f48 100644
--- a/hash.cxx
+++ b/hash.cxx
@@ -52,12 +52,12 @@ hash::add_file(const std::string& filename)
{
struct stat st;
- if (stat(filename.c_str(), &st) == 0)
- {
- add(filename);
- add(st.st_size);
- add(st.st_mtime);
- }
+ if (stat(filename.c_str(), &st) != 0)
+ st.st_size = st.st_mtime = -1;
+
+ add(filename);
+ add(st.st_size);
+ add(st.st_mtime);
}
@@ -256,26 +256,27 @@ find_hash (systemtap_session& s, const string& script)
}
-void
-find_tracequery_hash (systemtap_session& s)
+string
+find_tracequery_hash (systemtap_session& s, const string& header)
{
hash h;
get_base_hash(s, h);
- // The basic hash should be good enough for the tracepoint query module
+ // Add the tracepoint header to the computed hash
+ h.add_file(header);
// Get the directory path to store our cached module
string result, hashdir;
h.result(result);
if (!create_hashdir(s, result, hashdir))
- return;
+ return "";
- s.tracequery_path = hashdir + "/tracequery_" + result + ".ko";
+ return hashdir + "/tracequery_" + result + ".ko";
}
-void
-find_typequery_hash (systemtap_session& s, const string& name, string& module)
+string
+find_typequery_hash (systemtap_session& s, const string& name)
{
hash h;
get_base_hash(s, h);
@@ -287,9 +288,9 @@ find_typequery_hash (systemtap_session& s, const string& name, string& module)
string result, hashdir;
h.result(result);
if (!create_hashdir(s, result, hashdir))
- return;
+ return "";
- module = hashdir + "/typequery_" + result
+ return hashdir + "/typequery_" + result
+ (name[0] == 'k' ? ".ko" : ".so");
}