Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: content/common/child_process_sandbox_support_impl_shm_linux.cc

Issue 8893009: Move content::MakeSharedMemorySegmentViaIPC into its own file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minimal dependencies Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/child_process_sandbox_support_impl_linux.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/child_process_sandbox_support_impl_shm_linux.cc
diff --git a/content/common/child_process_sandbox_support_impl_shm_linux.cc b/content/common/child_process_sandbox_support_impl_shm_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..831c26a1bfe3fc3a8ee44c3e2643114ef992cb34
--- /dev/null
+++ b/content/common/child_process_sandbox_support_impl_shm_linux.cc
@@ -0,0 +1,33 @@
+// 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
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/global_descriptors_posix.h"
+#include "base/pickle.h"
+#include "content/common/child_process_sandbox_support_impl_linux.h"
+#include "content/common/chrome_descriptors.h"
+#include "content/common/sandbox_methods_linux.h"
+#include "content/common/unix_domain_socket_posix.h"
+
+static int GetSandboxFD() {
+ return kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
jam 2011/12/14 01:14:28 we shouldn't duplicate this, can we share it someh
+}
+
+namespace content {
+
+int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) {
+ Pickle request;
+ request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT);
+ request.WriteUInt32(length);
+ request.WriteBool(executable);
+ uint8_t reply_buf[10];
+ int result_fd;
+ ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(),
+ reply_buf, sizeof(reply_buf),
+ &result_fd, request);
+ if (result == -1)
+ return -1;
+ return result_fd;
+}
+
+} // namespace content
« no previous file with comments | « content/common/child_process_sandbox_support_impl_linux.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698