summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2010-03-18 10:18:47 -0400
committerFrank Ch. Eigler <fche@elastic.org>2010-03-18 10:18:47 -0400
commit9e62f7bafd9fae1f6d455a26fbacb1c96c631d61 (patch)
treefd8ba70b5f09c648599f7b1957a1f38387c60d01
parent88a7bbdc89c4fe51c26fefc6a8c69909e090fc70 (diff)
downloadsystemtap-steved-9e62f7bafd9fae1f6d455a26fbacb1c96c631d61.tar.gz
systemtap-steved-9e62f7bafd9fae1f6d455a26fbacb1c96c631d61.tar.xz
systemtap-steved-9e62f7bafd9fae1f6d455a26fbacb1c96c631d61.zip
autoconf: standardize CPU_KHZ based on session kernel_exports
* buildrun.cxx (output_cpu_khz): Replace with generalized output_exportconf().
-rw-r--r--buildrun.cxx46
1 files changed, 11 insertions, 35 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 0140c69f..89fa0177 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -90,43 +90,19 @@ output_autoconf(systemtap_session& s, ofstream& o, const char *autoconf_c,
o << "; fi >> $@" << endl;
}
-void output_cpu_khz (systemtap_session& s, ofstream& o)
+
+void output_exportconf(systemtap_session& s, ofstream& o, const char *symbol,
+ const char *deftrue)
{
- // PR10493: search cpu_khz in Module.symvers
- string kernel_export_file = s.kernel_build_tree + "/Module.symvers";
- char *line = NULL, *name = NULL, *module = NULL, *type = NULL;
- size_t len = 0;
- unsigned long address;
- int ret;
- FILE *sym = fopen(kernel_export_file.c_str(),"r");
-
- if (sym == NULL)
- return;
- while (!feof(sym))
- {
- if (getline(&line, &len, sym) < 0)
- break;
- ret = sscanf(line, "%lx %as %as %as", &address, &name, &module, &type);
- if (name == NULL || module == NULL || type == NULL)
- continue;
- if (ret == 4) {
- // cpu_khz is kernel EXPORT_SYMBOL'd
- if (!strcmp(name, "cpu_khz") && !strcmp(module, "vmlinux")
- && strstr(type, "EXPORT_SYMBOL")) // match all to avoid corrupt file
- {
- o << "\t";
- if (s.verbose < 4)
- o << "@";
- o << "echo \"#define STAPCONF_CPU_KHZ 1\"";
- o << ">> $@" << endl;
- break;
- }
- }
- }
- if (sym)
- fclose(sym);
+ o << "\t";
+ if (s.verbose < 4)
+ o << "@";
+ if (s.kernel_exports.find(symbol) != s.kernel_exports.end())
+ o << "echo \"#define " << deftrue << " 1\"";
+ o << ">> $@" << endl;
}
+
int
compile_pass (systemtap_session& s)
{
@@ -204,7 +180,7 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-trace-printk.c", "STAPCONF_TRACE_PRINTK", NULL);
output_autoconf(s, o, "autoconf-regset.c", "STAPCONF_REGSET", NULL);
output_autoconf(s, o, "autoconf-utrace-regset.c", "STAPCONF_UTRACE_REGSET", NULL);
- output_cpu_khz(s, o);
+ output_exportconf(s, o, "cpu_khz", "STAPCONF_CPU_KHZ");
#if 0
/* NB: For now, the performance hit of probe_kernel_read/write (vs. our