OLD | NEW |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // | 135 // |
136 // Note that it is not an error to "remove" rights that the handle does not | 136 // Note that it is not an error to "remove" rights that the handle does not |
137 // (currently) possess. | 137 // (currently) possess. |
138 // | 138 // |
139 // Returns: | 139 // Returns: |
140 // |MOJO_RESULT_OK| on success. | 140 // |MOJO_RESULT_OK| on success. |
141 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle. | 141 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle. |
142 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction | 142 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction |
143 // (that, e.g., may result in it being invalidated, such as being sent in | 143 // (that, e.g., may result in it being invalidated, such as being sent in |
144 // a message). | 144 // a message). |
| 145 // |
| 146 // TODO(vtl): Discuss this API some more. It may be more desirable to replace |
| 147 // the handle with a new one (with reduced rights). |
145 MojoResult MojoReduceRights(MojoHandle handle, | 148 MojoResult MojoReduceRights(MojoHandle handle, |
146 MojoHandleRights rights_to_remove); | 149 MojoHandleRights rights_to_remove); |
147 | 150 |
148 // |MojoDuplicateHandleWithReducedRights()|: Duplicates |handle| to a new handle | 151 // |MojoDuplicateHandleWithReducedRights()|: Duplicates |handle| to a new handle |
149 // with reduced rights. This requires |handle| to have the | 152 // with reduced rights. This requires |handle| to have the |
150 // |MOJO_HANDLE_RIGHT_DUPLICATE| (note that some handle types may never have | 153 // |MOJO_HANDLE_RIGHT_DUPLICATE| (note that some handle types may never have |
151 // this right). | 154 // this right). |
152 // | 155 // |
153 // The rights for the new handle are determined as in |MojoReduceRights()|. That | 156 // The rights for the new handle are determined as in |MojoReduceRights()|. That |
154 // is, on success: | 157 // is, on success: |
(...skipping 29 matching lines...) Expand all Loading... |
184 // been reached. | 187 // been reached. |
185 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction | 188 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction |
186 // (that, e.g., may result in it being invalidated, such as being sent in | 189 // (that, e.g., may result in it being invalidated, such as being sent in |
187 // a message). | 190 // a message). |
188 MojoResult MojoDuplicateHandle(MojoHandle handle, | 191 MojoResult MojoDuplicateHandle(MojoHandle handle, |
189 MojoHandle* new_handle); // Out. | 192 MojoHandle* new_handle); // Out. |
190 | 193 |
191 MOJO_END_EXTERN_C | 194 MOJO_END_EXTERN_C |
192 | 195 |
193 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ | 196 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ |
OLD | NEW |