OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 types/constants and functions specific to message pipes. | 5 // This file contains types/constants and functions specific to message pipes. |
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_MESSAGE_PIPE_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // |message_pipe_handle| is not a valid handle, or some of the | 95 // |message_pipe_handle| is not a valid handle, or some of the |
96 // requirements above are not satisfied). | 96 // requirements above are not satisfied). |
97 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if some system limit has been reached, or | 97 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if some system limit has been reached, or |
98 // the number of handles to send is too large (TODO(vtl): reconsider the | 98 // the number of handles to send is too large (TODO(vtl): reconsider the |
99 // latter case). | 99 // latter case). |
100 // |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed. | 100 // |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed. |
101 // Note that closing an endpoint is not necessarily synchronous (e.g., | 101 // Note that closing an endpoint is not necessarily synchronous (e.g., |
102 // across processes), so this function may succeed even if the other | 102 // across processes), so this function may succeed even if the other |
103 // endpoint has been closed (in which case the message would be dropped). | 103 // endpoint has been closed (in which case the message would be dropped). |
104 // |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|. | 104 // |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|. |
105 // |MOJO_RESULT_BUSY| if some handle to be sent is currently in use. | 105 // |MOJO_RESULT_BUSY| if |message_pipe_handle| is currently in use in some |
| 106 // transaction (that, e.g., may result in it being invalidated, such as |
| 107 // being sent in a message), or if some handle to be sent is currently in |
| 108 // use. |
106 // | 109 // |
107 // TODO(vtl): Add a notion of capacity for message pipes, and return | 110 // TODO(vtl): Add a notion of capacity for message pipes, and return |
108 // |MOJO_RESULT_SHOULD_WAIT| if the message pipe is full. | 111 // |MOJO_RESULT_SHOULD_WAIT| if the message pipe is full. |
109 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, // In. | 112 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, // In. |
110 const void* bytes, // Optional in. | 113 const void* bytes, // Optional in. |
111 uint32_t num_bytes, // In. | 114 uint32_t num_bytes, // In. |
112 const MojoHandle* handles, // Optional in. | 115 const MojoHandle* handles, // Optional in. |
113 uint32_t num_handles, // In. | 116 uint32_t num_handles, // In. |
114 MojoWriteMessageFlags flags); // In. | 117 MojoWriteMessageFlags flags); // In. |
115 | 118 |
(...skipping 18 matching lines...) Expand all Loading... |
134 // parameter(s) must also be set to zero or passed as null. | 137 // parameter(s) must also be set to zero or passed as null. |
135 // | 138 // |
136 // Returns: | 139 // Returns: |
137 // |MOJO_RESULT_OK| on success (i.e., a message was actually read). | 140 // |MOJO_RESULT_OK| on success (i.e., a message was actually read). |
138 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid. | 141 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid. |
139 // |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed. | 142 // |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed. |
140 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the message was too large to fit in the | 143 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the message was too large to fit in the |
141 // provided buffer(s). The message will have been left in the queue or | 144 // provided buffer(s). The message will have been left in the queue or |
142 // discarded, depending on flags. | 145 // discarded, depending on flags. |
143 // |MOJO_RESULT_SHOULD_WAIT| if no message was available to be read. | 146 // |MOJO_RESULT_SHOULD_WAIT| if no message was available to be read. |
| 147 // |MOJO_RESULT_BUSY| if |message_pipe_handle| is currently in use in some |
| 148 // transaction (that, e.g., may result in it being invalidated, such as |
| 149 // being sent in a message). |
144 // | 150 // |
145 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should | 151 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should |
146 // distinguish this from the hitting-system-limits case. | 152 // distinguish this from the hitting-system-limits case. |
147 MojoResult MojoReadMessage( | 153 MojoResult MojoReadMessage( |
148 MojoHandle message_pipe_handle, // In. | 154 MojoHandle message_pipe_handle, // In. |
149 void* MOJO_RESTRICT bytes, // Optional out. | 155 void* MOJO_RESTRICT bytes, // Optional out. |
150 uint32_t* MOJO_RESTRICT num_bytes, // Optional in/out. | 156 uint32_t* MOJO_RESTRICT num_bytes, // Optional in/out. |
151 MojoHandle* MOJO_RESTRICT handles, // Optional out. | 157 MojoHandle* MOJO_RESTRICT handles, // Optional out. |
152 uint32_t* MOJO_RESTRICT num_handles, // Optional in/out. | 158 uint32_t* MOJO_RESTRICT num_handles, // Optional in/out. |
153 MojoReadMessageFlags flags); // In. | 159 MojoReadMessageFlags flags); // In. |
154 | 160 |
155 MOJO_END_EXTERN_C | 161 MOJO_END_EXTERN_C |
156 | 162 |
157 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 163 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |