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 |
|
---|
52 | typedef ipc_callid_t aid_t;
|
---|
53 | typedef sysarg_t port_id_t;
|
---|
54 |
|
---|
55 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
56 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
57 |
|
---|
58 | /** Port connection handler
|
---|
59 | *
|
---|
60 | * @param callid ID of incoming call or 0 if connection initiated from
|
---|
61 | * inside using async_create_callback_port()
|
---|
62 | * @param call Incoming call or 0 if connection initiated from inside
|
---|
63 | * using async_create_callback_port()
|
---|
64 | * @param arg Local argument.
|
---|
65 | *
|
---|
66 | */
|
---|
67 | typedef void (*async_port_handler_t)(ipc_callid_t, ipc_call_t *, void *);
|
---|
68 |
|
---|
69 | /** Notification handler */
|
---|
70 | typedef void (*async_notification_handler_t)(ipc_callid_t, ipc_call_t *,
|
---|
71 | 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 atomic_t threads_in_ipc_wait;
|
---|
111 |
|
---|
112 | #define async_manager() \
|
---|
113 | do { \
|
---|
114 | futex_down(&async_futex); \
|
---|
115 | fibril_switch(FIBRIL_FROM_DEAD); \
|
---|
116 | } while (0)
|
---|
117 |
|
---|
118 | #define async_get_call(data) \
|
---|
119 | async_get_call_timeout(data, 0)
|
---|
120 |
|
---|
121 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
122 |
|
---|
123 | /*
|
---|
124 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
125 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
126 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
127 | * on m.
|
---|
128 | */
|
---|
129 |
|
---|
130 | #define async_send_0(exch, method, dataptr) \
|
---|
131 | async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
|
---|
132 | #define async_send_1(exch, method, arg1, dataptr) \
|
---|
133 | async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
|
---|
134 | #define async_send_2(exch, method, arg1, arg2, dataptr) \
|
---|
135 | async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
|
---|
136 | #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
|
---|
137 | async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
|
---|
138 | #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
139 | async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
|
---|
140 | #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
141 | async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
|
---|
142 |
|
---|
143 | extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
144 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
145 | extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
146 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
147 |
|
---|
148 | extern void async_wait_for(aid_t, sysarg_t *);
|
---|
149 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
---|
150 | extern void async_forget(aid_t);
|
---|
151 |
|
---|
152 | extern void async_usleep(suseconds_t);
|
---|
153 | extern void async_create_manager(void);
|
---|
154 | extern void async_destroy_manager(void);
|
---|
155 |
|
---|
156 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
157 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
158 | extern void *async_get_client_data(void);
|
---|
159 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
160 | extern void async_put_client_data_by_id(task_id_t);
|
---|
161 |
|
---|
162 | extern int async_create_port(iface_t, async_port_handler_t, void *,
|
---|
163 | port_id_t *);
|
---|
164 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
165 | extern int async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
|
---|
166 | sysarg_t, async_port_handler_t, void *, port_id_t *);
|
---|
167 |
|
---|
168 | extern int async_irq_subscribe(int, int, async_notification_handler_t, void *,
|
---|
169 | const irq_code_t *);
|
---|
170 | extern int async_irq_unsubscribe(int);
|
---|
171 |
|
---|
172 | extern int async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
173 | void *);
|
---|
174 | extern int async_event_task_subscribe(event_task_type_t,
|
---|
175 | async_notification_handler_t, void *);
|
---|
176 | extern int async_event_unsubscribe(event_type_t);
|
---|
177 | extern int async_event_task_unsubscribe(event_task_type_t);
|
---|
178 | extern int async_event_unmask(event_type_t);
|
---|
179 | extern int async_event_task_unmask(event_task_type_t);
|
---|
180 |
|
---|
181 | /*
|
---|
182 | * Wrappers for simple communication.
|
---|
183 | */
|
---|
184 |
|
---|
185 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
186 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
187 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
188 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
189 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
190 | sysarg_t);
|
---|
191 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
192 | sysarg_t, sysarg_t);
|
---|
193 |
|
---|
194 | /*
|
---|
195 | * Wrappers for answer routines.
|
---|
196 | */
|
---|
197 |
|
---|
198 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
---|
199 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
---|
200 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
201 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
202 | sysarg_t);
|
---|
203 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
204 | sysarg_t, sysarg_t);
|
---|
205 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
206 | sysarg_t, sysarg_t, sysarg_t);
|
---|
207 |
|
---|
208 | /*
|
---|
209 | * Wrappers for forwarding routines.
|
---|
210 | */
|
---|
211 |
|
---|
212 | extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
213 | sysarg_t, unsigned int);
|
---|
214 | extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
215 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
216 |
|
---|
217 | /*
|
---|
218 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
219 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
220 | * and n is the number of return arguments. The macros decide between the fast
|
---|
221 | * and slow verion based on m.
|
---|
222 | */
|
---|
223 |
|
---|
224 | #define async_req_0_0(exch, method) \
|
---|
225 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
226 | #define async_req_0_1(exch, method, r1) \
|
---|
227 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
228 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
229 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
230 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
231 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
232 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
233 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
234 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
235 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
236 |
|
---|
237 | #define async_req_1_0(exch, method, arg1) \
|
---|
238 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
239 | NULL)
|
---|
240 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
241 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
242 | NULL)
|
---|
243 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
244 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
245 | NULL)
|
---|
246 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
247 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
248 | NULL)
|
---|
249 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
250 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
251 | NULL)
|
---|
252 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
253 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
254 | rc5)
|
---|
255 |
|
---|
256 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
257 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
258 | NULL, NULL)
|
---|
259 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
260 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
261 | NULL, NULL)
|
---|
262 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
263 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
264 | NULL)
|
---|
265 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
266 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
267 | NULL)
|
---|
268 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
269 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
270 | NULL)
|
---|
271 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
272 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
273 | rc5)
|
---|
274 |
|
---|
275 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
276 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
277 | NULL, NULL)
|
---|
278 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
279 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
280 | NULL, NULL)
|
---|
281 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
282 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
283 | NULL, NULL)
|
---|
284 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
285 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
286 | NULL, NULL)
|
---|
287 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
288 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
289 | rc4, NULL)
|
---|
290 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
291 | rc5) \
|
---|
292 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
293 | rc4, rc5)
|
---|
294 |
|
---|
295 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
296 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
297 | NULL, NULL, NULL)
|
---|
298 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
299 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
300 | NULL, NULL, NULL)
|
---|
301 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
302 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
303 | NULL, NULL)
|
---|
304 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
305 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
306 | NULL, NULL)
|
---|
307 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
308 | rc4) \
|
---|
309 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
310 | rc4, NULL)
|
---|
311 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
312 | rc4, rc5) \
|
---|
313 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
314 | rc4, rc5)
|
---|
315 |
|
---|
316 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
317 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
318 | NULL, NULL, NULL, NULL)
|
---|
319 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
320 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
321 | NULL, NULL, NULL, NULL)
|
---|
322 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
323 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
324 | NULL, NULL, NULL)
|
---|
325 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
326 | rc3) \
|
---|
327 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
328 | rc3, NULL, NULL)
|
---|
329 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
330 | rc3, rc4) \
|
---|
331 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
332 | rc3, rc4, NULL)
|
---|
333 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
334 | rc3, rc4, rc5) \
|
---|
335 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
336 | rc3, rc4, rc5)
|
---|
337 |
|
---|
338 | extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
339 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
340 | sysarg_t *);
|
---|
341 | extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
342 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
343 | sysarg_t *, sysarg_t *);
|
---|
344 |
|
---|
345 | extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
|
---|
346 | extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
|
---|
347 | sysarg_t, sysarg_t);
|
---|
348 | extern async_sess_t *async_connect_me_to_iface(async_exch_t *, iface_t,
|
---|
349 | sysarg_t, sysarg_t);
|
---|
350 | extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
|
---|
351 | sysarg_t, sysarg_t, sysarg_t);
|
---|
352 | extern async_sess_t *async_connect_me_to_blocking_iface(async_exch_t *, iface_t,
|
---|
353 | sysarg_t, sysarg_t);
|
---|
354 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
355 |
|
---|
356 | extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
357 |
|
---|
358 | extern int async_hangup(async_sess_t *);
|
---|
359 | extern void async_poke(void);
|
---|
360 |
|
---|
361 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
362 | extern void async_exchange_end(async_exch_t *);
|
---|
363 |
|
---|
364 | /*
|
---|
365 | * FIXME These functions just work around problems with parallel exchange
|
---|
366 | * management. Proper solution needs to be implemented.
|
---|
367 | */
|
---|
368 | void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
|
---|
369 |
|
---|
370 | /*
|
---|
371 | * User-friendly wrappers for async_share_in_start().
|
---|
372 | */
|
---|
373 |
|
---|
374 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
375 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
376 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
377 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
378 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
379 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
380 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
381 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
382 |
|
---|
383 | extern int async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
384 | unsigned int *, void **);
|
---|
385 | extern bool async_share_in_receive(ipc_callid_t *, size_t *);
|
---|
386 | extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
|
---|
387 |
|
---|
388 | extern int async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
389 | extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
|
---|
390 | extern int async_share_out_finalize(ipc_callid_t, void **);
|
---|
391 |
|
---|
392 | /*
|
---|
393 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
394 | */
|
---|
395 |
|
---|
396 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
397 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
398 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
399 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
400 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
401 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
402 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
403 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
404 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
405 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
406 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
407 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
408 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
409 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
410 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
411 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
412 | answer)
|
---|
413 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
414 | answer) \
|
---|
415 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
416 | NULL)
|
---|
417 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
418 | answer) \
|
---|
419 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
420 | answer)
|
---|
421 |
|
---|
422 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
423 | extern int async_data_read_start(async_exch_t *, void *, size_t);
|
---|
424 | extern bool async_data_read_receive(ipc_callid_t *, size_t *);
|
---|
425 | extern bool async_data_read_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
|
---|
426 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
---|
427 |
|
---|
428 | extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
429 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
430 |
|
---|
431 | /*
|
---|
432 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
433 | */
|
---|
434 |
|
---|
435 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
436 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
437 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
438 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
439 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
440 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
441 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
442 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
443 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
444 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
445 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
446 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
447 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
448 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
449 | NULL)
|
---|
450 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
451 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
452 | answer)
|
---|
453 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
454 | answer) \
|
---|
455 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
456 | NULL)
|
---|
457 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
458 | answer) \
|
---|
459 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
460 | answer)
|
---|
461 |
|
---|
462 | extern int async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
463 | extern bool async_data_write_receive(ipc_callid_t *, size_t *);
|
---|
464 | extern bool async_data_write_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
|
---|
465 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
---|
466 |
|
---|
467 | extern int async_data_write_accept(void **, const bool, const size_t,
|
---|
468 | const size_t, const size_t, size_t *);
|
---|
469 | extern void async_data_write_void(sysarg_t);
|
---|
470 |
|
---|
471 | extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
472 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
473 |
|
---|
474 | extern int async_exchange_clone(async_exch_t *, async_exch_t *);
|
---|
475 | extern async_sess_t *async_clone_receive(exch_mgmt_t);
|
---|
476 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
477 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
478 |
|
---|
479 | extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
480 | sysarg_t, async_exch_t *);
|
---|
481 | extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
|
---|
482 | sysarg_t *);
|
---|
483 | extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
|
---|
484 |
|
---|
485 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
486 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
487 | extern void async_remote_state_release(async_sess_t *);
|
---|
488 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
489 |
|
---|
490 | extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
|
---|
491 | sysarg_t, sysarg_t, sysarg_t);
|
---|
492 |
|
---|
493 | #endif
|
---|
494 |
|
---|
495 | /** @}
|
---|
496 | */
|
---|