summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--tapsets.cxx19
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b186f5b..7a332695 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-02-23 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 4096
+ * tapsets.cxx (hrtimer_derived_probe_group::emit_module_decls):
+ Adapt the function signature for changes in 2.6.21.
+ (hrtimer_derived_probe_group::emit_module_init): Fix the enum name
+ for 2.6.21 as well.
+
2007-02-19 Frank Ch. Eigler <fche@elastic.org>
PR 4078 and more, including patch from
diff --git a/tapsets.cxx b/tapsets.cxx
index 61bd48c9..eaa719d4 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4771,7 +4771,13 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s)
s.op->newline(-1) << "};";
s.op->newline();
- s.op->newline() << "static int enter_hrtimer_probe (struct hrtimer *timer) {";
+ // The function signature changed in 2.6.21.
+ if (strverscmp(s.kernel_base_release.c_str(), "2.6.21") < 0)
+ s.op->newline() << "static int ";
+ else
+ s.op->newline() << "static enum hrtimer_restart ";
+ s.op->line() << "enter_hrtimer_probe (struct hrtimer *timer) {";
+
s.op->newline(1) << "int rc = HRTIMER_NORESTART;";
s.op->newline() << "struct stap_hrtimer_probe *stp = container_of(timer, struct stap_hrtimer_probe, hrtimer);";
s.op->newline() << "if ((atomic_read (&session_state) == STAP_SESSION_STARTING) ||";
@@ -4797,8 +4803,15 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s)
void
hrtimer_derived_probe_group::emit_module_init (systemtap_session& s)
{
+ const char *rel;
if (probes.empty()) return;
+ // The enumeration names changed in 2.6.21.
+ if (strverscmp(s.kernel_base_release.c_str(), "2.6.21") < 0)
+ rel = "HRTIMER_REL";
+ else
+ rel = "HRTIMER_MODE_REL";
+
s.op->newline() << "{";
s.op->newline(1) << "struct timespec res;";
s.op->newline() << "hrtimer_get_res (CLOCK_MONOTONIC, &res);";
@@ -4808,13 +4821,13 @@ hrtimer_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline() << "for (i=0; i<" << probes.size() << "; i++) {";
s.op->newline(1) << "struct stap_hrtimer_probe* stp = & stap_hrtimer_probes [i];";
s.op->newline() << "probe_point = stp->pp;";
- s.op->newline() << "hrtimer_init (& stp->hrtimer, CLOCK_MONOTONIC, HRTIMER_REL);";
+ s.op->newline() << "hrtimer_init (& stp->hrtimer, CLOCK_MONOTONIC, " << rel << ");";
s.op->newline() << "stp->hrtimer.function = & enter_hrtimer_probe;";
// There is no hrtimer field to identify *this* (i-th) probe handler
// callback. So instead we'll deduce it at entry time.
s.op->newline() << "(void) hrtimer_start (& stp->hrtimer, ";
emit_interval (s.op);
- s.op->line() << ", HRTIMER_REL);";
+ s.op->line() << ", " << rel << ");";
// Note: no partial failure rollback is needed: hrtimer_start only
// "fails" if the timer was already active, which cannot be.
s.op->newline(-1) << "}"; // for loop