summaryrefslogtreecommitdiffstats
path: root/chrome/tools
diff options
context:
space:
mode:
authormarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 19:48:18 +0000
committermarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 19:48:18 +0000
commit9e34d62aa2c447dcb7309fb147fbfbff2b6d9b8d (patch)
treee444e545f4cb35466304ca2e95a66ca07d02d3e1 /chrome/tools
parent9665ffee4518150a6a3220eec229a7a822c575a0 (diff)
downloadchromium_src-9e34d62aa2c447dcb7309fb147fbfbff2b6d9b8d.zip
chromium_src-9e34d62aa2c447dcb7309fb147fbfbff2b6d9b8d.tar.gz
chromium_src-9e34d62aa2c447dcb7309fb147fbfbff2b6d9b8d.tar.bz2
Minor performance improvement. Use "ps" instead of "sed" to find parent
processes. And properly mark variables as local, so that the exit code from "identify" is correct. Otherwise, we needlessly scan for more processes when returning from "identify". TEST=none BUG=none Review URL: http://codereview.chromium.org/3173046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rwxr-xr-xchrome/tools/chrome-process-identifier3
1 files changed, 2 insertions, 1 deletions
diff --git a/chrome/tools/chrome-process-identifier b/chrome/tools/chrome-process-identifier
index ece1669..770529b 100755
--- a/chrome/tools/chrome-process-identifier
+++ b/chrome/tools/chrome-process-identifier
@@ -28,7 +28,7 @@ fi
ls -l "/proc/$pid/exe" 2>/dev/null|egrep -q '/chrome$' || {
echo "Cannot find any running instance of Chrome" >&2; exit 1; }
while :; do
- ppid=$(sed 's/PPid:[^0-9]*//;t1;d;:1;q' /proc/$pid/status 2>/dev/null)
+ ppid="$(ps h --format ppid --pid "$pid" 2>/dev/null)"
[ -n "$ppid" ] || {
echo "Cannot find any running instance of Chrome" >&2; exit 1; }
ls "/proc/$ppid/exe" 2>/dev/null|egrep -q '/chrome$' && pid="$ppid" || break
@@ -36,6 +36,7 @@ done
# Iterate over child processes and try to identify them
identify() {
+ local child cmd foundzygote plugin seccomp type
foundzygote=0
for child in $(ps h --format pid --ppid $1); do
cmd="$(xargs -0 </proc/$child/cmdline|sed 's/ -/\n-/g')" 2>/dev/null