diff options
author | rickyz <rickyz@chromium.org> | 2015-01-21 13:57:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-21 21:58:29 +0000 |
commit | a2f6d748a24879d0bdd824e2020d0938d103c8f9 (patch) | |
tree | 5a7325d49cf26e32f91351b36ee6e3d79a09711b /base/process/launch.h | |
parent | a141109f58a13bda68ff44d55a27e07b4c39ff37 (diff) | |
download | chromium_src-a2f6d748a24879d0bdd824e2020d0938d103c8f9.zip chromium_src-a2f6d748a24879d0bdd824e2020d0938d103c8f9.tar.gz chromium_src-a2f6d748a24879d0bdd824e2020d0938d103c8f9.tar.bz2 |
Move ForkWithFlags from process* to launch*.
As suggested at https://codereview.chromium.org/840893003/.
BUG=
Review URL: https://codereview.chromium.org/839013005
Cr-Commit-Position: refs/heads/master@{#312465}
Diffstat (limited to 'base/process/launch.h')
-rw-r--r-- | base/process/launch.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/base/process/launch.h b/base/process/launch.h index eca4f8f..de1bc0a 100644 --- a/base/process/launch.h +++ b/base/process/launch.h @@ -291,6 +291,25 @@ void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); // binary. This should not be called in production/released code. BASE_EXPORT LaunchOptions LaunchOptionsForTest(); +#if defined(OS_LINUX) +// A wrapper for clone with fork-like behavior, meaning that it returns the +// child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are +// as in the clone system call (the CLONE_VM flag is not supported). +// +// This function uses the libc clone wrapper (which updates libc's pid cache) +// internally, so callers may expect things like getpid() to work correctly +// after in both the child and parent. An exception is when this code is run +// under Valgrind. Valgrind does not support the libc clone wrapper, so the libc +// pid cache may be incorrect after this function is called under Valgrind. +// +// As with fork(), callers should be extremely careful when calling this while +// multiple threads are running, since at the time the fork happened, the +// threads could have been in any state (potentially holding locks, etc.). +// Callers should most likely call execve() in the child soon after calling +// this. +BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); +#endif + } // namespace base #endif // BASE_PROCESS_LAUNCH_H_ |