summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--translate.cxx27
2 files changed, 25 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a0d6bf2..1fe67b59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2006-11-21 Frank Ch. Eigler <fche@elastic.org>
+ * translate.cxx (emit_module_init): Adapt to 2.6.19 utsname().
+
+2006-11-21 Frank Ch. Eigler <fche@elastic.org>
+
PR 3556.
* translate.cxx (emit_module_init): Emit code to check
system_utsname against translate-time version/machine strings.
diff --git a/translate.cxx b/translate.cxx
index 96efa002..09c51a6e 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -991,26 +991,41 @@ c_unparser::emit_module_init ()
// one may install the incorrect debuginfo or -devel RPM, and try to
// run a probe compiled for a different version. Catch this early,
// just in case modversions didn't.
- o->newline() << "if (strcmp (system_utsname.machine, "
+ o->newline() << "down_read (& uts_sem);";
+ o->newline() << "{";
+ o->indent(1);
+
+ // Args, linux 2.6.19+ did a switcheroo on system_utsname to utsname().
+ o->newline() << "#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)";
+ o->newline() << "const char* machine = utsname()->machine;";
+ o->newline() << "const char* release = utsname()->release;";
+ o->newline() << "#else";
+ o->newline() << "const char* machine = system_utsname.machine;";
+ o->newline() << "const char* release = system_utsname.release;";
+ o->newline() << "#endif";
+
+ o->newline() << "if (strcmp (machine, "
<< lex_cast_qstring (session->architecture) << ")) {";
o->newline(1) << "_stp_error (\"module machine mismatch (%s vs %s)\", "
- << "system_utsname.machine, "
+ << "machine, "
<< lex_cast_qstring (session->architecture)
<< ");";
o->newline() << "rc = -EINVAL;";
- o->newline() << "goto out;";
o->newline(-1) << "}";
- o->newline() << "if (strcmp (system_utsname.release, "
+ o->newline() << "if (strcmp (release, "
<< lex_cast_qstring (session->kernel_release) << ")) {";
o->newline(1) << "_stp_error (\"module release mismatch (%s vs %s)\", "
- << "system_utsname.release, "
+ << "release, "
<< lex_cast_qstring (session->kernel_release)
<< ");";
o->newline() << "rc = -EINVAL;";
- o->newline() << "goto out;";
o->newline(-1) << "}";
+ o->newline(-1) << "}";
+ o->newline() << "up_read (& uts_sem);";
+ o->newline() << "if (rc) goto out;";
+
o->newline() << "(void) probe_point;";
o->newline() << "(void) i;";
o->newline() << "(void) j;";