[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / child_process_sandbox_support_impl_shm_linux.cc
blob1553826ad1989caec9018b6576e1a2dc401acdbf
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
3 // found in the LICENSE file.
5 #include "content/common/child_process_sandbox_support_impl_linux.h"
7 #include "base/pickle.h"
8 #include "base/posix/unix_domain_socket_linux.h"
9 #include "content/common/sandbox_linux/sandbox_linux.h"
11 namespace content {
13 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) {
14 base::Pickle request;
15 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT);
16 request.WriteUInt32(length);
17 request.WriteBool(executable);
18 uint8_t reply_buf[10];
19 int result_fd;
20 ssize_t result = base::UnixDomainSocket::SendRecvMsg(
21 GetSandboxFD(), reply_buf, sizeof(reply_buf), &result_fd, request);
22 if (result == -1)
23 return -1;
24 return result_fd;
27 } // namespace content