OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/pickle.h" | 5 #include "base/pickle.h" |
6 #include "base/posix/unix_domain_socket.h" | 6 #include "base/posix/unix_domain_socket.h" |
7 #include "content/common/child_process_sandbox_support_impl_linux.h" | 7 #include "content/common/child_process_sandbox_support_impl_linux.h" |
8 #include "content/common/sandbox_methods_linux.h" | 8 #include "content/common/sandbox_linux.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) { | 12 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) { |
13 Pickle request; | 13 Pickle request; |
14 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); | 14 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); |
15 request.WriteUInt32(length); | 15 request.WriteUInt32(length); |
16 request.WriteBool(executable); | 16 request.WriteBool(executable); |
17 uint8_t reply_buf[10]; | 17 uint8_t reply_buf[10]; |
18 int result_fd; | 18 int result_fd; |
19 ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), | 19 ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), |
20 reply_buf, sizeof(reply_buf), | 20 reply_buf, sizeof(reply_buf), |
21 &result_fd, request); | 21 &result_fd, request); |
22 if (result == -1) | 22 if (result == -1) |
23 return -1; | 23 return -1; |
24 return result_fd; | 24 return result_fd; |
25 } | 25 } |
26 | 26 |
27 } // namespace content | 27 } // namespace content |
OLD | NEW |