diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-09-19 10:47:07 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-28 14:50:54 -0400 |
commit | dc240c5dc2a02e335c5bcb50ad3a1274818c8609 (patch) | |
tree | eddd6aeca2ce858c2beaba83bf392db6fe6aadfe /tools/lib/api/fs/tracing_path.c | |
parent | ab9c2bdc8947482057b81258c0128952763661cb (diff) |
tools lib api fs: Store tracing mountpoint for better error message
Storing the actual tracing path mountpoint to display correct
error message hint ('Hint:' line). The error hint rediscovers
mountpoints, but it could be different from what we actually
used in tracing path.
Before we'd display debugfs mount even though tracefs was used:
$ perf record -e sched:sched_krava ls
event syntax error: 'sched:sched_krava'
\___ can't access trace events
Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_krava
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug'
...
After this change, correct mountpoint is displayed:
$ perf record -e sched:sched_krava ls
event syntax error: 'sched:sched_krava'
\___ can't access trace events
Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_krava
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
...
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Link: http://lkml.kernel.org/r/1442674027-19427-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fs/tracing_path.c')
-rw-r--r-- | tools/lib/api/fs/tracing_path.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 38aca2dd1946..0406a7d5c891 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c | |||
@@ -12,12 +12,14 @@ | |||
12 | #include "tracing_path.h" | 12 | #include "tracing_path.h" |
13 | 13 | ||
14 | 14 | ||
15 | char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug"; | ||
15 | char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing"; | 16 | char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing"; |
16 | char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events"; | 17 | char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events"; |
17 | 18 | ||
18 | 19 | ||
19 | static void __tracing_path_set(const char *tracing, const char *mountpoint) | 20 | static void __tracing_path_set(const char *tracing, const char *mountpoint) |
20 | { | 21 | { |
22 | snprintf(tracing_mnt, sizeof(tracing_mnt), "%s", mountpoint); | ||
21 | snprintf(tracing_path, sizeof(tracing_path), "%s/%s", | 23 | snprintf(tracing_path, sizeof(tracing_path), "%s/%s", |
22 | mountpoint, tracing); | 24 | mountpoint, tracing); |
23 | snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s", | 25 | snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s", |
@@ -109,19 +111,10 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) | |||
109 | "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); | 111 | "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); |
110 | break; | 112 | break; |
111 | case EACCES: { | 113 | case EACCES: { |
112 | const char *mountpoint = debugfs__mountpoint(); | ||
113 | |||
114 | if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { | ||
115 | const char *tracefs_mntpoint = tracefs__mountpoint(); | ||
116 | |||
117 | if (tracefs_mntpoint) | ||
118 | mountpoint = tracefs__mountpoint(); | ||
119 | } | ||
120 | |||
121 | snprintf(buf, size, | 114 | snprintf(buf, size, |
122 | "Error:\tNo permissions to read %s/%s\n" | 115 | "Error:\tNo permissions to read %s/%s\n" |
123 | "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", | 116 | "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", |
124 | tracing_events_path, filename, mountpoint); | 117 | tracing_events_path, filename, tracing_mnt); |
125 | } | 118 | } |
126 | break; | 119 | break; |
127 | default: | 120 | default: |