| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bool SendIPCRequestAndReadReply(int ipc_channel, | 99 bool SendIPCRequestAndReadReply(int ipc_channel, |
| 100 const std::vector<int>& attached_fds, | 100 const std::vector<int>& attached_fds, |
| 101 const Pickle& request_pickle, | 101 const Pickle& request_pickle, |
| 102 char* reply_data_buffer, | 102 char* reply_data_buffer, |
| 103 size_t reply_data_buffer_size, | 103 size_t reply_data_buffer_size, |
| 104 ssize_t* reply_size) { | 104 ssize_t* reply_size) { |
| 105 DCHECK_LE(static_cast<size_t>(kNaClMaxIPCMessageLength), | 105 DCHECK_LE(static_cast<size_t>(kNaClMaxIPCMessageLength), |
| 106 reply_data_buffer_size); | 106 reply_data_buffer_size); |
| 107 DCHECK(reply_size); | 107 DCHECK(reply_size); |
| 108 | 108 |
| 109 if (!UnixDomainSocket::SendMsg(ipc_channel, request_pickle.data(), | 109 if (!base::UnixDomainSocket::SendMsg(ipc_channel, request_pickle.data(), |
| 110 request_pickle.size(), attached_fds)) { | 110 request_pickle.size(), attached_fds)) { |
| 111 LOG(ERROR) << "SendIPCRequestAndReadReply: SendMsg failed"; | 111 LOG(ERROR) << "SendIPCRequestAndReadReply: SendMsg failed"; |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Then read the remote reply. | 115 // Then read the remote reply. |
| 116 ScopedVector<base::ScopedFD> received_fds; | 116 ScopedVector<base::ScopedFD> received_fds; |
| 117 const ssize_t msg_len = | 117 const ssize_t msg_len = |
| 118 UnixDomainSocket::RecvMsg(ipc_channel, reply_data_buffer, | 118 base::UnixDomainSocket::RecvMsg(ipc_channel, reply_data_buffer, |
| 119 reply_data_buffer_size, &received_fds); | 119 reply_data_buffer_size, &received_fds); |
| 120 if (msg_len <= 0) { | 120 if (msg_len <= 0) { |
| 121 LOG(ERROR) << "SendIPCRequestAndReadReply: RecvMsg failed"; | 121 LOG(ERROR) << "SendIPCRequestAndReadReply: RecvMsg failed"; |
| 122 return false; | 122 return false; |
| 123 } | 123 } |
| 124 *reply_size = msg_len; | 124 *reply_size = msg_len; |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace. | 128 } // namespace. |
| 129 | 129 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 pass_through_vars.push_back(kNaClVerbosity); | 455 pass_through_vars.push_back(kNaClVerbosity); |
| 456 pass_through_vars.push_back(sandbox::kSandboxEnvironmentApiRequest); | 456 pass_through_vars.push_back(sandbox::kSandboxEnvironmentApiRequest); |
| 457 for (size_t i = 0; i < pass_through_vars.size(); ++i) { | 457 for (size_t i = 0; i < pass_through_vars.size(); ++i) { |
| 458 std::string temp; | 458 std::string temp; |
| 459 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) | 459 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) |
| 460 options->environ[pass_through_vars[i]] = temp; | 460 options->environ[pass_through_vars[i]] = temp; |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace nacl | 464 } // namespace nacl |
| OLD | NEW |