| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_PROCESS_PROCESS_HANDLE_H_ | 5 #ifndef BASE_PROCESS_PROCESS_HANDLE_H_ |
| 6 #define BASE_PROCESS_PROCESS_HANDLE_H_ | 6 #define BASE_PROCESS_PROCESS_HANDLE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 | 14 |
| 15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 16 #include <windows.h> | 16 #include <windows.h> |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #if defined(OS_FUCHSIA) |
| 20 #include <magenta/types.h> |
| 21 #endif |
| 22 |
| 19 namespace base { | 23 namespace base { |
| 20 | 24 |
| 21 // ProcessHandle is a platform specific type which represents the underlying OS | 25 // ProcessHandle is a platform specific type which represents the underlying OS |
| 22 // handle to a process. | 26 // handle to a process. |
| 23 // ProcessId is a number which identifies the process in the OS. | 27 // ProcessId is a number which identifies the process in the OS. |
| 24 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 25 typedef HANDLE ProcessHandle; | 29 typedef HANDLE ProcessHandle; |
| 26 typedef DWORD ProcessId; | 30 typedef DWORD ProcessId; |
| 27 typedef HANDLE UserTokenHandle; | 31 typedef HANDLE UserTokenHandle; |
| 28 const ProcessHandle kNullProcessHandle = NULL; | 32 const ProcessHandle kNullProcessHandle = NULL; |
| 29 const ProcessId kNullProcessId = 0; | 33 const ProcessId kNullProcessId = 0; |
| 34 #elif defined(OS_FUCHSIA) |
| 35 typedef mx_handle_t ProcessHandle; |
| 36 typedef mx_koid_t ProcessId; |
| 37 const ProcessHandle kNullProcessHandle = MX_HANDLE_INVALID; |
| 38 const ProcessId kNullProcessId = MX_KOID_INVALID; |
| 30 #elif defined(OS_POSIX) | 39 #elif defined(OS_POSIX) |
| 31 // On POSIX, our ProcessHandle will just be the PID. | 40 // On POSIX, our ProcessHandle will just be the PID. |
| 32 typedef pid_t ProcessHandle; | 41 typedef pid_t ProcessHandle; |
| 33 typedef pid_t ProcessId; | 42 typedef pid_t ProcessId; |
| 34 const ProcessHandle kNullProcessHandle = 0; | 43 const ProcessHandle kNullProcessHandle = 0; |
| 35 const ProcessId kNullProcessId = 0; | 44 const ProcessId kNullProcessId = 0; |
| 36 #endif // defined(OS_WIN) | 45 #endif // defined(OS_WIN) |
| 37 | 46 |
| 38 // Returns the id of the current process. | 47 // Returns the id of the current process. |
| 39 // Note that on some platforms, this is not guaranteed to be unique across | 48 // Note that on some platforms, this is not guaranteed to be unique across |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 BASE_EXPORT ProcessId GetParentProcessId(ProcessHandle process); | 81 BASE_EXPORT ProcessId GetParentProcessId(ProcessHandle process); |
| 73 | 82 |
| 74 #if defined(OS_POSIX) | 83 #if defined(OS_POSIX) |
| 75 // Returns the path to the executable of the given process. | 84 // Returns the path to the executable of the given process. |
| 76 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); | 85 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); |
| 77 #endif | 86 #endif |
| 78 | 87 |
| 79 } // namespace base | 88 } // namespace base |
| 80 | 89 |
| 81 #endif // BASE_PROCESS_PROCESS_HANDLE_H_ | 90 #endif // BASE_PROCESS_PROCESS_HANDLE_H_ |
| OLD | NEW |