[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc@git.kernel.org>
Date: Thu, 25 Jun 2009 10:09:54 GMT
From: tip-bot for Johannes Weiner <hannes@...xchg.org>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
stefani@...bold.net, a.p.zijlstra@...llo.nl, hannes@...xchg.org,
ebiederm@...ssion.com, akpm@...ux-foundation.org,
tglx@...utronix.de, mingo@...e.hu, adobriyan@...il.com
Subject: [tip:perfcounters/urgent] perf record: Fix filemap pathname parsing in /proc/pid/maps
Commit-ID: 76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc
Gitweb: http://git.kernel.org/tip/76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc
Author: Johannes Weiner <hannes@...xchg.org>
AuthorDate: Wed, 24 Jun 2009 21:08:36 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 25 Jun 2009 11:35:58 +0200
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@...xchg.org>
Cc: Stefani Seibold <stefani@...bold.net>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
LKML-Reference: <20090624190835.GA25548@...xchg.org>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 d7ebbd7..9b899ba 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)
continue;
pbf += n + 3;
if (*pbf == 'x') { /* vm_exec */
- char *execname = strrchr(bf, ' ');
+ char *execname = strchr(bf, '/');
- if (execname == NULL || execname[1] != '/')
+ if (execname == NULL)
continue;
- execname += 1;
size = strlen(execname);
execname[size - 1] = '\0'; /* Remove \n */
memcpy(mmap_ev.filename, execname, size);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists