diff options
-rw-r--r-- | base/process.h | 11 | ||||
-rw-r--r-- | base/process_util.h | 20 |
2 files changed, 19 insertions, 12 deletions
diff --git a/base/process.h b/base/process.h index b8ea94f..5c07442 100644 --- a/base/process.h +++ b/base/process.h @@ -30,14 +30,17 @@ #ifndef BASE_PROCESS_H__ #define BASE_PROCESS_H__ -#include <windows.h> #include "base/basictypes.h" +#ifdef OS_WIN +#include <windows.h> +#endif + // ProcessHandle is a platform specific type which represents the underlying OS // handle to a process. -#ifdef WIN32 +#if defined(OS_WIN) typedef HANDLE ProcessHandle; -#else +#elif defined(OS_POSIX) typedef int ProcessHandle; #endif @@ -65,7 +68,9 @@ class Process { // Close the Process Handle. void Close() { +#ifdef OS_WIN CloseHandle(process_); +#endif process_ = 0; } diff --git a/base/process_util.h b/base/process_util.h index 5cabcc5..defa561 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -33,23 +33,25 @@ #ifndef BASE_PROCESS_UTIL_H__ #define BASE_PROCESS_UTIL_H__ -#include <string> -#ifdef WIN32 +#include "base/basictypes.h" + +#ifdef OS_WIN #include <windows.h> #include <tlhelp32.h> -#endif // WIN32 +#endif + +#include <string> -#include "base/basictypes.h" #include "base/process.h" // ProcessHandle is a platform specific type which represents the underlying OS // handle to a process. -#ifdef WIN32 +#if defined(OS_WIN) typedef PROCESSENTRY32 ProcessEntry; typedef IO_COUNTERS IoCounters; -#else +#elif defined(OS_POSIX) typedef int ProcessEntry; -typedef int IoCounters; //TODO(awalker): replace with struct when available +typedef int IoCounters; //TODO(awalker): replace with struct when available #endif namespace process_util { @@ -161,9 +163,9 @@ class NamedProcessIterator { void InitProcessEntry(ProcessEntry* entry); std::wstring executable_name_; -#ifdef WIN32 +#ifdef OS_WIN HANDLE snapshot_; -#endif // WIN32 +#endif bool started_iteration_; ProcessEntry entry_; const ProcessFilter* filter_; |