]> sourceware.org Git - systemtap.git/commitdiff
2007-03-19 Frank Ch. Eigler <fche@elastic.org>
authorfche <fche>
Mon, 19 Mar 2007 19:19:38 +0000 (19:19 +0000)
committerfche <fche>
Mon, 19 Mar 2007 19:19:38 +0000 (19:19 +0000)
* 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.

ChangeLog
buildrun.cxx
runtime/ChangeLog
runtime/autoconf-hrtimer-rel.c [new file with mode: 0644]
tapsets.cxx

index de1ea77a084d6ecf2b6d5ed86289ba60276e236f..f81d6e15e8065feec7da7441f372754b98ab542c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 1c5ce0f6788f3988d2b87b95f5517eee60fad3e8..8bd4cc3eb674bb75ccd364e2999355fb80367948 100644 (file)
@@ -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;
 
index 59e7bd979d162e77f015597813c483e94b973654..2b068b5cac27697bcc23b33cd62057c7df2fdac9 100644 (file)
@@ -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 (file)
index 0000000..b7910be
--- /dev/null
@@ -0,0 +1,3 @@
+#include <linux/hrtimer.h>
+
+int x = HRTIMER_REL;  /* as opposed to HRTIMER_MODE_REL */
index 62c087c39cdeb4fa887586f6d864daa794bd6216..54388f5be11bd2cba0876e7fe1023349acd41e71 100644 (file)
@@ -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
This page took 0.046918 seconds and 5 git commands to generate.