OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // This file contains functions for launching subprocesses. | 5 // This file contains functions for launching subprocesses. |
6 | 6 |
7 #ifndef BASE_PROCESS_LAUNCH_H_ | 7 #ifndef BASE_PROCESS_LAUNCH_H_ |
8 #define BASE_PROCESS_LAUNCH_H_ | 8 #define BASE_PROCESS_LAUNCH_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Look up the bootstrap server named |replacement_bootstrap_name| via the | 290 // Look up the bootstrap server named |replacement_bootstrap_name| via the |
291 // current |bootstrap_port|. Then replace the task's bootstrap port with the | 291 // current |bootstrap_port|. Then replace the task's bootstrap port with the |
292 // received right. | 292 // received right. |
293 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); | 293 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); |
294 #endif // defined(OS_MACOSX) | 294 #endif // defined(OS_MACOSX) |
295 | 295 |
296 // Creates a LaunchOptions object suitable for launching processes in a test | 296 // Creates a LaunchOptions object suitable for launching processes in a test |
297 // binary. This should not be called in production/released code. | 297 // binary. This should not be called in production/released code. |
298 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); | 298 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); |
299 | 299 |
300 #if defined(OS_LINUX) | 300 #if defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
301 // A wrapper for clone with fork-like behavior, meaning that it returns the | 301 // A wrapper for clone with fork-like behavior, meaning that it returns the |
302 // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are | 302 // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are |
303 // as in the clone system call (the CLONE_VM flag is not supported). | 303 // as in the clone system call (the CLONE_VM flag is not supported). |
304 // | 304 // |
305 // This function uses the libc clone wrapper (which updates libc's pid cache) | 305 // This function uses the libc clone wrapper (which updates libc's pid cache) |
306 // internally, so callers may expect things like getpid() to work correctly | 306 // internally, so callers may expect things like getpid() to work correctly |
307 // after in both the child and parent. An exception is when this code is run | 307 // after in both the child and parent. An exception is when this code is run |
308 // under Valgrind. Valgrind does not support the libc clone wrapper, so the libc | 308 // under Valgrind. Valgrind does not support the libc clone wrapper, so the libc |
309 // pid cache may be incorrect after this function is called under Valgrind. | 309 // pid cache may be incorrect after this function is called under Valgrind. |
310 // | 310 // |
311 // As with fork(), callers should be extremely careful when calling this while | 311 // As with fork(), callers should be extremely careful when calling this while |
312 // multiple threads are running, since at the time the fork happened, the | 312 // multiple threads are running, since at the time the fork happened, the |
313 // threads could have been in any state (potentially holding locks, etc.). | 313 // threads could have been in any state (potentially holding locks, etc.). |
314 // Callers should most likely call execve() in the child soon after calling | 314 // Callers should most likely call execve() in the child soon after calling |
315 // this. | 315 // this. |
316 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); | 316 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); |
317 #endif | 317 #endif |
318 | 318 |
319 } // namespace base | 319 } // namespace base |
320 | 320 |
321 #endif // BASE_PROCESS_LAUNCH_H_ | 321 #endif // BASE_PROCESS_LAUNCH_H_ |
OLD | NEW |