summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-10-13 11:55:11 -0400
committerDave Brolley <brolley@redhat.com>2009-10-13 11:55:11 -0400
commitf990359bd63bd4fc21e600e71c6a513d5b5b2ccb (patch)
tree16fb7638f2089476b2994ec7d8b2131e4a7b0b69 /main.cxx
parent8f6d8c2bd3e5c1d2881e2ebe1c7ad5deb389e581 (diff)
parentba9abf303e1bed196668f103b2a17c48e3df70aa (diff)
downloadsystemtap-steved-f990359bd63bd4fc21e600e71c6a513d5b5b2ccb.tar.gz
systemtap-steved-f990359bd63bd4fc21e600e71c6a513d5b5b2ccb.tar.xz
systemtap-steved-f990359bd63bd4fc21e600e71c6a513d5b5b2ccb.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx32
1 files changed, 29 insertions, 3 deletions
diff --git a/main.cxx b/main.cxx
index 86990675..c0ff3ba5 100644
--- a/main.cxx
+++ b/main.cxx
@@ -335,8 +335,8 @@ setup_signals (sighandler_t handler)
sigaction (SIGTERM, &sa, NULL);
}
-void
-setup_kernel_release (systemtap_session &s, const char* kstr) {
+void setup_kernel_release (systemtap_session &s, const char* kstr)
+{
if (kstr[0] == '/') // fully specified path
{
s.kernel_build_tree = kstr;
@@ -364,6 +364,29 @@ setup_kernel_release (systemtap_session &s, const char* kstr) {
}
}
+
+void parse_kernel_config (systemtap_session &s)
+{
+ // PR10702: pull config options
+ string kernel_config_file = s.kernel_build_tree + "/.config";
+ ifstream kcf (kernel_config_file.c_str());
+ string line;
+ while (getline (kcf, line))
+ {
+ if (line.substr(0, 7) != "CONFIG_") continue;
+ size_t off = line.find('=');
+ if (off == string::npos) continue;
+ string key = line.substr(0, off);
+ string value = line.substr(off+1, string::npos);
+ s.kernel_config[key] = value;
+ }
+ if (s.verbose > 2)
+ clog << "Parsed kernel \"" << kernel_config_file << "\", number of tuples: " << s.kernel_config.size() << endl;
+
+ kcf.close();
+}
+
+
static void
checkOptions (systemtap_session &s)
{
@@ -945,6 +968,9 @@ main (int argc, char * const argv [])
clog << "Created temporary directory \"" << s.tmpdir << "\"" << endl;
}
+ // Now that no further changes to s.kernel_build_tree can occur, let's use it.
+ parse_kernel_config (s);
+
// Create the name of the C source file within the temporary
// directory.
s.translated_source = string(s.tmpdir) + "/" + s.module_name + ".c";
@@ -1028,7 +1054,7 @@ main (int argc, char * const argv [])
// GLOB_NOMATCH is acceptable
if (s.verbose>1 && globbuf.gl_pathc > 0)
- clog << "Searched '" << dir << "', "
+ clog << "Searched \"" << dir << "\", "
<< "found " << globbuf.gl_pathc << endl;
for (unsigned j=0; j<globbuf.gl_pathc; j++)