OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include <mach/mach_types.defs> | 15 #include <mach/mach_types.defs> |
16 #include <mach/std_types.defs> | 16 #include <mach/std_types.defs> |
17 | 17 |
18 // child_port provides an interface for port rights to be transferred between | 18 // child_port provides an interface for port rights to be transferred between |
19 // tasks. Its expected usage is for child processes to be able to pass port | 19 // tasks. Its expected usage is for processes to be able to pass port rights |
20 // rights to their parent processes. A child may wish to give its parent a copy | 20 // across IPC boundaries. A child process may wish to give its parent a copy of |
21 // of a send right to its own task port, or a child may hold a receive right for | 21 // of a send right to its own task port, or a parent process may wish to give a |
22 // a server and wish to furnish its parent with a send right to that server. | 22 // receive right to a child process that implements a server. |
23 // | 23 // |
24 // This Mach subsystem defines the lowest-level interface for these rights to | 24 // This Mach subsystem defines the lowest-level interface for these rights to |
25 // be transferred. Most users will not user this interface directly, but will | 25 // be transferred. Most users will not user this interface directly, but will |
26 // use ChildPortHandshake, which builds on this interface by providing client | 26 // use ChildPortHandshake, which builds on this interface by providing client |
27 // and server implementations, along with a protocol for establishing | 27 // and server implementations, along with a protocol for establishing |
28 // communication in a parent-child process relationship. | 28 // communication in a parent-child process relationship. |
29 subsystem child_port 10011; | 29 subsystem child_port 10011; |
30 | 30 |
31 serverprefix handle_; | 31 serverprefix handle_; |
32 | 32 |
33 type child_port_server_t = mach_port_t; | 33 type child_port_server_t = mach_port_t; |
34 type child_port_token_t = uint64_t; | 34 type child_port_token_t = uint64_t; |
35 | 35 |
36 import "util/mach/child_port_types.h"; | 36 import "util/mach/child_port_types.h"; |
37 | 37 |
38 // Sends a Mach port right across an IPC boundary. | 38 // Sends a Mach port right across an IPC boundary. |
39 // | 39 // |
40 // server[in]: The server to send the port right to. | 40 // server[in]: The server to send the port right to. |
41 // token[in]: A random opaque token, generated by the server and communicated to | 41 // token[in]: A random opaque token, generated by the server and communicated to |
42 // the client through some secure means such as a shared pipe. The client | 42 // the client through some secure means such as a shared pipe. The client |
43 // includes the token in its request to prove its authenticity to the | 43 // includes the token in its request to prove its authenticity to the |
44 // server. This parameter is necessary for instances where the server must | 44 // server. This parameter is necessary for instances where the server must |
45 // publish its service broadly, such as via the bootstrap server. When this | 45 // publish its service broadly, such as via the bootstrap server. When this |
46 // is done, anyone with access to the bootstrap server will be able to gain | 46 // is done, anyone with access to the bootstrap server will be able to gain |
47 // rights to communicate with |server|, and |token| serves as a shared | 47 // rights to communicate with |server|, and |token| serves as a shared |
48 // secret allowing the server to verify that it has received a request from | 48 // secret allowing the server to verify that it has received a request from |
49 // the intended client. |server| will reject requests with an invalid | 49 // the intended client. |server| will reject requests with an invalid |
50 // |token|. | 50 // |token|. |
51 // port[in]: A port right to transfer to the server. In expected usage, this may | 51 // port[in]: A port right to transfer to the server. |
52 // be a send or send-once right, and the |server| will reject a receive | |
53 // right. It is permissible to specify make-send for a receive right. | |
54 // | 52 // |
55 // Return value: As this is a “simpleroutine”, the server does not respond to | 53 // Return value: As this is a “simpleroutine”, the server does not respond to |
56 // the client request, and the client does not block waiting for a response | 54 // the client request, and the client does not block waiting for a response |
57 // after sending its request. The return value is MACH_MSG_SUCCESS if the | 55 // after sending its request. The return value is MACH_MSG_SUCCESS if the |
58 // request was queued for the server, without any indication of whether the | 56 // request was queued for the server, without any indication of whether the |
59 // server considered the request valid or took any action. On data | 57 // server considered the request valid or took any action. On data |
60 // validation or mach_msg() failure, another code will be returned | 58 // validation or mach_msg() failure, another code will be returned |
61 // indicating the nature of the error. | 59 // indicating the nature of the error. |
62 simpleroutine child_port_check_in(server: child_port_server_t; | 60 simpleroutine child_port_check_in(server: child_port_server_t; |
63 token: child_port_token_t; | 61 token: child_port_token_t; |
64 port: mach_port_poly_t); | 62 port: mach_port_poly_t); |
OLD | NEW |