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

Side by Side Diff: mojo/public/c/system/handle.h

Issue 1964953002: Add rights for mapping buffer. Update (shared) buffer APIs. (Closed) Base URL: https://github.com/domokit/mojo.git@work787_edk_handle_14.4
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/public/c/system/buffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // This file contains Mojo system handle-related declarations/definitions. 5 // This file contains Mojo system handle-related declarations/definitions.
6 // 6 //
7 // Note: This header should be compilable as C. 7 // Note: This header should be compilable as C.
8 8
9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
(...skipping 17 matching lines...) Expand all
28 // |MOJO_HANDLE_RIGHT_NONE| - No rights. 28 // |MOJO_HANDLE_RIGHT_NONE| - No rights.
29 // |MOJO_HANDLE_RIGHT_DUPLICATE| - Right to duplicate a handle. 29 // |MOJO_HANDLE_RIGHT_DUPLICATE| - Right to duplicate a handle.
30 // |MOJO_HANDLE_RIGHT_TRANSFER| - Right to transfer a handle (e.g., include in 30 // |MOJO_HANDLE_RIGHT_TRANSFER| - Right to transfer a handle (e.g., include in
31 // a message). 31 // a message).
32 // |MOJO_HANDLE_RIGHT_READ| - Right to "read" from the handle (e.g., read a 32 // |MOJO_HANDLE_RIGHT_READ| - Right to "read" from the handle (e.g., read a
33 // message). 33 // message).
34 // |MOJO_HANDLE_RIGHT_WRITE| - Right to "write" to the handle (e.g., write a 34 // |MOJO_HANDLE_RIGHT_WRITE| - Right to "write" to the handle (e.g., write a
35 // message). 35 // message).
36 // |MOJO_HANDLE_RIGHT_GET_OPTIONS| - Right to get a handle's options. 36 // |MOJO_HANDLE_RIGHT_GET_OPTIONS| - Right to get a handle's options.
37 // |MOJO_HANDLE_RIGHT_SET_OPTIONS| - Right to set a handle's options. 37 // |MOJO_HANDLE_RIGHT_SET_OPTIONS| - Right to set a handle's options.
38 // |MOJO_HANDLE_RIGHT_MAP_READABLE| - Right to "map" a (e.g., buffer) handle
39 // as readable memory.
40 // |MOJO_HANDLE_RIGHT_MAP_WRITABLE| - Right to "map" a (e.g., buffer) handle
41 // as writable memory.
42 // |MOJO_HANDLE_RIGHT_MAP_EXECUTABLE| - Right to "map" a (e.g., buffer) handle
43 // as executable memory.
38 // 44 //
39 // TODO(vtl): Add rights support/checking to existing handle types. 45 // TODO(vtl): Add rights support/checking to existing handle types.
40 46
41 typedef uint32_t MojoHandleRights; 47 typedef uint32_t MojoHandleRights;
42 48
43 #define MOJO_HANDLE_RIGHT_NONE ((MojoHandleRights)0) 49 #define MOJO_HANDLE_RIGHT_NONE ((MojoHandleRights)0)
44 #define MOJO_HANDLE_RIGHT_DUPLICATE ((MojoHandleRights)1 << 0) 50 #define MOJO_HANDLE_RIGHT_DUPLICATE ((MojoHandleRights)1 << 0)
45 #define MOJO_HANDLE_RIGHT_TRANSFER ((MojoHandleRights)1 << 1) 51 #define MOJO_HANDLE_RIGHT_TRANSFER ((MojoHandleRights)1 << 1)
46 #define MOJO_HANDLE_RIGHT_READ ((MojoHandleRights)1 << 2) 52 #define MOJO_HANDLE_RIGHT_READ ((MojoHandleRights)1 << 2)
47 #define MOJO_HANDLE_RIGHT_WRITE ((MojoHandleRights)1 << 3) 53 #define MOJO_HANDLE_RIGHT_WRITE ((MojoHandleRights)1 << 3)
48 #define MOJO_HANDLE_RIGHT_GET_OPTIONS ((MojoHandleRights)1 << 4) 54 #define MOJO_HANDLE_RIGHT_GET_OPTIONS ((MojoHandleRights)1 << 4)
49 #define MOJO_HANDLE_RIGHT_SET_OPTIONS ((MojoHandleRights)1 << 5) 55 #define MOJO_HANDLE_RIGHT_SET_OPTIONS ((MojoHandleRights)1 << 5)
56 #define MOJO_HANDLE_RIGHT_MAP_READABLE ((MojoHandleRights)1 << 6)
57 #define MOJO_HANDLE_RIGHT_MAP_WRITABLE ((MojoHandleRights)1 << 7)
58 #define MOJO_HANDLE_RIGHT_MAP_EXECUTABLE ((MojoHandleRights)1 << 8)
50 59
51 // |MojoHandleSignals|: Used to specify signals that can be waited on for a 60 // |MojoHandleSignals|: Used to specify signals that can be waited on for a
52 // handle (and which can be triggered), e.g., the ability to read or write to 61 // handle (and which can be triggered), e.g., the ability to read or write to
53 // the handle. 62 // the handle.
54 // |MOJO_HANDLE_SIGNAL_NONE| - No flags. |MojoWait()|, etc. will return 63 // |MOJO_HANDLE_SIGNAL_NONE| - No flags. |MojoWait()|, etc. will return
55 // |MOJO_RESULT_FAILED_PRECONDITION| if you attempt to wait on this. 64 // |MOJO_RESULT_FAILED_PRECONDITION| if you attempt to wait on this.
56 // |MOJO_HANDLE_SIGNAL_READABLE| - Can read (e.g., a message) from the handle. 65 // |MOJO_HANDLE_SIGNAL_READABLE| - Can read (e.g., a message) from the handle.
57 // |MOJO_HANDLE_SIGNAL_WRITABLE| - Can write (e.g., a message) to the handle. 66 // |MOJO_HANDLE_SIGNAL_WRITABLE| - Can write (e.g., a message) to the handle.
58 // |MOJO_HANDLE_SIGNAL_PEER_CLOSED| - The peer handle is closed. 67 // |MOJO_HANDLE_SIGNAL_PEER_CLOSED| - The peer handle is closed.
59 // |MOJO_HANDLE_SIGNAL_READ_THRESHOLD| - Can read a certain amount of data 68 // |MOJO_HANDLE_SIGNAL_READ_THRESHOLD| - Can read a certain amount of data
(...skipping 12 matching lines...) Expand all
72 // |MojoHandleSignalsState|: Returned by wait functions to indicate the 81 // |MojoHandleSignalsState|: Returned by wait functions to indicate the
73 // signaling state of handles. Members are as follows: 82 // signaling state of handles. Members are as follows:
74 // - |satisfied signals|: Bitmask of signals that were satisfied at some time 83 // - |satisfied signals|: Bitmask of signals that were satisfied at some time
75 // before the call returned. 84 // before the call returned.
76 // - |satisfiable signals|: These are the signals that are possible to 85 // - |satisfiable signals|: These are the signals that are possible to
77 // satisfy. For example, if the return value was 86 // satisfy. For example, if the return value was
78 // |MOJO_RESULT_FAILED_PRECONDITION|, you can use this field to 87 // |MOJO_RESULT_FAILED_PRECONDITION|, you can use this field to
79 // determine which, if any, of the signals can still be satisfied. 88 // determine which, if any, of the signals can still be satisfied.
80 // Note: This struct is not extensible (and only has 32-bit quantities), so it's 89 // Note: This struct is not extensible (and only has 32-bit quantities), so it's
81 // 32-bit-aligned. 90 // 32-bit-aligned.
91
azani 2016/05/10 18:44:50 Nit: did you mean to add that extra blank line?
82 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment"); 92 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment");
83 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { 93 struct MOJO_ALIGNAS(4) MojoHandleSignalsState {
84 MojoHandleSignals satisfied_signals; 94 MojoHandleSignals satisfied_signals;
85 MojoHandleSignals satisfiable_signals; 95 MojoHandleSignals satisfiable_signals;
86 }; 96 };
87 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, 97 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8,
88 "MojoHandleSignalsState has wrong size"); 98 "MojoHandleSignalsState has wrong size");
89 99
90 MOJO_BEGIN_EXTERN_C 100 MOJO_BEGIN_EXTERN_C
91 101
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // been reached. 184 // been reached.
175 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction 185 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction
176 // (that, e.g., may result in it being invalidated, such as being sent in 186 // (that, e.g., may result in it being invalidated, such as being sent in
177 // a message). 187 // a message).
178 MojoResult MojoDuplicateHandle(MojoHandle handle, 188 MojoResult MojoDuplicateHandle(MojoHandle handle,
179 MojoHandle* new_handle); // Out. 189 MojoHandle* new_handle); // Out.
180 190
181 MOJO_END_EXTERN_C 191 MOJO_END_EXTERN_C
182 192
183 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 193 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698