| Index: base/process_util_linux.cc
|
| ===================================================================
|
| --- base/process_util_linux.cc (revision 17632)
|
| +++ base/process_util_linux.cc (working copy)
|
| @@ -17,6 +17,7 @@
|
| #include "base/logging.h"
|
| #include "base/string_tokenizer.h"
|
| #include "base/string_util.h"
|
| +#include "base/zygote_manager.h"
|
|
|
| namespace {
|
|
|
| @@ -41,6 +42,22 @@
|
|
|
| namespace base {
|
|
|
| +bool ForkApp(const std::vector<std::string>& argv,
|
| + const file_handle_mapping_vector& fds_to_remap,
|
| + ProcessHandle* process_handle) {
|
| + ZygoteManager* zm = ZygoteManager::Get();
|
| + if (!zm)
|
| + return LaunchApp(argv, fds_to_remap, false, process_handle);
|
| +
|
| + pid_t pid = zm->LongFork(argv, fds_to_remap);
|
| + if (pid < 0)
|
| + return false;
|
| +
|
| + if (process_handle)
|
| + *process_handle = pid;
|
| + return true;
|
| +}
|
| +
|
| bool LaunchApp(const std::vector<std::string>& argv,
|
| const file_handle_mapping_vector& fds_to_remap,
|
| bool wait, ProcessHandle* process_handle) {
|
| @@ -65,6 +82,8 @@
|
| argv_cstr[i] = const_cast<char*>(argv[i].c_str());
|
| argv_cstr[argv.size()] = NULL;
|
| execvp(argv_cstr[0], argv_cstr.get());
|
| + LOG(ERROR) << "LaunchApp: exec failed!, argv_cstr[0] " << argv_cstr[0]
|
| + << ", errno " << errno;
|
| exit(127);
|
| } else {
|
| if (wait)
|
|
|