1 | /*
|
---|
2 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup libc
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | */
|
---|
34 |
|
---|
35 | #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
|
---|
36 | #error Do not intermix low-level IPC interface and async framework
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #ifndef LIBC_ASYNC_H_
|
---|
40 | #define LIBC_ASYNC_H_
|
---|
41 |
|
---|
42 | #include <ipc/common.h>
|
---|
43 | #include <fibril.h>
|
---|
44 | #include <sys/time.h>
|
---|
45 | #include <atomic.h>
|
---|
46 | #include <stdbool.h>
|
---|
47 | #include <abi/proc/task.h>
|
---|
48 | #include <abi/ddi/irq.h>
|
---|
49 | #include <abi/ipc/event.h>
|
---|
50 | #include <abi/ipc/interfaces.h>
|
---|
51 | #include <abi/cap.h>
|
---|
52 |
|
---|
53 | #include <_bits/__noreturn.h>
|
---|
54 |
|
---|
55 | typedef sysarg_t aid_t;
|
---|
56 | typedef sysarg_t port_id_t;
|
---|
57 |
|
---|
58 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
59 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
60 |
|
---|
61 | /** Port connection handler
|
---|
62 | *
|
---|
63 | * @param call Incoming call or NULL if connection initiated from inside
|
---|
64 | * using async_create_callback_port()
|
---|
65 | * @param arg Local argument.
|
---|
66 | *
|
---|
67 | */
|
---|
68 | typedef void (*async_port_handler_t)(ipc_call_t *, void *);
|
---|
69 |
|
---|
70 | /** Notification handler */
|
---|
71 | typedef void (*async_notification_handler_t)(ipc_call_t *, void *);
|
---|
72 |
|
---|
73 | /** Exchange management style
|
---|
74 | *
|
---|
75 | */
|
---|
76 | typedef enum {
|
---|
77 | /** No explicit exchange management
|
---|
78 | *
|
---|
79 | * Suitable for protocols which use a single
|
---|
80 | * IPC message per exchange only.
|
---|
81 | *
|
---|
82 | */
|
---|
83 | EXCHANGE_ATOMIC = 0,
|
---|
84 |
|
---|
85 | /** Exchange management via mutual exclusion
|
---|
86 | *
|
---|
87 | * Suitable for any kind of client/server communication,
|
---|
88 | * but can limit parallelism.
|
---|
89 | *
|
---|
90 | */
|
---|
91 | EXCHANGE_SERIALIZE = 1,
|
---|
92 |
|
---|
93 | /** Exchange management via phone cloning
|
---|
94 | *
|
---|
95 | * Suitable for servers which support client
|
---|
96 | * data tracking by task hashes and do not
|
---|
97 | * mind cloned phones.
|
---|
98 | *
|
---|
99 | */
|
---|
100 | EXCHANGE_PARALLEL = 2
|
---|
101 | } exch_mgmt_t;
|
---|
102 |
|
---|
103 | /** Forward declarations */
|
---|
104 | struct async_exch;
|
---|
105 | struct async_sess;
|
---|
106 |
|
---|
107 | typedef struct async_sess async_sess_t;
|
---|
108 | typedef struct async_exch async_exch_t;
|
---|
109 |
|
---|
110 | extern __noreturn void async_manager(void);
|
---|
111 |
|
---|
112 | #define async_get_call(data) \
|
---|
113 | async_get_call_timeout(data, 0)
|
---|
114 |
|
---|
115 | extern bool async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
116 |
|
---|
117 | /*
|
---|
118 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
119 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
120 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
121 | * on m.
|
---|
122 | */
|
---|
123 |
|
---|
124 | #define async_send_0(exch, method, dataptr) \
|
---|
125 | async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
|
---|
126 | #define async_send_1(exch, method, arg1, dataptr) \
|
---|
127 | async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
|
---|
128 | #define async_send_2(exch, method, arg1, arg2, dataptr) \
|
---|
129 | async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
|
---|
130 | #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
|
---|
131 | async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
|
---|
132 | #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
133 | async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
|
---|
134 | #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
135 | async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
|
---|
136 |
|
---|
137 | extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
138 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
139 | extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
140 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
141 |
|
---|
142 | extern void async_wait_for(aid_t, errno_t *);
|
---|
143 | extern errno_t async_wait_timeout(aid_t, errno_t *, suseconds_t);
|
---|
144 | extern void async_forget(aid_t);
|
---|
145 |
|
---|
146 | extern void async_usleep(suseconds_t);
|
---|
147 | extern void async_sleep(unsigned int);
|
---|
148 |
|
---|
149 | extern void async_create_manager(void);
|
---|
150 | extern void async_destroy_manager(void);
|
---|
151 |
|
---|
152 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
153 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
154 | extern void *async_get_client_data(void);
|
---|
155 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
156 | extern void async_put_client_data_by_id(task_id_t);
|
---|
157 |
|
---|
158 | extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
|
---|
159 | port_id_t *);
|
---|
160 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
161 | extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
|
---|
162 | sysarg_t, async_port_handler_t, void *, port_id_t *);
|
---|
163 |
|
---|
164 | extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
|
---|
165 | const irq_code_t *, cap_irq_handle_t *);
|
---|
166 | extern errno_t async_irq_unsubscribe(cap_irq_handle_t);
|
---|
167 |
|
---|
168 | extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
169 | void *);
|
---|
170 | extern errno_t async_event_task_subscribe(event_task_type_t,
|
---|
171 | async_notification_handler_t, void *);
|
---|
172 | extern errno_t async_event_unsubscribe(event_type_t);
|
---|
173 | extern errno_t async_event_task_unsubscribe(event_task_type_t);
|
---|
174 | extern errno_t async_event_unmask(event_type_t);
|
---|
175 | extern errno_t async_event_task_unmask(event_task_type_t);
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * Wrappers for simple communication.
|
---|
179 | */
|
---|
180 |
|
---|
181 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
182 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
183 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
184 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
185 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
186 | sysarg_t);
|
---|
187 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
188 | sysarg_t, sysarg_t);
|
---|
189 |
|
---|
190 | /*
|
---|
191 | * Wrappers for answer routines.
|
---|
192 | */
|
---|
193 |
|
---|
194 | extern errno_t async_answer_0(ipc_call_t *, errno_t);
|
---|
195 | extern errno_t async_answer_1(ipc_call_t *, errno_t, sysarg_t);
|
---|
196 | extern errno_t async_answer_2(ipc_call_t *, errno_t, sysarg_t, sysarg_t);
|
---|
197 | extern errno_t async_answer_3(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
198 | sysarg_t);
|
---|
199 | extern errno_t async_answer_4(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
200 | sysarg_t, sysarg_t);
|
---|
201 | extern errno_t async_answer_5(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
202 | sysarg_t, sysarg_t, sysarg_t);
|
---|
203 |
|
---|
204 | /*
|
---|
205 | * Wrappers for forwarding routines.
|
---|
206 | */
|
---|
207 |
|
---|
208 | extern errno_t async_forward_fast(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
209 | sysarg_t, sysarg_t, unsigned int);
|
---|
210 | extern errno_t async_forward_slow(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
211 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
212 |
|
---|
213 | /*
|
---|
214 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
215 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
216 | * and n is the number of return arguments. The macros decide between the fast
|
---|
217 | * and slow verion based on m.
|
---|
218 | */
|
---|
219 |
|
---|
220 | #define async_req_0_0(exch, method) \
|
---|
221 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
222 | #define async_req_0_1(exch, method, r1) \
|
---|
223 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
224 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
225 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
226 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
227 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
228 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
229 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
230 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
231 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
232 |
|
---|
233 | #define async_req_1_0(exch, method, arg1) \
|
---|
234 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
235 | NULL)
|
---|
236 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
237 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
238 | NULL)
|
---|
239 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
240 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
241 | NULL)
|
---|
242 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
243 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
244 | NULL)
|
---|
245 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
246 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
247 | NULL)
|
---|
248 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
249 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
250 | rc5)
|
---|
251 |
|
---|
252 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
253 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
254 | NULL, NULL)
|
---|
255 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
256 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
257 | NULL, NULL)
|
---|
258 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
259 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
260 | NULL)
|
---|
261 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
262 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
263 | NULL)
|
---|
264 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
265 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
266 | NULL)
|
---|
267 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
268 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
269 | rc5)
|
---|
270 |
|
---|
271 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
272 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
273 | NULL, NULL)
|
---|
274 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
275 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
276 | NULL, NULL)
|
---|
277 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
278 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
279 | NULL, NULL)
|
---|
280 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
281 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
282 | NULL, NULL)
|
---|
283 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
284 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
285 | rc4, NULL)
|
---|
286 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
287 | rc5) \
|
---|
288 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
289 | rc4, rc5)
|
---|
290 |
|
---|
291 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
292 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
293 | NULL, NULL, NULL)
|
---|
294 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
295 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
296 | NULL, NULL, NULL)
|
---|
297 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
298 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
299 | NULL, NULL)
|
---|
300 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
301 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
302 | NULL, NULL)
|
---|
303 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
304 | rc4) \
|
---|
305 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
306 | rc4, NULL)
|
---|
307 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
308 | rc4, rc5) \
|
---|
309 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
310 | rc4, rc5)
|
---|
311 |
|
---|
312 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
313 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
314 | NULL, NULL, NULL, NULL)
|
---|
315 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
316 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
317 | NULL, NULL, NULL, NULL)
|
---|
318 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
319 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
320 | NULL, NULL, NULL)
|
---|
321 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
322 | rc3) \
|
---|
323 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
324 | rc3, NULL, NULL)
|
---|
325 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
326 | rc3, rc4) \
|
---|
327 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
328 | rc3, rc4, NULL)
|
---|
329 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
330 | rc3, rc4, rc5) \
|
---|
331 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
332 | rc3, rc4, rc5)
|
---|
333 |
|
---|
334 | extern errno_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
335 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
336 | sysarg_t *);
|
---|
337 | extern errno_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
338 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
339 | sysarg_t *, sysarg_t *);
|
---|
340 |
|
---|
341 | extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
|
---|
342 | sysarg_t, sysarg_t);
|
---|
343 | extern async_sess_t *async_connect_me_to_iface(async_exch_t *, iface_t,
|
---|
344 | sysarg_t, sysarg_t);
|
---|
345 | extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
|
---|
346 | sysarg_t, sysarg_t, sysarg_t);
|
---|
347 | extern async_sess_t *async_connect_me_to_blocking_iface(async_exch_t *, iface_t,
|
---|
348 | sysarg_t, sysarg_t);
|
---|
349 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
350 |
|
---|
351 | extern errno_t async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
352 |
|
---|
353 | extern errno_t async_hangup(async_sess_t *);
|
---|
354 | extern void async_poke(void);
|
---|
355 |
|
---|
356 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
357 | extern void async_exchange_end(async_exch_t *);
|
---|
358 |
|
---|
359 | /*
|
---|
360 | * FIXME These functions just work around problems with parallel exchange
|
---|
361 | * management. Proper solution needs to be implemented.
|
---|
362 | */
|
---|
363 | void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
|
---|
364 |
|
---|
365 | /*
|
---|
366 | * User-friendly wrappers for async_share_in_start().
|
---|
367 | */
|
---|
368 |
|
---|
369 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
370 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
371 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
372 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
373 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
374 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
375 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
376 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
377 |
|
---|
378 | extern errno_t async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
379 | unsigned int *, void **);
|
---|
380 | extern bool async_share_in_receive(ipc_call_t *, size_t *);
|
---|
381 | extern errno_t async_share_in_finalize(ipc_call_t *, void *, unsigned int);
|
---|
382 |
|
---|
383 | extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
384 | extern bool async_share_out_receive(ipc_call_t *, size_t *, unsigned int *);
|
---|
385 | extern errno_t async_share_out_finalize(ipc_call_t *, void **);
|
---|
386 |
|
---|
387 | /*
|
---|
388 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
389 | */
|
---|
390 |
|
---|
391 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
392 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
393 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
394 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
395 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
396 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
397 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
398 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
399 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
400 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
401 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
402 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
403 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
404 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
405 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
406 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
407 | answer)
|
---|
408 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
409 | answer) \
|
---|
410 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
411 | NULL)
|
---|
412 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
413 | answer) \
|
---|
414 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
415 | answer)
|
---|
416 |
|
---|
417 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
418 | extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
|
---|
419 | extern bool async_data_read_receive(ipc_call_t *, size_t *);
|
---|
420 | extern errno_t async_data_read_finalize(ipc_call_t *, const void *, size_t);
|
---|
421 |
|
---|
422 | extern errno_t async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
423 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
424 |
|
---|
425 | /*
|
---|
426 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
427 | */
|
---|
428 |
|
---|
429 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
430 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
431 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
432 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
433 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
434 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
435 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
436 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
437 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
438 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
439 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
440 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
441 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
442 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
443 | NULL)
|
---|
444 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
445 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
446 | answer)
|
---|
447 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
448 | answer) \
|
---|
449 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
450 | NULL)
|
---|
451 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
452 | answer) \
|
---|
453 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
454 | answer)
|
---|
455 |
|
---|
456 | extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
457 | extern bool async_data_write_receive(ipc_call_t *, size_t *);
|
---|
458 | extern errno_t async_data_write_finalize(ipc_call_t *, void *, size_t);
|
---|
459 |
|
---|
460 | extern errno_t async_data_write_accept(void **, const bool, const size_t,
|
---|
461 | const size_t, const size_t, size_t *);
|
---|
462 | extern void async_data_write_void(errno_t);
|
---|
463 |
|
---|
464 | extern errno_t async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
465 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
466 |
|
---|
467 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
468 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
469 |
|
---|
470 | extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
471 | sysarg_t, async_exch_t *);
|
---|
472 | extern bool async_state_change_receive(ipc_call_t *);
|
---|
473 | extern errno_t async_state_change_finalize(ipc_call_t *, async_exch_t *);
|
---|
474 |
|
---|
475 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
476 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
477 | extern void async_remote_state_release(async_sess_t *);
|
---|
478 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
479 |
|
---|
480 | extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
|
---|
481 | sysarg_t, sysarg_t, sysarg_t);
|
---|
482 |
|
---|
483 | errno_t async_spawn_notification_handler(void);
|
---|
484 |
|
---|
485 | #endif
|
---|
486 |
|
---|
487 | /** @}
|
---|
488 | */
|
---|