public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Johannes Weiner <hannes@cmpxchg.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	stefani@seibold.net, a.p.zijlstra@chello.nl, hannes@cmpxchg.org,
	ebiederm@xmission.com, akpm@linux-foundation.org,
	tglx@linutronix.de, mingo@elte.hu, adobriyan@gmail.com
Subject: [tip:perfcounters/urgent] perf record: Fix filemap pathname parsing in /proc/pid/maps
Date: Thu, 25 Jun 2009 10:09:54 GMT	[thread overview]
Message-ID: <tip-76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc@git.kernel.org> (raw)
In-Reply-To: <20090624190835.GA25548@cmpxchg.org>

Commit-ID:  76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc
Gitweb:     http://git.kernel.org/tip/76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc
Author:     Johannes Weiner <hannes@cmpxchg.org>
AuthorDate: Wed, 24 Jun 2009 21:08:36 +0200
Committer:  Ingo Molnar <mingo@elte.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@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>


---
 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);

  parent reply	other threads:[~2009-06-25 10:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200906182243.n5IMhwuV003008@imap1.linux-foundation.org>
     [not found] ` <1245824444.22613.3.camel@wall-e>
     [not found]   ` <20090623233247.7ed661b7.akpm@linux-foundation.org>
2009-06-24  6:45     ` [merged] proctxt-update-kernel-filesystem-proctxt-documentation.patch removed from -mm tree Stefani Seibold
2009-06-24  7:13       ` Andrew Morton
2009-06-24  7:35         ` Eric W. Biederman
2009-06-24  9:33           ` Stefani Seibold
2009-06-24 15:30             ` Andrew Morton
2009-06-24 15:57               ` Stefani Seibold
2009-06-24 12:03           ` [patch 2/2] procfs: provide stack information for threads V0.9 Stefani Seibold
2009-06-24 14:33           ` [patch 2/2] procfs: provide stack information for threads V0.10 Stefani Seibold
2009-06-24 15:20             ` Ingo Molnar
2009-06-24 15:49               ` Stefani Seibold
2009-06-24 17:40                 ` Johannes Weiner
2009-06-24 17:46                   ` Ingo Molnar
2009-06-24 19:08                     ` Johannes Weiner
2009-06-25  9:36                       ` Ingo Molnar
2009-06-25 10:09                       ` tip-bot for Johannes Weiner [this message]
2009-06-24 16:28           ` [patch 2/2] procfs: provide stack information for threads V0.11 Stefani Seibold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-76c64c5e4c47b6d28deb3cae8dfa07a93c2229dc@git.kernel.org \
    --to=hannes@cmpxchg.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=stefani@seibold.net \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox