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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 105 |
106 private: | 106 private: |
107 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
108 bool is_current_process_; | 108 bool is_current_process_; |
109 win::ScopedHandle process_; | 109 win::ScopedHandle process_; |
110 #else | 110 #else |
111 ProcessHandle process_; | 111 ProcessHandle process_; |
112 #endif | 112 #endif |
113 }; | 113 }; |
114 | 114 |
115 #if defined(OS_LINUX) | |
116 // A wrapper for clone with fork-like behavior, meaning that it returns the | |
117 // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are | |
118 // as in the clone system call (the CLONE_VM flag is not supported). | |
119 // | |
120 // This function uses the libc clone wrapper (which updates libc's pid cache) | |
121 // internally, so callers may expect things like getpid() to work correctly | |
122 // after in both the child and parent. An exception is when this code is run | |
123 // under Valgrind. Valgrind does not support the libc clone wrapper, so the libc | |
124 // pid cache may be incorrect after this function is called under Valgrind. | |
125 // | |
126 // As with fork(), callers should be extremely careful when calling this while | |
127 // multiple threads are running, since at the time the fork happened, the | |
128 // threads could have been in any state (potentially holding locks, etc.). | |
129 // Callers should most likely call execve() in the child soon after calling | |
130 // this. | |
131 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); | |
rvargas (doing something else)
2015/01/15 23:27:32
I don't think this function belongs to this file.
| |
132 #endif | |
133 | |
115 } // namespace base | 134 } // namespace base |
116 | 135 |
117 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ | 136 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ |
OLD | NEW |