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

Unified Diff: mojo/system/memory.h

Issue 23621056: Initial in-process implementation of some Mojo primitives. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 7 years, 3 months 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
Index: mojo/system/memory.h
diff --git a/mojo/system/memory.h b/mojo/system/memory.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a1dafcb8de818c2b5db788e944c2be8d9ba9676
--- /dev/null
+++ b/mojo/system/memory.h
@@ -0,0 +1,27 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SYSTEM_MEMORY_H_
+#define MOJO_SYSTEM_MEMORY_H_
+
+#include <stddef.h>
+
+namespace mojo {
+namespace system {
+
+// Verify that |count * size_each| bytes can be read from the user |pointer|
+// insofar as possible/necessary. |count| and |size_each| are specified
+// separately instead of a single size, since |count * size_each| may overflow a
+// |size_t|. |count| may be zero but |size_each| must be nonzero.
+//
+// For example, if running in kernel mode, this should be a full verification
+// that the given memory is owned and readable by the user process. In user
+// mode, if crashes are acceptable, this may do nothing at all (and always
+// return true).
+bool VerifyUserPointer(const void* pointer, size_t count, size_t size_each);
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_SYSTEM_MEMORY_H_
« mojo/mojo.gyp ('K') | « mojo/system/limits.h ('k') | mojo/system/memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698