summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch')
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch b/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch
new file mode 100644
index 0000000000..45cab7d3d8
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch
@@ -0,0 +1,120 @@
1oprofile: Determine the root home directory dynamically
2
3This commit detects the root home directory dynamically with changes to
4the opcontrol script and the oprofile gui app source.
5
6The commit replaces an earlier fix that detected and adjusted a
7'non-standard' root home directory at build time. The advantage of this
8patch is that the oprofile tools are adjusted to the current run-time
9path to ~root, not the build time path.
10
11Upstream-Status: inappropriate [OE specific]
12
13Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
14
15diff --git a/doc/opcontrol.1.in b/doc/opcontrol.1.in
16index c434704..f57eb76 100644
17--- a/doc/opcontrol.1.in
18+++ b/doc/opcontrol.1.in
19@@ -171,7 +171,7 @@ No special environment variables are recognised by opcontrol.
20
21 .SH FILES
22 .TP
23-.I /root/.oprofile/daemonrc
24+.I ~root/.oprofile/daemonrc
25 Configuration file for opcontrol
26 .TP
27 .I /var/lib/oprofile/samples/
28diff --git a/doc/oprofile.1.in b/doc/oprofile.1.in
29index 3d0f0ed..5c623e1 100644
30--- a/doc/oprofile.1.in
31+++ b/doc/oprofile.1.in
32@@ -150,7 +150,7 @@ No special environment variables are recognised by oprofile.
33 .I $HOME/.oprofile/
34 Configuration files
35 .TP
36-.I /root/.oprofile/daemonrc
37+.I ~root/.oprofile/daemonrc
38 Configuration file for opcontrol
39 .TP
40 .I @prefix@/share/oprofile/
41diff --git a/doc/oprofile.html b/doc/oprofile.html
42index 128d9f7..d7e4dea 100644
43--- a/doc/oprofile.html
44+++ b/doc/oprofile.html
45@@ -1394,7 +1394,7 @@ The <span class="command"><strong>opcontrol</strong></span> script provides the
46 <dd>
47 <p>
48 Followed by list arguments for profiling set up. List of arguments
49- saved in <code class="filename">/root/.oprofile/daemonrc</code>.
50+ saved in <code class="filename">~root/.oprofile/daemonrc</code>.
51 Giving this option is not necessary; you can just directly pass one
52 of the setup options, e.g. <span class="command"><strong>opcontrol --no-vmlinux</strong></span>.
53 </p>
54@@ -1430,7 +1430,7 @@ The <span class="command"><strong>opcontrol</strong></span> script provides the
55 <dd>
56 <p>
57 Start data collection with either arguments provided by <code class="option">--setup</code>
58- or information saved in <code class="filename">/root/.oprofile/daemonrc</code>. Specifying
59+ or information saved in <code class="filename">~root/.oprofile/daemonrc</code>. Specifying
60 the addition <code class="option">--verbose</code> makes the daemon generate lots of debug data
61 whilst it is running.
62 </p>
63diff --git a/doc/oprofile.xml b/doc/oprofile.xml
64index 6a17c6d..0968d76 100644
65--- a/doc/oprofile.xml
66+++ b/doc/oprofile.xml
67@@ -568,7 +568,7 @@ The <command>opcontrol</command> script provides the following actions :
68 <term><option>--setup</option></term>
69 <listitem><para>
70 Followed by list arguments for profiling set up. List of arguments
71- saved in <filename>/root/.oprofile/daemonrc</filename>.
72+ saved in <filename>~root/.oprofile/daemonrc</filename>.
73 Giving this option is not necessary; you can just directly pass one
74 of the setup options, e.g. <command>opcontrol --no-vmlinux</command>.
75 </para></listitem>
76@@ -592,7 +592,7 @@ The <command>opcontrol</command> script provides the following actions :
77 <term><option>--start</option></term>
78 <listitem><para>
79 Start data collection with either arguments provided by <option>--setup</option>
80- or information saved in <filename>/root/.oprofile/daemonrc</filename>. Specifying
81+ or information saved in <filename>~root/.oprofile/daemonrc</filename>. Specifying
82 the addition <option>--verbose</option> makes the daemon generate lots of debug data
83 whilst it is running.
84 </para></listitem>
85diff --git a/gui/oprof_start_util.cpp b/gui/oprof_start_util.cpp
86index d293431..d13fa8f 100644
87--- a/gui/oprof_start_util.cpp
88+++ b/gui/oprof_start_util.cpp
89@@ -20,6 +20,8 @@
90 #include <iostream>
91 #include <fstream>
92 #include <cstdlib>
93+#include <sys/types.h>
94+#include <pwd.h>
95
96 #include <qfiledialog.h>
97 #include <qmessagebox.h>
98@@ -39,7 +41,8 @@ namespace {
99 // return the ~ expansion suffixed with a '/'
100 string const get_config_dir()
101 {
102- return "/root";
103+ struct *pw = getpwnam("root");
104+ return pw->pw_dir;
105 }
106
107 string daemon_pid;
108diff --git a/utils/opcontrol b/utils/opcontrol
109index 09fa5a7..a8acdae 100644
110--- a/utils/opcontrol
111+++ b/utils/opcontrol
112@@ -385,7 +385,7 @@ do_init()
113 OPROFILED="$OPDIR/oprofiled"
114
115 # location for daemon setup information
116- SETUP_DIR="/root/.oprofile"
117+ SETUP_DIR="`grep root /etc/passwd | cut -d: -f6`/.oprofile"
118 SETUP_FILE="$SETUP_DIR/daemonrc"
119 SEC_SETUP_FILE="$SETUP_DIR/daemonrc_new"
120