Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
jam
2011/12/14 01:14:28
child_process_sandbox_support_impl_shm_linux.cc is
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/global_descriptors_posix.h" | |
| 6 #include "base/pickle.h" | |
| 7 #include "content/common/child_process_sandbox_support_impl_linux.h" | |
| 8 #include "content/common/chrome_descriptors.h" | |
| 9 #include "content/common/sandbox_methods_linux.h" | |
| 10 #include "content/common/unix_domain_socket_posix.h" | |
| 11 | |
| 12 static int GetSandboxFD() { | |
| 13 return kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor; | |
|
jam
2011/12/14 01:14:28
we shouldn't duplicate this, can we share it someh
| |
| 14 } | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) { | |
| 19 Pickle request; | |
| 20 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); | |
| 21 request.WriteUInt32(length); | |
| 22 request.WriteBool(executable); | |
| 23 uint8_t reply_buf[10]; | |
| 24 int result_fd; | |
| 25 ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), | |
| 26 reply_buf, sizeof(reply_buf), | |
| 27 &result_fd, request); | |
| 28 if (result == -1) | |
| 29 return -1; | |
| 30 return result_fd; | |
| 31 } | |
| 32 | |
| 33 } // namespace content | |
| OLD | NEW |