| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PROCESS_H_ | 5 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_ |
| 6 #define BASE_PROCESS_PROCESS_PROCESS_H_ | 6 #define BASE_PROCESS_PROCESS_PROCESS_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/move.h" | 10 #include "base/move.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
| 113 bool is_current_process_; | 113 bool is_current_process_; |
| 114 win::ScopedHandle process_; | 114 win::ScopedHandle process_; |
| 115 #else | 115 #else |
| 116 ProcessHandle process_; | 116 ProcessHandle process_; |
| 117 #endif | 117 #endif |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 #if defined(OS_LINUX) | |
| 121 // A wrapper for clone with fork-like behavior, meaning that it returns the | |
| 122 // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are | |
| 123 // as in the clone system call (the CLONE_VM flag is not supported). | |
| 124 // | |
| 125 // This function uses the libc clone wrapper (which updates libc's pid cache) | |
| 126 // internally, so callers may expect things like getpid() to work correctly | |
| 127 // after in both the child and parent. An exception is when this code is run | |
| 128 // under Valgrind. Valgrind does not support the libc clone wrapper, so the libc | |
| 129 // pid cache may be incorrect after this function is called under Valgrind. | |
| 130 // | |
| 131 // As with fork(), callers should be extremely careful when calling this while | |
| 132 // multiple threads are running, since at the time the fork happened, the | |
| 133 // threads could have been in any state (potentially holding locks, etc.). | |
| 134 // Callers should most likely call execve() in the child soon after calling | |
| 135 // this. | |
| 136 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); | |
| 137 #endif | |
| 138 | |
| 139 } // namespace base | 120 } // namespace base |
| 140 | 121 |
| 141 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ | 122 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ |
| OLD | NEW |