[c594489] | 1 | /*
|
---|
[df4ed85] | 2 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
[c594489] | 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 |
|
---|
[fadd381] | 29 | /** @addtogroup libc
|
---|
[b2951e2] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | */
|
---|
| 34 |
|
---|
[64d2b10] | 35 | #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
|
---|
[5b0cf63] | 36 | #error Do not intermix low-level IPC interface and async framework
|
---|
[64d2b10] | 37 | #endif
|
---|
| 38 |
|
---|
[fadd381] | 39 | #ifndef LIBC_ASYNC_H_
|
---|
| 40 | #define LIBC_ASYNC_H_
|
---|
[630c3a9] | 41 |
|
---|
[64d2b10] | 42 | #include <ipc/common.h>
|
---|
[bc1f1c2] | 43 | #include <fibril.h>
|
---|
[f25b73d6] | 44 | #include <sys/time.h>
|
---|
[fc42b28] | 45 | #include <atomic.h>
|
---|
[3e6a98c5] | 46 | #include <stdbool.h>
|
---|
[1c635d6] | 47 | #include <abi/proc/task.h>
|
---|
[8820544] | 48 | #include <abi/ddi/irq.h>
|
---|
| 49 | #include <abi/ipc/event.h>
|
---|
[abf2dfd] | 50 | #include <abi/ipc/interfaces.h>
|
---|
[01c3bb4] | 51 | #include <abi/cap.h>
|
---|
[630c3a9] | 52 |
|
---|
[6b96dc06] | 53 | #include <_bits/__noreturn.h>
|
---|
| 54 |
|
---|
[01c3bb4] | 55 | typedef sysarg_t aid_t;
|
---|
[abf2dfd] | 56 | typedef sysarg_t port_id_t;
|
---|
[46eec3b] | 57 |
|
---|
| 58 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
| 59 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
| 60 |
|
---|
[b688fd8] | 61 | /** Port connection handler
|
---|
[9934f7d] | 62 | *
|
---|
[984a9ba] | 63 | * @param call Incoming call or NULL if connection initiated from inside
|
---|
| 64 | * using async_create_callback_port()
|
---|
| 65 | * @param arg Local argument.
|
---|
[f9b2cb4c] | 66 | *
|
---|
[9934f7d] | 67 | */
|
---|
[984a9ba] | 68 | typedef void (*async_port_handler_t)(ipc_call_t *, void *);
|
---|
[9934f7d] | 69 |
|
---|
[8820544] | 70 | /** Notification handler */
|
---|
[01c3bb4] | 71 | typedef void (*async_notification_handler_t)(ipc_call_t *, void *);
|
---|
[9db9b10] | 72 |
|
---|
[79ae36dd] | 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,
|
---|
[a35b458] | 84 |
|
---|
[f9b2cb4c] | 85 | /** Exchange management via mutual exclusion
|
---|
[79ae36dd] | 86 | *
|
---|
[f9b2cb4c] | 87 | * Suitable for any kind of client/server communication,
|
---|
| 88 | * but can limit parallelism.
|
---|
[79ae36dd] | 89 | *
|
---|
| 90 | */
|
---|
[f9b2cb4c] | 91 | EXCHANGE_SERIALIZE = 1,
|
---|
[a35b458] | 92 |
|
---|
[f9b2cb4c] | 93 | /** Exchange management via phone cloning
|
---|
[79ae36dd] | 94 | *
|
---|
[f9b2cb4c] | 95 | * Suitable for servers which support client
|
---|
| 96 | * data tracking by task hashes and do not
|
---|
| 97 | * mind cloned phones.
|
---|
[79ae36dd] | 98 | *
|
---|
| 99 | */
|
---|
[f9b2cb4c] | 100 | EXCHANGE_PARALLEL = 2
|
---|
[79ae36dd] | 101 | } exch_mgmt_t;
|
---|
| 102 |
|
---|
[b76a7329] | 103 | /** Forward declarations */
|
---|
[5da7199] | 104 | struct async_exch;
|
---|
| 105 | struct async_sess;
|
---|
[b76a7329] | 106 |
|
---|
[5da7199] | 107 | typedef struct async_sess async_sess_t;
|
---|
| 108 | typedef struct async_exch async_exch_t;
|
---|
[79ae36dd] | 109 |
|
---|
[6b96dc06] | 110 | extern __noreturn void async_manager(void);
|
---|
[9db9b10] | 111 |
|
---|
[47b7006] | 112 | #define async_get_call(data) \
|
---|
| 113 | async_get_call_timeout(data, 0)
|
---|
[440cff5] | 114 |
|
---|
[984a9ba] | 115 | extern bool async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
[db24058] | 116 |
|
---|
[0cc4313] | 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
|
---|
[79ae36dd] | 120 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
[0cc4313] | 121 | * on m.
|
---|
[440cff5] | 122 | */
|
---|
| 123 |
|
---|
[79ae36dd] | 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,
|
---|
[11bb813] | 138 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[79ae36dd] | 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 |
|
---|
[b7fd2a0] | 142 | extern void async_wait_for(aid_t, errno_t *);
|
---|
| 143 | extern errno_t async_wait_timeout(aid_t, errno_t *, suseconds_t);
|
---|
[47c9a8c] | 144 | extern void async_forget(aid_t);
|
---|
[440cff5] | 145 |
|
---|
[46eec3b] | 146 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 147 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
[79ae36dd] | 148 | extern void *async_get_client_data(void);
|
---|
[e2ab36f1] | 149 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
| 150 | extern void async_put_client_data_by_id(task_id_t);
|
---|
[23882034] | 151 |
|
---|
[b7fd2a0] | 152 | extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
|
---|
[566992e1] | 153 | port_id_t *);
|
---|
[b688fd8] | 154 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
[b7fd2a0] | 155 | extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
|
---|
[78bb04b] | 156 | sysarg_t, async_port_handler_t, void *, port_id_t *);
|
---|
| 157 |
|
---|
[b7fd2a0] | 158 | extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
|
---|
[eadaeae8] | 159 | const irq_code_t *, cap_irq_handle_t *);
|
---|
| 160 | extern errno_t async_irq_unsubscribe(cap_irq_handle_t);
|
---|
[8820544] | 161 |
|
---|
[b7fd2a0] | 162 | extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
[8820544] | 163 | void *);
|
---|
[b7fd2a0] | 164 | extern errno_t async_event_task_subscribe(event_task_type_t,
|
---|
[8820544] | 165 | async_notification_handler_t, void *);
|
---|
[b7fd2a0] | 166 | extern errno_t async_event_unsubscribe(event_type_t);
|
---|
| 167 | extern errno_t async_event_task_unsubscribe(event_task_type_t);
|
---|
| 168 | extern errno_t async_event_unmask(event_type_t);
|
---|
| 169 | extern errno_t async_event_task_unmask(event_task_type_t);
|
---|
[0cc4313] | 170 |
|
---|
[64d2b10] | 171 | /*
|
---|
| 172 | * Wrappers for simple communication.
|
---|
| 173 | */
|
---|
| 174 |
|
---|
[79ae36dd] | 175 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
| 176 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
| 177 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 178 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 179 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 180 | sysarg_t);
|
---|
[79ae36dd] | 181 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 182 | sysarg_t, sysarg_t);
|
---|
[64d2b10] | 183 |
|
---|
| 184 | /*
|
---|
| 185 | * Wrappers for answer routines.
|
---|
| 186 | */
|
---|
| 187 |
|
---|
[984a9ba] | 188 | extern errno_t async_answer_0(ipc_call_t *, errno_t);
|
---|
| 189 | extern errno_t async_answer_1(ipc_call_t *, errno_t, sysarg_t);
|
---|
| 190 | extern errno_t async_answer_2(ipc_call_t *, errno_t, sysarg_t, sysarg_t);
|
---|
| 191 | extern errno_t async_answer_3(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 192 | sysarg_t);
|
---|
[984a9ba] | 193 | extern errno_t async_answer_4(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 194 | sysarg_t, sysarg_t);
|
---|
[984a9ba] | 195 | extern errno_t async_answer_5(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 196 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 197 |
|
---|
| 198 | /*
|
---|
| 199 | * Wrappers for forwarding routines.
|
---|
| 200 | */
|
---|
| 201 |
|
---|
[984a9ba] | 202 | extern errno_t async_forward_fast(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 203 | sysarg_t, sysarg_t, unsigned int);
|
---|
[984a9ba] | 204 | extern errno_t async_forward_slow(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 205 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[0cc4313] | 206 |
|
---|
| 207 | /*
|
---|
| 208 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 209 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 210 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 211 | * and slow verion based on m.
|
---|
| 212 | */
|
---|
[64d2b10] | 213 |
|
---|
[79ae36dd] | 214 | #define async_req_0_0(exch, method) \
|
---|
| 215 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
| 216 | #define async_req_0_1(exch, method, r1) \
|
---|
| 217 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
| 218 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
| 219 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
| 220 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
| 221 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
| 222 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
| 223 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
| 224 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
| 225 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
| 226 |
|
---|
| 227 | #define async_req_1_0(exch, method, arg1) \
|
---|
| 228 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 229 | NULL)
|
---|
| 230 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
| 231 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
| 232 | NULL)
|
---|
| 233 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
| 234 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
| 235 | NULL)
|
---|
| 236 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
| 237 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 238 | NULL)
|
---|
[79ae36dd] | 239 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
| 240 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 241 | NULL)
|
---|
[79ae36dd] | 242 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 243 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 244 | rc5)
|
---|
| 245 |
|
---|
| 246 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
| 247 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
| 248 | NULL, NULL)
|
---|
| 249 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
| 250 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
| 251 | NULL, NULL)
|
---|
| 252 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
| 253 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
[9db9b10] | 254 | NULL)
|
---|
[79ae36dd] | 255 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
| 256 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 257 | NULL)
|
---|
[79ae36dd] | 258 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
| 259 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 260 | NULL)
|
---|
[79ae36dd] | 261 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 262 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 263 | rc5)
|
---|
| 264 |
|
---|
| 265 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
| 266 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
[9db9b10] | 267 | NULL, NULL)
|
---|
[79ae36dd] | 268 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
| 269 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
[9db9b10] | 270 | NULL, NULL)
|
---|
[79ae36dd] | 271 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
| 272 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
[9db9b10] | 273 | NULL, NULL)
|
---|
[79ae36dd] | 274 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
| 275 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
[9db9b10] | 276 | NULL, NULL)
|
---|
[79ae36dd] | 277 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
| 278 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 279 | rc4, NULL)
|
---|
| 280 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 281 | rc5) \
|
---|
| 282 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 283 | rc4, rc5)
|
---|
| 284 |
|
---|
| 285 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
| 286 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
[9db9b10] | 287 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 288 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
| 289 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
[9db9b10] | 290 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 291 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
| 292 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
| 293 | NULL, NULL)
|
---|
| 294 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
| 295 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 296 | NULL, NULL)
|
---|
| 297 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 298 | rc4) \
|
---|
[79ae36dd] | 299 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 300 | rc4, NULL)
|
---|
| 301 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 302 | rc4, rc5) \
|
---|
[79ae36dd] | 303 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 304 | rc4, rc5)
|
---|
| 305 |
|
---|
| 306 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 307 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
| 308 | NULL, NULL, NULL, NULL)
|
---|
| 309 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
| 310 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
| 311 | NULL, NULL, NULL, NULL)
|
---|
| 312 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
| 313 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 314 | NULL, NULL, NULL)
|
---|
| 315 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 316 | rc3) \
|
---|
[79ae36dd] | 317 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 318 | rc3, NULL, NULL)
|
---|
| 319 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 320 | rc3, rc4) \
|
---|
[79ae36dd] | 321 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 322 | rc3, rc4, NULL)
|
---|
| 323 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 324 | rc3, rc4, rc5) \
|
---|
[79ae36dd] | 325 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 326 | rc3, rc4, rc5)
|
---|
[fc42b28] | 327 |
|
---|
[b7fd2a0] | 328 | extern errno_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 329 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 330 | sysarg_t *);
|
---|
[b7fd2a0] | 331 | extern errno_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 332 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 333 | sysarg_t *, sysarg_t *);
|
---|
[085bd54] | 334 |
|
---|
[914c693] | 335 | extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t,
|
---|
| 336 | sysarg_t);
|
---|
| 337 | extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t,
|
---|
[566992e1] | 338 | sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 339 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
[fc42b28] | 340 |
|
---|
[9b1baac] | 341 | extern errno_t async_connect_to_me(async_exch_t *, iface_t, sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 342 |
|
---|
[b7fd2a0] | 343 | extern errno_t async_hangup(async_sess_t *);
|
---|
[f74392f] | 344 |
|
---|
[79ae36dd] | 345 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
| 346 | extern void async_exchange_end(async_exch_t *);
|
---|
| 347 |
|
---|
[93ad49a8] | 348 | /*
|
---|
| 349 | * FIXME These functions just work around problems with parallel exchange
|
---|
| 350 | * management. Proper solution needs to be implemented.
|
---|
| 351 | */
|
---|
[914c693] | 352 | void async_sess_args_set(async_sess_t *sess, iface_t, sysarg_t, sysarg_t);
|
---|
[93ad49a8] | 353 |
|
---|
[0da4e41] | 354 | /*
|
---|
| 355 | * User-friendly wrappers for async_share_in_start().
|
---|
| 356 | */
|
---|
[64d2b10] | 357 |
|
---|
[fbcdeb8] | 358 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
| 359 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
| 360 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
| 361 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
| 362 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
| 363 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
| 364 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
| 365 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
| 366 |
|
---|
[b7fd2a0] | 367 | extern errno_t async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
[fbcdeb8] | 368 | unsigned int *, void **);
|
---|
[984a9ba] | 369 | extern bool async_share_in_receive(ipc_call_t *, size_t *);
|
---|
| 370 | extern errno_t async_share_in_finalize(ipc_call_t *, void *, unsigned int);
|
---|
[47b7006] | 371 |
|
---|
[b7fd2a0] | 372 | extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
[984a9ba] | 373 | extern bool async_share_out_receive(ipc_call_t *, size_t *, unsigned int *);
|
---|
| 374 | extern errno_t async_share_out_finalize(ipc_call_t *, void **);
|
---|
[b4cbef1] | 375 |
|
---|
| 376 | /*
|
---|
| 377 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 378 | */
|
---|
[64d2b10] | 379 |
|
---|
[79ae36dd] | 380 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
| 381 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 382 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
| 383 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 384 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
| 385 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 386 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
| 387 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 388 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 389 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 390 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 391 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 392 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 393 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
| 394 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 395 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 396 | answer)
|
---|
| 397 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 398 | answer) \
|
---|
| 399 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 400 | NULL)
|
---|
[79ae36dd] | 401 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 402 | answer) \
|
---|
| 403 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 404 | answer)
|
---|
| 405 |
|
---|
| 406 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
[b7fd2a0] | 407 | extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
|
---|
[984a9ba] | 408 | extern bool async_data_read_receive(ipc_call_t *, size_t *);
|
---|
| 409 | extern errno_t async_data_read_finalize(ipc_call_t *, const void *, size_t);
|
---|
[eda925a] | 410 |
|
---|
[b7fd2a0] | 411 | extern errno_t async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 412 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 413 |
|
---|
| 414 | /*
|
---|
[eda925a] | 415 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 416 | */
|
---|
[64d2b10] | 417 |
|
---|
[79ae36dd] | 418 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
| 419 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 420 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
| 421 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 422 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
| 423 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 424 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
| 425 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 426 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 427 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 428 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 429 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 430 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 431 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 432 | NULL)
|
---|
| 433 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 434 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 435 | answer)
|
---|
| 436 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 437 | answer) \
|
---|
| 438 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 439 | NULL)
|
---|
[79ae36dd] | 440 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 441 | answer) \
|
---|
| 442 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 443 | answer)
|
---|
| 444 |
|
---|
[b7fd2a0] | 445 | extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
[984a9ba] | 446 | extern bool async_data_write_receive(ipc_call_t *, size_t *);
|
---|
| 447 | extern errno_t async_data_write_finalize(ipc_call_t *, void *, size_t);
|
---|
[eda925a] | 448 |
|
---|
[b7fd2a0] | 449 | extern errno_t async_data_write_accept(void **, const bool, const size_t,
|
---|
[eda925a] | 450 | const size_t, const size_t, size_t *);
|
---|
[b7fd2a0] | 451 | extern void async_data_write_void(errno_t);
|
---|
[eda925a] | 452 |
|
---|
[b7fd2a0] | 453 | extern errno_t async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 454 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 455 |
|
---|
| 456 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
[8869f7b] | 457 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
[8aa42e3] | 458 |
|
---|
[b7fd2a0] | 459 | extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[2c4aa39] | 460 | sysarg_t, async_exch_t *);
|
---|
[984a9ba] | 461 | extern bool async_state_change_receive(ipc_call_t *);
|
---|
| 462 | extern errno_t async_state_change_finalize(ipc_call_t *, async_exch_t *);
|
---|
[2c4aa39] | 463 |
|
---|
[58cbf8d5] | 464 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
| 465 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
| 466 | extern void async_remote_state_release(async_sess_t *);
|
---|
| 467 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
| 468 |
|
---|
[ae6021d] | 469 | extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
|
---|
| 470 | sysarg_t, sysarg_t, sysarg_t);
|
---|
[101516d] | 471 |
|
---|
[3b1cc8d] | 472 | errno_t async_spawn_notification_handler(void);
|
---|
[514d561] | 473 | fid_t async_create_manager(void);
|
---|
[3b1cc8d] | 474 |
|
---|
[630c3a9] | 475 | #endif
|
---|
[b2951e2] | 476 |
|
---|
[fadd381] | 477 | /** @}
|
---|
[b2951e2] | 478 | */
|
---|