| 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> |
| 11 | 11 |
| 12 #include <set> | 12 #include <set> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/cpu.h" | 16 #include "base/cpu.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/files/scoped_file.h" | 18 #include "base/files/scoped_file.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/memory/scoped_vector.h" |
| 21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 22 #include "base/pickle.h" | 23 #include "base/pickle.h" |
| 23 #include "base/posix/eintr_wrapper.h" | 24 #include "base/posix/eintr_wrapper.h" |
| 24 #include "base/posix/global_descriptors.h" | 25 #include "base/posix/global_descriptors.h" |
| 25 #include "base/posix/unix_domain_socket_linux.h" | 26 #include "base/posix/unix_domain_socket_linux.h" |
| 26 #include "base/process/kill.h" | 27 #include "base/process/kill.h" |
| 27 #include "base/process/launch.h" | 28 #include "base/process/launch.h" |
| 28 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 29 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 29 #include "components/nacl/common/nacl_paths.h" | 30 #include "components/nacl/common/nacl_paths.h" |
| 30 #include "components/nacl/common/nacl_switches.h" | 31 #include "components/nacl/common/nacl_switches.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 reply_data_buffer_size); | 87 reply_data_buffer_size); |
| 87 DCHECK(reply_size); | 88 DCHECK(reply_size); |
| 88 | 89 |
| 89 if (!UnixDomainSocket::SendMsg(ipc_channel, request_pickle.data(), | 90 if (!UnixDomainSocket::SendMsg(ipc_channel, request_pickle.data(), |
| 90 request_pickle.size(), attached_fds)) { | 91 request_pickle.size(), attached_fds)) { |
| 91 LOG(ERROR) << "SendIPCRequestAndReadReply: SendMsg failed"; | 92 LOG(ERROR) << "SendIPCRequestAndReadReply: SendMsg failed"; |
| 92 return false; | 93 return false; |
| 93 } | 94 } |
| 94 | 95 |
| 95 // Then read the remote reply. | 96 // Then read the remote reply. |
| 96 std::vector<int> received_fds; | 97 ScopedVector<base::ScopedFD> received_fds; |
| 97 const ssize_t msg_len = | 98 const ssize_t msg_len = |
| 98 UnixDomainSocket::RecvMsg(ipc_channel, reply_data_buffer, | 99 UnixDomainSocket::RecvMsg(ipc_channel, reply_data_buffer, |
| 99 reply_data_buffer_size, &received_fds); | 100 reply_data_buffer_size, &received_fds); |
| 100 if (msg_len <= 0) { | 101 if (msg_len <= 0) { |
| 101 LOG(ERROR) << "SendIPCRequestAndReadReply: RecvMsg failed"; | 102 LOG(ERROR) << "SendIPCRequestAndReadReply: RecvMsg failed"; |
| 102 return false; | 103 return false; |
| 103 } | 104 } |
| 104 *reply_size = msg_len; | 105 *reply_size = msg_len; |
| 105 return true; | 106 return true; |
| 106 } | 107 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 int remote_exit_code; | 368 int remote_exit_code; |
| 368 if (!iter.ReadInt(&remote_exit_code)) { | 369 if (!iter.ReadInt(&remote_exit_code)) { |
| 369 LOG(ERROR) << "GetTerminationStatus: pickle failed"; | 370 LOG(ERROR) << "GetTerminationStatus: pickle failed"; |
| 370 return false; | 371 return false; |
| 371 } | 372 } |
| 372 | 373 |
| 373 *status = static_cast<base::TerminationStatus>(termination_status); | 374 *status = static_cast<base::TerminationStatus>(termination_status); |
| 374 *exit_code = remote_exit_code; | 375 *exit_code = remote_exit_code; |
| 375 return true; | 376 return true; |
| 376 } | 377 } |
| OLD | NEW |