Add the child_port Mach subsystem.
R=rsesek@chromium.org Review URL: https://codereview.chromium.org/752243002
This commit is contained in:
Родитель
e4551e709c
Коммит
e9482a704d
|
@ -0,0 +1,64 @@
|
|||
// Copyright 2014 The Crashpad Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <mach/mach_types.defs>
|
||||
#include <mach/std_types.defs>
|
||||
|
||||
// child_port provides an interface for port rights to be transferred between
|
||||
// tasks. Its expected usage is for child processes to be able to pass port
|
||||
// rights to their parent processes. A child may wish to give its parent a copy
|
||||
// of a send right to its own task port, or a child may hold a receive right for
|
||||
// a server and wish to furnish its parent with a send right to that server.
|
||||
//
|
||||
// This Mach subsystem defines the lowest-level interface for these rights to
|
||||
// be transferred. Most users will not user this interface directly, but will
|
||||
// use ChildPortHandshake, which builds on this interface by providing client
|
||||
// and server implementations, along with a protocol for establishing
|
||||
// communication in a parent-child process relationship.
|
||||
subsystem child_port 10011;
|
||||
|
||||
serverprefix handle_;
|
||||
|
||||
type child_port_server_t = mach_port_t;
|
||||
type child_port_token_t = uint64_t;
|
||||
|
||||
import "util/mach/child_port_types.h";
|
||||
|
||||
// Sends a Mach port right across an IPC boundary.
|
||||
//
|
||||
// server[in]: The server to send the port right to.
|
||||
// token[in]: A random opaque token, generated by the server and communicated to
|
||||
// the client through some secure means such as a shared pipe. The client
|
||||
// includes the token in its request to prove its authenticity to the
|
||||
// server. This parameter is necessary for instances where the server must
|
||||
// publish its service broadly, such as via the bootstrap server. When this
|
||||
// is done, anyone with access to the bootstrap server will be able to gain
|
||||
// rights to communicate with |server|, and |token| serves as a shared
|
||||
// secret allowing the server to verify that it has received a request from
|
||||
// the intended client. |server| will reject requests with an invalid
|
||||
// |token|.
|
||||
// port[in]: A port right to transfer to the server. In expected usage, this may
|
||||
// be a send or send-once right, and the |server| will reject a receive
|
||||
// right. It is permissible to specify make-send for a receive right.
|
||||
//
|
||||
// Return value: As this is a “simpleroutine”, the server does not respond to
|
||||
// the client request, and the client does not block waiting for a response
|
||||
// after sending its request. The return value is MACH_MSG_SUCCESS if the
|
||||
// request was queued for the server, without any indication of whether the
|
||||
// server considered the request valid or took any action. On data
|
||||
// validation or mach_msg() failure, another code will be returned
|
||||
// indicating the nature of the error.
|
||||
simpleroutine child_port_check_in(server: child_port_server_t;
|
||||
token: child_port_token_t;
|
||||
port: mach_port_poly_t);
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2014 The Crashpad Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_
|
||||
#define CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// This file is #included by C (non-C++) files, and must remain strictly C.
|
||||
|
||||
typedef mach_port_t child_port_server_t;
|
||||
typedef uint64_t child_port_token_t;
|
||||
|
||||
#endif // CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_
|
|
@ -40,6 +40,7 @@
|
|||
'mac/mac_util.h',
|
||||
'mac/service_management.cc',
|
||||
'mac/service_management.h',
|
||||
'mach/child_port_types.h',
|
||||
'mach/exc_client_variants.cc',
|
||||
'mach/exc_client_variants.h',
|
||||
'mach/exc_server_variants.cc',
|
||||
|
@ -105,6 +106,26 @@
|
|||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'mig child_port.defs',
|
||||
'variables': {
|
||||
'child_port_defs_file': 'mach/child_port.defs',
|
||||
},
|
||||
'inputs': [
|
||||
'mach/mig.py',
|
||||
'<(child_port_defs_file)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/util/mach/child_portUser.c',
|
||||
'<(INTERMEDIATE_DIR)/util/mach/child_portServer.c',
|
||||
'<(INTERMEDIATE_DIR)/util/mach/child_port.h',
|
||||
'<(INTERMEDIATE_DIR)/util/mach/child_portServer.h',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<@(_outputs)'
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
},
|
||||
{
|
||||
'action_name': 'mig exc.defs',
|
||||
'inputs': [
|
||||
|
|
Загрузка…
Ссылка в новой задаче