summaryrefslogtreecommitdiffstats
path: root/base/process_util_openbsd.cc
diff options
context:
space:
mode:
authorrobert.nagy@gmail.com <robert.nagy@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 17:43:05 +0000
committerrobert.nagy@gmail.com <robert.nagy@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 17:43:05 +0000
commitea725b3aa4fe6ffdb15610d3a6a14d620088d878 (patch)
tree8b4a0a3c3feaea7eed557a1f61b486cf290bf7d1 /base/process_util_openbsd.cc
parent2614035cdf017f0fa5902edc833c7300a4e01c4b (diff)
downloadchromium_src-ea725b3aa4fe6ffdb15610d3a6a14d620088d878.zip
chromium_src-ea725b3aa4fe6ffdb15610d3a6a14d620088d878.tar.gz
chromium_src-ea725b3aa4fe6ffdb15610d3a6a14d620088d878.tar.bz2
implement GetProcessExecutablePath() on OpenBSD and start using it
also add a way to override the hardcoded path in PathProviderPosix() to ease development BUG= TEST= Review URL: http://codereview.chromium.org/8390002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_openbsd.cc')
-rw-r--r--base/process_util_openbsd.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/base/process_util_openbsd.cc b/base/process_util_openbsd.cc
index b442e93..67c901f 100644
--- a/base/process_util_openbsd.cc
+++ b/base/process_util_openbsd.cc
@@ -47,7 +47,22 @@ ProcessId GetParentProcessId(ProcessHandle process) {
}
FilePath GetProcessExecutablePath(ProcessHandle process) {
- return FilePath(std::string("/usr/local/chrome/chrome"));
+ struct kinfo_proc kp;
+ size_t len;
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
+ sizeof(struct kinfo_proc), 0 };
+
+ if (sysctl(mib, arraysize(mib), NULL, &len, NULL, 0) == -1)
+ return FilePath();
+ mib[5] = (len / sizeof(struct kinfo_proc));
+ if (sysctl(mib, arraysize(mib), &kp, &len, NULL, 0) < 0)
+ return FilePath();
+ if ((kp.p_flag & P_SYSTEM) != 0)
+ return FilePath();
+ if (strcmp(kp.p_comm, "chrome") == 0)
+ return FilePath(kp.p_comm);
+
+ return FilePath();
}
ProcessIterator::ProcessIterator(const ProcessFilter* filter)