OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // process. | 27 // process. |
28 class ZygoteHost { | 28 class ZygoteHost { |
29 public: | 29 public: |
30 // Returns the singleton instance. | 30 // Returns the singleton instance. |
31 static ZygoteHost* GetInstance(); | 31 static ZygoteHost* GetInstance(); |
32 | 32 |
33 void Init(const std::string& sandbox_cmd); | 33 void Init(const std::string& sandbox_cmd); |
34 | 34 |
35 // Tries to start a renderer process. Returns its pid on success, otherwise | 35 // Tries to start a renderer process. Returns its pid on success, otherwise |
36 // base::kNullProcessHandle; | 36 // base::kNullProcessHandle; |
37 pid_t ForkRenderer(const std::vector<std::string>& command_line, | 37 pid_t ForkRequest(const std::vector<std::string>& command_line, |
38 const base::GlobalDescriptors::Mapping& mapping); | 38 const base::GlobalDescriptors::Mapping& mapping, |
| 39 const std::string& process_type); |
39 void EnsureProcessTerminated(pid_t process); | 40 void EnsureProcessTerminated(pid_t process); |
40 | 41 |
41 // Get the termination status (and, optionally, the exit code) of | 42 // Get the termination status (and, optionally, the exit code) of |
42 // the process. |exit_code| is set to the exit code of the child | 43 // the process. |exit_code| is set to the exit code of the child |
43 // process. (|exit_code| may be NULL.) | 44 // process. (|exit_code| may be NULL.) |
44 base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle, | 45 base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle, |
45 int* exit_code); | 46 int* exit_code); |
46 | 47 |
47 // These are the command codes used on the wire between the browser and the | 48 // These are the command codes used on the wire between the browser and the |
48 // zygote. | 49 // zygote. |
49 enum { | 50 enum { |
50 kCmdFork = 0, // Fork off a new renderer. | 51 kCmdFork = 0, // Fork off a new renderer. |
51 kCmdReap = 1, // Reap a renderer child. | 52 kCmdReap = 1, // Reap a renderer child. |
52 kCmdGetTerminationStatus = 2, // Check what happend to a child process. | 53 kCmdGetTerminationStatus = 2, // Check what happend to a child process. |
53 kCmdGetSandboxStatus = 3, // Read a bitmask of kSandbox* | 54 kCmdGetSandboxStatus = 3, // Read a bitmask of kSandbox* |
| 55 kCmdNaClFork = 4, // Fork off a Native Client loader |
54 }; | 56 }; |
55 | 57 |
56 // These form a bitmask which describes the conditions of the sandbox that | 58 // These form a bitmask which describes the conditions of the sandbox that |
57 // the zygote finds itself in. | 59 // the zygote finds itself in. |
58 enum { | 60 enum { |
59 kSandboxSUID = 1 << 0, // SUID sandbox active | 61 kSandboxSUID = 1 << 0, // SUID sandbox active |
60 kSandboxPIDNS = 1 << 1, // SUID sandbox is using the PID namespace | 62 kSandboxPIDNS = 1 << 1, // SUID sandbox is using the PID namespace |
61 kSandboxNetNS = 1 << 2, // SUID sandbox is using the network namespace | 63 kSandboxNetNS = 1 << 2, // SUID sandbox is using the network namespace |
62 kSandboxSeccomp = 1 << 3, // seccomp sandbox active. | 64 kSandboxSeccomp = 1 << 3, // seccomp sandbox active. |
63 }; | 65 }; |
(...skipping 25 matching lines...) Expand all Loading... |
89 base::Lock control_lock_; | 91 base::Lock control_lock_; |
90 pid_t pid_; | 92 pid_t pid_; |
91 bool init_; | 93 bool init_; |
92 bool using_suid_sandbox_; | 94 bool using_suid_sandbox_; |
93 std::string sandbox_binary_; | 95 std::string sandbox_binary_; |
94 bool have_read_sandbox_status_word_; | 96 bool have_read_sandbox_status_word_; |
95 int sandbox_status_; | 97 int sandbox_status_; |
96 }; | 98 }; |
97 | 99 |
98 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 100 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
OLD | NEW |