]> sourceware.org Git - systemtap.git/commitdiff
tracepoints: Cache an empty file for failures
authorJosh Stone <jistone@redhat.com>
Tue, 11 Oct 2011 20:13:40 +0000 (13:13 -0700)
committerJosh Stone <jistone@redhat.com>
Tue, 11 Oct 2011 21:23:42 +0000 (14:23 -0700)
When a tracepoint header doesn't compile for any reason, we'd like not
to keep trying on subsequent runs.  This patch restores previous
behavior that would save an empty file in the cache, signaling that
we've tried this header before and can't get anything from it.

* tapsets.cxx (tracepoint_builder::get_tracequery_modules): When reading
  from the cache, note and skip empty files.  When saving to the cache,
  copy /dev/null for those that failed to compile.

tapsets.cxx

index 1edb54885f1a90c0304293c5ab1ede7eb049b297..62c6d1f78335da588bec2d7b207ed06744d7e4d4 100644 (file)
@@ -9105,7 +9105,10 @@ tracepoint_builder::get_tracequery_modules(systemtap_session& s,
           {
             if (s.verbose > 2)
               clog << _F("Pass 2: using cached %s", tracequery_path.c_str()) << endl;
-            modules.push_back (tracequery_path);
+
+            // an empty file is a cached failure
+            if (get_file_size(tracequery_path) > 0)
+              modules.push_back (tracequery_path);
           }
         else
           uncached_headers.push_back(headers[i]);
@@ -9177,12 +9180,15 @@ tracepoint_builder::get_tracequery_modules(systemtap_session& s,
       {
         const string& header = uncached_headers[i];
         const string& tracequery_ko = tracequery_kos[header];
+        const string& tracequery_path = headers_cacheko[header];
         if (tracequery_ko !="" && file_exists(tracequery_ko))
           {
-            const string& tracequery_path = headers_cacheko[header];
             copy_file(tracequery_ko, tracequery_path, s.verbose > 2);
             modules.push_back (tracequery_path);
           }
+        else
+          // cache an empty file for failures
+          copy_file("/dev/null", tracequery_path, s.verbose > 2);
       }
 }
 
This page took 0.036079 seconds and 5 git commands to generate.