diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2009-06-24 15:08:36 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-25 05:35:58 -0400 |
commit | 76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc (patch) | |
tree | a970aa801aa903dd58aa53ac75c5caa7f4c9ab9c | |
parent | 1b173f77dd0d5fd4f0ff18034aaa79e30da068b9 (diff) |
perf record: Fix filemap pathname parsing in /proc/pid/maps
Looking backward for the first space from the end of a line in
/proc/pid/maps does not find the start of the pathname of the mapped
file if it contains a space.
Since the only slashes we have in this file occur in the (absolute!)
pathname column of file mappings, looking for the first slash in a
line is a safe method to find the name.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Stefani Seibold <stefani@seibold.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090624190835.GA25548@cmpxchg.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-record.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d7ebbd757543..9b899ba1b410 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -306,12 +306,11 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
306 | continue; | 306 | continue; |
307 | pbf += n + 3; | 307 | pbf += n + 3; |
308 | if (*pbf == 'x') { /* vm_exec */ | 308 | if (*pbf == 'x') { /* vm_exec */ |
309 | char *execname = strrchr(bf, ' '); | 309 | char *execname = strchr(bf, '/'); |
310 | 310 | ||
311 | if (execname == NULL || execname[1] != '/') | 311 | if (execname == NULL) |
312 | continue; | 312 | continue; |
313 | 313 | ||
314 | execname += 1; | ||
315 | size = strlen(execname); | 314 | size = strlen(execname); |
316 | execname[size - 1] = '\0'; /* Remove \n */ | 315 | execname[size - 1] = '\0'; /* Remove \n */ |
317 | memcpy(mmap_ev.filename, execname, size); | 316 | memcpy(mmap_ev.filename, execname, size); |