diff options
author | jistone <jistone> | 2007-02-23 23:16:57 +0000 |
---|---|---|
committer | jistone <jistone> | 2007-02-23 23:16:57 +0000 |
commit | 5dbd55d7b4012a10e41c18ebaaddfb534c1b9196 (patch) | |
tree | 119421f5f428f0c17cd7ba173728dfd721db7170 /tapsets.cxx | |
parent | 03ad4de1bd9548911ed99d9b6dcd7a18ed06794b (diff) | |
download | systemtap-steved-5dbd55d7b4012a10e41c18ebaaddfb534c1b9196.tar.gz systemtap-steved-5dbd55d7b4012a10e41c18ebaaddfb534c1b9196.tar.xz systemtap-steved-5dbd55d7b4012a10e41c18ebaaddfb534c1b9196.zip |
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.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
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 |