diff options
author | fche <fche> | 2007-03-19 19:19:38 +0000 |
---|---|---|
committer | fche <fche> | 2007-03-19 19:19:38 +0000 |
commit | 255e4c681ec42ab8a88ac60d1a31fd8209a90fb1 (patch) | |
tree | 7905fbb9c92fd717937ded0be75a38c89dad8ef4 | |
parent | 99c3c059961e9abdf76b92e9ab22fe26b929ec20 (diff) | |
download | systemtap-steved-255e4c681ec42ab8a88ac60d1a31fd8209a90fb1.tar.gz systemtap-steved-255e4c681ec42ab8a88ac60d1a31fd8209a90fb1.tar.xz systemtap-steved-255e4c681ec42ab8a88ac60d1a31fd8209a90fb1.zip |
2007-03-19 Frank Ch. Eigler <fche@elastic.org>
* buildrun.cxx (compile_pass): Emit kbuild-time autoconf widgets
to customize runtime or translator C code to actual kernel rather
than kernel version string. Thanks to FC 2.6."20" for the nudge.
* tapsets.cxx (hrtimer*emit_module): First client: HRTIMER_{MODE_}REL.
2007-03-19 Frank Ch. Eigler <fche@elastic.org>
* autoconf-hrtimer-rel.c: New file.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | buildrun.cxx | 14 | ||||
-rw-r--r-- | runtime/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/autoconf-hrtimer-rel.c | 3 | ||||
-rw-r--r-- | tapsets.cxx | 27 |
5 files changed, 41 insertions, 15 deletions
@@ -1,3 +1,10 @@ +2007-03-19 Frank Ch. Eigler <fche@elastic.org> + + * buildrun.cxx (compile_pass): Emit kbuild-time autoconf widgets + to customize runtime or translator C code to actual kernel rather + than kernel version string. Thanks to FC 2.6."20" for the nudge. + * tapsets.cxx (hrtimer*emit_module): First client: HRTIMER_{MODE_}REL. + 2007-03-17 Frank Ch. Eigler <fche@elastic.org> * configure.ac: Tweak missing elfutils error message. diff --git a/buildrun.cxx b/buildrun.cxx index 1c5ce0f6..8bd4cc3e 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -1,5 +1,5 @@ // build/run probes -// Copyright (C) 2005, 2006 Red Hat Inc. +// Copyright (C) 2005-2007 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -39,6 +39,18 @@ compile_pass (systemtap_session& s) // Create makefile + // Clever hacks copied from vmware modules + o << "stap_check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo \"$(1)\"; else echo \"$(2)\"; fi)" << endl; + o << "stap_check_build = " /* << "set -x; " */ << "$(shell if $(CC) $(CPPFLAGS) $(CFLAGS_KERNEL) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=\\\"" << s.module_name << "\\\" -Werror -S -o /dev/null -xc $(1) > /dev/null 2>&1; then echo \"$(2)\"; else echo \"$(3)\"; fi)" << endl; + + o << "SYSTEMTAP_RUNTIME = \"" << s.runtime_path << "\"" << endl; + + // "autoconf" options go here + + // enum hrtimer_mode renaming near 2.6.21; see tapsets.cxx hrtimer_derived_probe_group::emit_module_decls + o << "CFLAGS += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-hrtimer-rel.c, -DSTAPCONF_HRTIMER_REL,)" << endl; + + for (unsigned i=0; i<s.macros.size(); i++) o << "CFLAGS += -D " << lex_cast_qstring(s.macros[i]) << endl; diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 59e7bd97..2b068b5c 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,4 +1,9 @@ +2007-03-19 Frank Ch. Eigler <fche@elastic.org> + + * autoconf-hrtimer-rel.c: New file. + 2007-03-18 Martin Hunt <hunt@redhat.com> + * stack.c, string.c, sym.c, transport/symbols.c: Fix some signed vs unsigned comparison warnings. diff --git a/runtime/autoconf-hrtimer-rel.c b/runtime/autoconf-hrtimer-rel.c new file mode 100644 index 00000000..b7910be8 --- /dev/null +++ b/runtime/autoconf-hrtimer-rel.c @@ -0,0 +1,3 @@ +#include <linux/hrtimer.h> + +int x = HRTIMER_REL; /* as opposed to HRTIMER_MODE_REL */ diff --git a/tapsets.cxx b/tapsets.cxx index 62c087c3..54388f5b 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -4802,12 +4802,18 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline(-1) << "};"; s.op->newline(); + // autoconf: adapt to HRTIMER_REL -> HRTIMER_MODE_REL renaming near 2.6.21 + s.op->newline() << "#ifdef STAPCONF_HRTIMER_REL"; + s.op->newline() << "#define HRTIMER_MODE_REL HRTIMER_REL"; + s.op->newline() << "#endif"; + // 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() << "#ifdef STAPCONF_HRTIMER_REL"; + s.op->newline() << "static int "; + s.op->newline() << "#else"; + s.op->newline() << "static enum hrtimer_restart "; + s.op->newline() << "#endif"; + s.op->newline() << "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);"; @@ -4834,15 +4840,8 @@ 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);"; @@ -4852,13 +4851,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, " << rel << ");"; + s.op->newline() << "hrtimer_init (& stp->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_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() << ", " << rel << ");"; + s.op->line() << ", HRTIMER_MODE_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 |