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