OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | 5 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 // NACL_ENV_PASSTHROUGH="PATH,CWD" would pass both $PATH and $CWD to the child | 50 // NACL_ENV_PASSTHROUGH="PATH,CWD" would pass both $PATH and $CWD to the child |
51 // process. | 51 // process. |
52 const char kNaClEnvPassthrough[] = "NACL_ENV_PASSTHROUGH"; | 52 const char kNaClEnvPassthrough[] = "NACL_ENV_PASSTHROUGH"; |
53 char kNaClEnvPassthroughDelimiter = ','; | 53 char kNaClEnvPassthroughDelimiter = ','; |
54 | 54 |
55 // The following environment variables are always passed through if they exist | 55 // The following environment variables are always passed through if they exist |
56 // in the parent process. | 56 // in the parent process. |
57 const char kNaClExeStderr[] = "NACL_EXE_STDERR"; | 57 const char kNaClExeStderr[] = "NACL_EXE_STDERR"; |
58 const char kNaClExeStdout[] = "NACL_EXE_STDOUT"; | 58 const char kNaClExeStdout[] = "NACL_EXE_STDOUT"; |
59 const char kNaClVerbosity[] = "NACLVERBOSITY"; | 59 const char kNaClVerbosity[] = "NACLVERBOSITY"; |
60 const char kSbxChromeApiRq[] = "SBX_CHROME_API_RQ"; | |
jln (very slow on Chromium)
2014/06/18 23:14:38
Could you include sandbox/linux/suid/sandbox.h ins
elijahtaylor1
2014/06/18 23:48:18
I did the first suggestion because the second seem
| |
60 | 61 |
61 #if defined(ARCH_CPU_X86) | 62 #if defined(ARCH_CPU_X86) |
62 bool NonZeroSegmentBaseIsSlow() { | 63 bool NonZeroSegmentBaseIsSlow() { |
63 base::CPU cpuid; | 64 base::CPU cpuid; |
64 // Using a non-zero segment base is known to be very slow on Intel | 65 // Using a non-zero segment base is known to be very slow on Intel |
65 // Atom CPUs. See "Segmentation-based Memory Protection Mechanism | 66 // Atom CPUs. See "Segmentation-based Memory Protection Mechanism |
66 // on Intel Atom Microarchitecture: Coding Optimizations" (Leonardo | 67 // on Intel Atom Microarchitecture: Coding Optimizations" (Leonardo |
67 // Potenza, Intel). | 68 // Potenza, Intel). |
68 // | 69 // |
69 // The following list of CPU model numbers is taken from: | 70 // The following list of CPU model numbers is taken from: |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 scoped_ptr<base::Environment> env(base::Environment::Create()); | 424 scoped_ptr<base::Environment> env(base::Environment::Create()); |
424 std::string pass_through_string; | 425 std::string pass_through_string; |
425 std::vector<std::string> pass_through_vars; | 426 std::vector<std::string> pass_through_vars; |
426 if (env->GetVar(kNaClEnvPassthrough, &pass_through_string)) { | 427 if (env->GetVar(kNaClEnvPassthrough, &pass_through_string)) { |
427 base::SplitString( | 428 base::SplitString( |
428 pass_through_string, kNaClEnvPassthroughDelimiter, &pass_through_vars); | 429 pass_through_string, kNaClEnvPassthroughDelimiter, &pass_through_vars); |
429 } | 430 } |
430 pass_through_vars.push_back(kNaClExeStderr); | 431 pass_through_vars.push_back(kNaClExeStderr); |
431 pass_through_vars.push_back(kNaClExeStdout); | 432 pass_through_vars.push_back(kNaClExeStdout); |
432 pass_through_vars.push_back(kNaClVerbosity); | 433 pass_through_vars.push_back(kNaClVerbosity); |
434 pass_through_vars.push_back(kSbxChromeApiRq); | |
433 for (size_t i = 0; i < pass_through_vars.size(); ++i) { | 435 for (size_t i = 0; i < pass_through_vars.size(); ++i) { |
434 std::string temp; | 436 std::string temp; |
435 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) | 437 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) |
436 options->environ[pass_through_vars[i]] = temp; | 438 options->environ[pass_through_vars[i]] = temp; |
437 } | 439 } |
438 } | 440 } |
439 | 441 |
440 } // namespace nacl | 442 } // namespace nacl |
OLD | NEW |