|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * @OSF_FREE_COPYRIGHT@
24: *
25: */
26: /*
27: * HISTORY
28: *
29: * Revision 1.1.1.1 1998/09/22 21:05:33 wsanchez
30: * Import of Mac OS X kernel (~semeria)
31: *
32: * Revision 1.1 1998/04/29 17:36:12 mburg
33: * MK7.3 merger
34: *
35: * Revision 1.1.7.1 1998/02/03 09:29:37 gdt
36: * Merge up to MK7.3
37: * [1998/02/03 09:14:34 gdt]
38: *
39: * Revision 1.1.4.1 1997/06/17 02:58:23 devrcs
40: * Handle some errors caused by node failures.
41: * [1996/09/25 19:00:00 watkins]
42: *
43: * Added `#include' for DIPC types. This is needed for non-DIPC
44: * configurations to build. Also, defined away trans-node RPC
45: * routines when DIPC is not configured. (Trans-node RPC currently
46: * uses DIPC features.)
47: * [1996/04/16 19:02:12 rkc]
48: *
49: * Use scheduling framework to access scheduling parameters.
50: * [1996/03/29 22:08:50 watkins]
51: *
52: * Merge with rt3_merge.
53: * [1996/03/22 22:49:57 watkins]
54: *
55: * Revision 1.1.1.2 1996/03/21 19:21:13 watkins
56: * Initial revision.
57: *
58: * $EndLog$
59: */
60:
61:
62: /*
63: * rpc_remote.h
64: *
65: * Definitions and functions for the Mach RPC remote.
66: */
67:
68:
69: #include <dipc.h>
70: #include <kernel_test.h>
71: #include <mach/kkt_request.h>
72: #include <dipc/dipc_types.h>
73: #include <mach/policy.h>
74: #include <kern/sf.h>
75: #include <kern/mk_sp.h>
76:
77:
78: /*
79: * IN and OUT are defined for documenting argument-passing
80: * conventions and have no meaning to the compiler.
81: */
82: #define IN
83: #define OUT
84: #define INOUT
85:
86:
87: /*
88: * Bound on the highest allocated remote procedure call number.
89: * This number may be used for allocating arrays.
90: */
91: #define RPC_KKT_MAX_PROC 10
92:
93:
94: /*
95: * We staticly size the transfer arrays for now. This will
96: * be dynamic later.
97: */
98: #define RPC_ARRAYS_MAX_SIZE 4
99: #define RPC_ARRAYS_MAX_ENTRY 32
100: #define RPC_ARRAYS_MAX_DATA (RPC_ARRAYS_MAX_SIZE * RPC_ARRAYS_MAX_ENTRY)
101:
102:
103: /*
104: * rpc_control
105: *
106: * Control information sent with a remote RPC request, including
107: * scheduling information for the request on remote node.
108: */
109:
110: typedef struct rpc_control {
111: policy_t policy;
112: union {
113: mk_sp_attribute_struct_t mk;
114: } attributes;
115: union {
116: mk_sp_info_struct_t mk;
117: } information;
118: } Rpc_Control;
119:
120: typedef struct rpc_service {
121: node_name src_node;
122: node_name dst_node;
123: uid_t uid;
124: int routine_num;
125: int signature_token;
126: void *instance;
127: } Rpc_Service;
128:
129: typedef struct rpc_control *rpc_control_t;
130: typedef struct rpc_service *rpc_service_t;
131:
132:
133: /*
134: * rpc invoke
135: *
136: * Request RPC service from a remote node. The initial contact
137: * contact includes subsystem, signature token and scheduling
138: * information. The invoke request will be acknowledged with a
139: * reply.
140: *
141: * Send a list of arrays to a remote node and receive a list of
142: * arrays in return. Count is the number of arrays and the number of
143: * size values in the Sizes array. Data points to the arrays, one
144: * after another.
145: */
146:
147: #define RPC_KKT_INVOKE 2
148: #define RPC_KKT_INVOKE_ACK 3
149:
150: extern kkt_return_t rpc_kkt_invoke(
151: IN rpc_service_t servp,
152: INOUT unsigned *count,
153: INOUT unsigned *sizes,
154: INOUT unsigned *datap,
155: OUT rpc_return_t *rr);
156:
157: extern rpc_return_t rpc_kkt_invoke_ack(
158: OUT rpc_return_t rr);
159:
160: struct rpc_kkt_invoke_args {
161: Rpc_Service service;
162: unsigned count;
163: unsigned sizes[RPC_ARRAYS_MAX_SIZE];
164: unsigned data[RPC_ARRAYS_MAX_DATA];
165: };
166:
167:
168: /*
169: * rpc reply
170: *
171: * Reply to an RPC request from a remote node. The reply will
172: * include any result data, as well as signature token and sched-
173: * uling information. This reply must be acknowledged by the client
174: * side of the RPC.
175: *
176: * Send a list of arrays to a remote node and receive a list of
177: * arrays in return. Count is the number of arrays and the number of
178: * size values in the Sizes array. Data points to the arrays, one
179: * after another.
180: */
181:
182: #define RPC_KKT_REPLY 4
183: #define RPC_KKT_REPLY_ACK 5
184:
185: extern kkt_return_t rpc_kkt_reply(
186: IN rpc_service_t servp,
187: INOUT unsigned *count,
188: INOUT unsigned *sizes,
189: INOUT unsigned *datap,
190: OUT rpc_return_t *rr);
191:
192: extern rpc_return_t rpc_kkt_reply_ack(
193: OUT rpc_return_t rr);
194:
195: struct rpc_kkt_reply_args {
196: Rpc_Service service;
197: unsigned count;
198: unsigned sizes[RPC_ARRAYS_MAX_SIZE];
199: unsigned data[RPC_ARRAYS_MAX_DATA];
200: };
201:
202:
203:
204: /*
205: * All possible arguments for thread-level service
206: */
207: typedef struct rpc_kkt_args {
208: int procnum;
209: rpc_return_t rr;
210: Rpc_Control control;
211: Rpc_Service service;
212: vm_offset_t kkt_size;
213: } *rpc_kkt_args_t;
214:
215: #define alink rr
216: #define alink_t rpc_return_t
217:
218: #define RPC_KKT_ARG_NULL ((rpc_kkt_args_t)0)
219:
220:
221: /*
222: * Macros for sanity checking.
223: */
224:
225: #define valid_rpc_kkt_proc(p) (p >= 2 && p <= 5 && p < RPC_KKT_MAX_PROC)
226:
227:
228:
229: /*
230: * External Declarations
231: */
232:
233: void rpc_bootstrap(void);
234:
235: rpc_return_t rpc_server_reply(void);
236:
237: rpc_return_t rpc_client_reply(void);
238:
239: rpc_return_t rpc_server_invoke(rpc_kkt_args_t);
240:
241: rpc_return_t rpc_client_invoke(
242: ipc_port_t, rpc_id_t, rpc_signature_t,
243: rpc_size_t);
244:
245: /*
246: * Definitions for Trans-node RPC routines when DIPC is disabled
247: */
248:
249: #if !DIPC
250: #define rpc_client_invoke(a, b, c, d) KERN_FAILURE
251: #define rpc_server_reply() panic("rpc_server_reply() disabled")
252: #endif /* DIPC */
253:
254:
255: /*
256: * Macros for declaring and using statistics variables.
257: * These variables are present whenever statistics
258: * or assertion checking are enabled.
259: */
260:
261: /* #include <rpc_stats.h> */
262: #define RPC_STATS 1
263: #include <mach_assert.h>
264:
265:
266: #define RPC_DO_STATS (RPC_STATS || MACH_ASSERT)
267:
268:
269: #if RPC_DO_STATS
270: #define dstat_decl(clause) clause
271: #define dstat(clause) clause
272: #define dstat_max(m,c) ((c) > (m) ? (m) = (c) : 0)
273: extern void rpc_kkt_stats(void);
274: #else /* RPC_DO_STATS */
275: #define dstat_decl(clause)
276: #define dstat(clause)
277: #define dstat_max(m,c)
278: #endif /* RPC_DO_STATS */
279:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.