summaryrefslogtreecommitdiffstats
path: root/base/process_util.h
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 20:19:43 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 20:19:43 +0000
commitab0e2220a2038f42c47ce6cf68691cc0e24b3eb0 (patch)
treecf5e39e527fd11e4f3b7131f58c8a31f0656773d /base/process_util.h
parentb44ff1e7456978b4e8cfcd3f61932e96bcbca2be (diff)
downloadchromium_src-ab0e2220a2038f42c47ce6cf68691cc0e24b3eb0.zip
chromium_src-ab0e2220a2038f42c47ce6cf68691cc0e24b3eb0.tar.gz
chromium_src-ab0e2220a2038f42c47ce6cf68691cc0e24b3eb0.tar.bz2
Port GetProcessCount(), KillProcesses(), and CleanupProcesses().
Also switch to fork() from vfork(), since strace on my box doesn't support vfork! It's deprecated, anyway. Review URL: http://codereview.chromium.org/8880 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r--base/process_util.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/base/process_util.h b/base/process_util.h
index 503c2ec..50a5626 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -10,9 +10,13 @@
#include "base/basictypes.h"
-#ifdef OS_WIN
+#if defined(OS_WIN)
#include <windows.h>
#include <tlhelp32.h>
+#elif defined(OS_LINUX)
+#include <dirent.h>
+#include <limits.h>
+#include <sys/types.h>
#endif
#include <string>
@@ -24,7 +28,12 @@
typedef PROCESSENTRY32 ProcessEntry;
typedef IO_COUNTERS IoCounters;
#elif defined(OS_POSIX)
-typedef int ProcessEntry;
+struct ProcessEntry {
+ int pid;
+ int ppid;
+ char szExeFile[NAME_MAX+1];
+};
+
struct IoCounters {
unsigned long long ReadOperationCount;
unsigned long long WriteOperationCount;
@@ -172,10 +181,16 @@ class NamedProcessIterator {
void InitProcessEntry(ProcessEntry* entry);
std::wstring executable_name_;
-#ifdef OS_WIN
+
+#if defined(OS_WIN)
HANDLE snapshot_;
-#endif
bool started_iteration_;
+#elif defined(OS_LINUX)
+ DIR *procfs_dir_;
+#elif defined(OS_MACOSX)
+ // probably kvm_t *kvmd_;
+#endif
+
ProcessEntry entry_;
const ProcessFilter* filter_;