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 "sandbox/linux/syscall_broker/broker_process.h" | 5 #include "sandbox/linux/syscall_broker/broker_process.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/process/process_metrics.h" | 23 #include "base/process/process_metrics.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "sandbox/linux/syscall_broker/broker_channel.h" | 25 #include "sandbox/linux/syscall_broker/broker_channel.h" |
26 #include "sandbox/linux/syscall_broker/broker_client.h" | 26 #include "sandbox/linux/syscall_broker/broker_client.h" |
27 #include "sandbox/linux/syscall_broker/broker_host.h" | 27 #include "sandbox/linux/syscall_broker/broker_host.h" |
28 | 28 |
29 namespace sandbox { | 29 namespace sandbox { |
30 | 30 |
31 namespace syscall_broker { | 31 namespace syscall_broker { |
32 | 32 |
33 BrokerProcess::BrokerProcess(int denied_errno, | 33 BrokerProcess::BrokerProcess( |
34 const std::vector<std::string>& allowed_r_files, | 34 int denied_errno, |
35 const std::vector<std::string>& allowed_w_files, | 35 const std::vector<syscall_broker::BrokerFilePermission>& permissions, |
36 bool fast_check_in_client, | 36 bool fast_check_in_client, |
37 bool quiet_failures_for_tests) | 37 bool quiet_failures_for_tests) |
38 : initialized_(false), | 38 : initialized_(false), |
39 fast_check_in_client_(fast_check_in_client), | 39 fast_check_in_client_(fast_check_in_client), |
40 quiet_failures_for_tests_(quiet_failures_for_tests), | 40 quiet_failures_for_tests_(quiet_failures_for_tests), |
41 broker_pid_(-1), | 41 broker_pid_(-1), |
42 policy_(denied_errno, allowed_r_files, allowed_w_files) { | 42 policy_(denied_errno, permissions) { |
43 } | 43 } |
44 | 44 |
45 BrokerProcess::~BrokerProcess() { | 45 BrokerProcess::~BrokerProcess() { |
46 if (initialized_) { | 46 if (initialized_) { |
47 if (broker_client_.get()) { | 47 if (broker_client_.get()) { |
48 // Closing the socket should be enough to notify the child to die, | 48 // Closing the socket should be enough to notify the child to die, |
49 // unless it has been duplicated. | 49 // unless it has been duplicated. |
50 CloseChannel(); | 50 CloseChannel(); |
51 } | 51 } |
52 PCHECK(0 == kill(broker_pid_, SIGKILL)); | 52 PCHECK(0 == kill(broker_pid_, SIGKILL)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 int BrokerProcess::Open(const char* pathname, int flags) const { | 113 int BrokerProcess::Open(const char* pathname, int flags) const { |
114 RAW_CHECK(initialized_); | 114 RAW_CHECK(initialized_); |
115 return broker_client_->Open(pathname, flags); | 115 return broker_client_->Open(pathname, flags); |
116 } | 116 } |
117 | 117 |
118 } // namespace syscall_broker | 118 } // namespace syscall_broker |
119 | 119 |
120 } // namespace sandbox. | 120 } // namespace sandbox. |
OLD | NEW |