[79ae36dd] | 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 | #define LIBC_ASYNC_C_
|
---|
| 36 | #define LIBC_ASYNC_OBSOLETE_C_
|
---|
| 37 | #include <ipc/ipc.h>
|
---|
| 38 | #include <async.h>
|
---|
| 39 | #include <async_obsolete.h>
|
---|
| 40 | #undef LIBC_ASYNC_C_
|
---|
| 41 | #undef LIBC_ASYNC_OBSOLETE_C_
|
---|
| 42 |
|
---|
| 43 | #include <fibril.h>
|
---|
| 44 | #include <malloc.h>
|
---|
| 45 | #include <errno.h>
|
---|
| 46 | #include "private/async.h"
|
---|
| 47 |
|
---|
| 48 | /** Send message and return id of the sent message.
|
---|
| 49 | *
|
---|
| 50 | * The return value can be used as input for async_wait() to wait for
|
---|
| 51 | * completion.
|
---|
| 52 | *
|
---|
| 53 | * @param phoneid Handle of the phone that will be used for the send.
|
---|
| 54 | * @param method Service-defined method.
|
---|
| 55 | * @param arg1 Service-defined payload argument.
|
---|
| 56 | * @param arg2 Service-defined payload argument.
|
---|
| 57 | * @param arg3 Service-defined payload argument.
|
---|
| 58 | * @param arg4 Service-defined payload argument.
|
---|
| 59 | * @param dataptr If non-NULL, storage where the reply data will be
|
---|
| 60 | * stored.
|
---|
| 61 | *
|
---|
| 62 | * @return Hash of the sent message or 0 on error.
|
---|
| 63 | *
|
---|
| 64 | */
|
---|
| 65 | aid_t async_obsolete_send_fast(int phoneid, sysarg_t method, sysarg_t arg1,
|
---|
| 66 | sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
|
---|
| 67 | {
|
---|
| 68 | amsg_t *msg = malloc(sizeof(amsg_t));
|
---|
| 69 |
|
---|
| 70 | if (!msg)
|
---|
| 71 | return 0;
|
---|
| 72 |
|
---|
| 73 | msg->done = false;
|
---|
| 74 | msg->dataptr = dataptr;
|
---|
| 75 |
|
---|
| 76 | msg->wdata.to_event.inlist = false;
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | * We may sleep in the next method,
|
---|
| 80 | * but it will use its own means
|
---|
| 81 | */
|
---|
| 82 | msg->wdata.active = true;
|
---|
| 83 |
|
---|
| 84 | ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, msg,
|
---|
| 85 | reply_received, true);
|
---|
| 86 |
|
---|
| 87 | return (aid_t) msg;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | /** Pseudo-synchronous message sending - fast version.
|
---|
| 91 | *
|
---|
| 92 | * Send message asynchronously and return only after the reply arrives.
|
---|
| 93 | *
|
---|
| 94 | * This function can only transfer 4 register payload arguments. For
|
---|
| 95 | * transferring more arguments, see the slower async_req_slow().
|
---|
| 96 | *
|
---|
| 97 | * @param phoneid Hash of the phone through which to make the call.
|
---|
| 98 | * @param method Method of the call.
|
---|
| 99 | * @param arg1 Service-defined payload argument.
|
---|
| 100 | * @param arg2 Service-defined payload argument.
|
---|
| 101 | * @param arg3 Service-defined payload argument.
|
---|
| 102 | * @param arg4 Service-defined payload argument.
|
---|
| 103 | * @param r1 If non-NULL, storage for the 1st reply argument.
|
---|
| 104 | * @param r2 If non-NULL, storage for the 2nd reply argument.
|
---|
| 105 | * @param r3 If non-NULL, storage for the 3rd reply argument.
|
---|
| 106 | * @param r4 If non-NULL, storage for the 4th reply argument.
|
---|
| 107 | * @param r5 If non-NULL, storage for the 5th reply argument.
|
---|
| 108 | *
|
---|
| 109 | * @return Return code of the reply or a negative error code.
|
---|
| 110 | *
|
---|
| 111 | */
|
---|
| 112 | sysarg_t async_obsolete_req_fast(int phoneid, sysarg_t method, sysarg_t arg1,
|
---|
| 113 | sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
|
---|
| 114 | sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
|
---|
| 115 | {
|
---|
| 116 | ipc_call_t result;
|
---|
| 117 | aid_t eid = async_obsolete_send_4(phoneid, method, arg1, arg2, arg3, arg4,
|
---|
| 118 | &result);
|
---|
| 119 |
|
---|
| 120 | sysarg_t rc;
|
---|
| 121 | async_wait_for(eid, &rc);
|
---|
| 122 |
|
---|
| 123 | if (r1)
|
---|
| 124 | *r1 = IPC_GET_ARG1(result);
|
---|
| 125 |
|
---|
| 126 | if (r2)
|
---|
| 127 | *r2 = IPC_GET_ARG2(result);
|
---|
| 128 |
|
---|
| 129 | if (r3)
|
---|
| 130 | *r3 = IPC_GET_ARG3(result);
|
---|
| 131 |
|
---|
| 132 | if (r4)
|
---|
| 133 | *r4 = IPC_GET_ARG4(result);
|
---|
| 134 |
|
---|
| 135 | if (r5)
|
---|
| 136 | *r5 = IPC_GET_ARG5(result);
|
---|
| 137 |
|
---|
| 138 | return rc;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | /** Wrapper for IPC_M_SHARE_OUT calls using the async framework.
|
---|
| 142 | *
|
---|
| 143 | * @param phoneid Phone that will be used to contact the receiving side.
|
---|
| 144 | * @param src Source address space area base address.
|
---|
| 145 | * @param flags Flags to be used for sharing. Bits can be only cleared.
|
---|
| 146 | *
|
---|
| 147 | * @return Zero on success or a negative error code from errno.h.
|
---|
| 148 | *
|
---|
| 149 | */
|
---|
| 150 | int async_obsolete_share_out_start(int phoneid, void *src, unsigned int flags)
|
---|
| 151 | {
|
---|
| 152 | return async_obsolete_req_3_0(phoneid, IPC_M_SHARE_OUT, (sysarg_t) src, 0,
|
---|
| 153 | (sysarg_t) flags);
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | /** Wrapper for ipc_hangup.
|
---|
| 157 | *
|
---|
| 158 | * @param phone Phone handle to hung up.
|
---|
| 159 | *
|
---|
| 160 | * @return Zero on success or a negative error code.
|
---|
| 161 | *
|
---|
| 162 | */
|
---|
| 163 | int async_obsolete_hangup(int phone)
|
---|
| 164 | {
|
---|
| 165 | return ipc_hangup(phone);
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | void async_obsolete_serialize_start(void)
|
---|
| 169 | {
|
---|
| 170 | fibril_inc_sercount();
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | void async_obsolete_serialize_end(void)
|
---|
| 174 | {
|
---|
| 175 | fibril_dec_sercount();
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | /** Wrapper for IPC_M_DATA_WRITE calls using the async framework.
|
---|
| 179 | *
|
---|
| 180 | * @param phoneid Phone that will be used to contact the receiving side.
|
---|
| 181 | * @param src Address of the beginning of the source buffer.
|
---|
| 182 | * @param size Size of the source buffer.
|
---|
| 183 | * @param flags Flags to control the data transfer.
|
---|
| 184 | *
|
---|
| 185 | * @return Zero on success or a negative error code from errno.h.
|
---|
| 186 | *
|
---|
| 187 | */
|
---|
| 188 | int async_obsolete_data_write_start_generic(int phoneid, const void *src, size_t size,
|
---|
| 189 | int flags)
|
---|
| 190 | {
|
---|
| 191 | return async_obsolete_req_3_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
|
---|
| 192 | (sysarg_t) size, (sysarg_t) flags);
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | /** Start IPC_M_DATA_READ using the async framework.
|
---|
| 196 | *
|
---|
| 197 | * @param phoneid Phone that will be used to contact the receiving side.
|
---|
| 198 | * @param dst Address of the beginning of the destination buffer.
|
---|
| 199 | * @param size Size of the destination buffer (in bytes).
|
---|
| 200 | * @param dataptr Storage of call data (arg 2 holds actual data size).
|
---|
| 201 | *
|
---|
| 202 | * @return Hash of the sent message or 0 on error.
|
---|
| 203 | *
|
---|
| 204 | */
|
---|
| 205 | aid_t async_obsolete_data_read(int phone, void *dst, size_t size,
|
---|
| 206 | ipc_call_t *dataptr)
|
---|
| 207 | {
|
---|
| 208 | return async_obsolete_send_2(phone, IPC_M_DATA_READ, (sysarg_t) dst,
|
---|
| 209 | (sysarg_t) size, dataptr);
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | /** Wrapper for IPC_M_DATA_READ calls using the async framework.
|
---|
| 213 | *
|
---|
| 214 | * @param phoneid Phone that will be used to contact the receiving side.
|
---|
| 215 | * @param dst Address of the beginning of the destination buffer.
|
---|
| 216 | * @param size Size of the destination buffer.
|
---|
| 217 | * @param flags Flags to control the data transfer.
|
---|
| 218 | *
|
---|
| 219 | * @return Zero on success or a negative error code from errno.h.
|
---|
| 220 | *
|
---|
| 221 | */
|
---|
| 222 | int async_obsolete_data_read_start_generic(int phoneid, void *dst, size_t size, int flags)
|
---|
| 223 | {
|
---|
| 224 | return async_obsolete_req_3_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
|
---|
| 225 | (sysarg_t) size, (sysarg_t) flags);
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | /** Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.
|
---|
| 229 | *
|
---|
| 230 | * Ask through phone for a new connection to some service.
|
---|
| 231 | *
|
---|
| 232 | * @param phone Phone handle used for contacting the other side.
|
---|
| 233 | * @param arg1 User defined argument.
|
---|
| 234 | * @param arg2 User defined argument.
|
---|
| 235 | * @param arg3 User defined argument.
|
---|
| 236 | * @param client_receiver Connection handing routine.
|
---|
| 237 | *
|
---|
| 238 | * @return New phone handle on success or a negative error code.
|
---|
| 239 | *
|
---|
| 240 | */
|
---|
| 241 | int async_obsolete_connect_to_me(int phone, sysarg_t arg1, sysarg_t arg2,
|
---|
[9934f7d] | 242 | sysarg_t arg3, async_client_conn_t client_receiver, void *carg)
|
---|
[79ae36dd] | 243 | {
|
---|
| 244 | sysarg_t task_hash;
|
---|
| 245 | sysarg_t phone_hash;
|
---|
| 246 | int rc = async_obsolete_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
|
---|
| 247 | NULL, NULL, NULL, &task_hash, &phone_hash);
|
---|
| 248 | if (rc != EOK)
|
---|
| 249 | return rc;
|
---|
| 250 |
|
---|
| 251 | if (client_receiver != NULL)
|
---|
| 252 | async_new_connection(task_hash, phone_hash, 0, NULL,
|
---|
[9934f7d] | 253 | client_receiver, carg);
|
---|
[79ae36dd] | 254 |
|
---|
| 255 | return EOK;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
|
---|
| 259 | *
|
---|
| 260 | * Ask through phone for a new connection to some service.
|
---|
| 261 | *
|
---|
| 262 | * @param phone Phone handle used for contacting the other side.
|
---|
| 263 | * @param arg1 User defined argument.
|
---|
| 264 | * @param arg2 User defined argument.
|
---|
| 265 | * @param arg3 User defined argument.
|
---|
| 266 | *
|
---|
| 267 | * @return New phone handle on success or a negative error code.
|
---|
| 268 | *
|
---|
| 269 | */
|
---|
| 270 | int async_obsolete_connect_me_to(int phone, sysarg_t arg1, sysarg_t arg2,
|
---|
| 271 | sysarg_t arg3)
|
---|
| 272 | {
|
---|
| 273 | sysarg_t newphid;
|
---|
| 274 | int rc = async_obsolete_req_3_5(phone, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
|
---|
| 275 | NULL, NULL, NULL, NULL, &newphid);
|
---|
| 276 |
|
---|
| 277 | if (rc != EOK)
|
---|
| 278 | return rc;
|
---|
| 279 |
|
---|
| 280 | return newphid;
|
---|
| 281 | }
|
---|
| 282 |
|
---|
| 283 | /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
|
---|
| 284 | *
|
---|
| 285 | * Ask through phone for a new connection to some service and block until
|
---|
| 286 | * success.
|
---|
| 287 | *
|
---|
| 288 | * @param phoneid Phone handle used for contacting the other side.
|
---|
| 289 | * @param arg1 User defined argument.
|
---|
| 290 | * @param arg2 User defined argument.
|
---|
| 291 | * @param arg3 User defined argument.
|
---|
| 292 | *
|
---|
| 293 | * @return New phone handle on success or a negative error code.
|
---|
| 294 | *
|
---|
| 295 | */
|
---|
| 296 | int async_obsolete_connect_me_to_blocking(int phoneid, sysarg_t arg1, sysarg_t arg2,
|
---|
| 297 | sysarg_t arg3)
|
---|
| 298 | {
|
---|
| 299 | sysarg_t newphid;
|
---|
| 300 | int rc = async_obsolete_req_4_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
|
---|
| 301 | IPC_FLAG_BLOCKING, NULL, NULL, NULL, NULL, &newphid);
|
---|
| 302 |
|
---|
| 303 | if (rc != EOK)
|
---|
| 304 | return rc;
|
---|
| 305 |
|
---|
| 306 | return newphid;
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | /** Send message and return id of the sent message
|
---|
| 310 | *
|
---|
| 311 | * The return value can be used as input for async_wait() to wait for
|
---|
| 312 | * completion.
|
---|
| 313 | *
|
---|
| 314 | * @param phoneid Handle of the phone that will be used for the send.
|
---|
| 315 | * @param method Service-defined method.
|
---|
| 316 | * @param arg1 Service-defined payload argument.
|
---|
| 317 | * @param arg2 Service-defined payload argument.
|
---|
| 318 | * @param arg3 Service-defined payload argument.
|
---|
| 319 | * @param arg4 Service-defined payload argument.
|
---|
| 320 | * @param arg5 Service-defined payload argument.
|
---|
| 321 | * @param dataptr If non-NULL, storage where the reply data will be
|
---|
| 322 | * stored.
|
---|
| 323 | *
|
---|
| 324 | * @return Hash of the sent message or 0 on error.
|
---|
| 325 | *
|
---|
| 326 | */
|
---|
| 327 | aid_t async_obsolete_send_slow(int phoneid, sysarg_t method, sysarg_t arg1,
|
---|
| 328 | sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
|
---|
| 329 | ipc_call_t *dataptr)
|
---|
| 330 | {
|
---|
| 331 | amsg_t *msg = malloc(sizeof(amsg_t));
|
---|
| 332 |
|
---|
| 333 | if (!msg)
|
---|
| 334 | return 0;
|
---|
| 335 |
|
---|
| 336 | msg->done = false;
|
---|
| 337 | msg->dataptr = dataptr;
|
---|
| 338 |
|
---|
| 339 | msg->wdata.to_event.inlist = false;
|
---|
| 340 |
|
---|
| 341 | /*
|
---|
| 342 | * We may sleep in the next method,
|
---|
| 343 | * but it will use its own means
|
---|
| 344 | */
|
---|
| 345 | msg->wdata.active = true;
|
---|
| 346 |
|
---|
| 347 | ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, msg,
|
---|
| 348 | reply_received, true);
|
---|
| 349 |
|
---|
| 350 | return (aid_t) msg;
|
---|
| 351 | }
|
---|
| 352 |
|
---|
| 353 | void async_obsolete_msg_0(int phone, sysarg_t imethod)
|
---|
| 354 | {
|
---|
| 355 | ipc_call_async_0(phone, imethod, NULL, NULL, true);
|
---|
| 356 | }
|
---|
| 357 |
|
---|
| 358 | void async_obsolete_msg_1(int phone, sysarg_t imethod, sysarg_t arg1)
|
---|
| 359 | {
|
---|
| 360 | ipc_call_async_1(phone, imethod, arg1, NULL, NULL, true);
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | void async_obsolete_msg_2(int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2)
|
---|
| 364 | {
|
---|
| 365 | ipc_call_async_2(phone, imethod, arg1, arg2, NULL, NULL, true);
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | void async_obsolete_msg_3(int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
|
---|
| 369 | sysarg_t arg3)
|
---|
| 370 | {
|
---|
| 371 | ipc_call_async_3(phone, imethod, arg1, arg2, arg3, NULL, NULL, true);
|
---|
| 372 | }
|
---|
| 373 |
|
---|
| 374 | void async_obsolete_msg_4(int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
|
---|
| 375 | sysarg_t arg3, sysarg_t arg4)
|
---|
| 376 | {
|
---|
| 377 | ipc_call_async_4(phone, imethod, arg1, arg2, arg3, arg4, NULL, NULL,
|
---|
| 378 | true);
|
---|
| 379 | }
|
---|
| 380 |
|
---|
| 381 | void async_obsolete_msg_5(int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
|
---|
| 382 | sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
|
---|
| 383 | {
|
---|
| 384 | ipc_call_async_5(phone, imethod, arg1, arg2, arg3, arg4, arg5, NULL,
|
---|
| 385 | NULL, true);
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /** Wrapper for IPC_M_SHARE_IN calls using the async framework.
|
---|
| 389 | *
|
---|
| 390 | * @param phoneid Phone that will be used to contact the receiving side.
|
---|
| 391 | * @param dst Destination address space area base.
|
---|
| 392 | * @param size Size of the destination address space area.
|
---|
| 393 | * @param arg User defined argument.
|
---|
| 394 | * @param flags Storage for the received flags. Can be NULL.
|
---|
| 395 | *
|
---|
| 396 | * @return Zero on success or a negative error code from errno.h.
|
---|
| 397 | *
|
---|
| 398 | */
|
---|
| 399 | int async_obsolete_share_in_start(int phoneid, void *dst, size_t size, sysarg_t arg,
|
---|
| 400 | unsigned int *flags)
|
---|
| 401 | {
|
---|
| 402 | sysarg_t tmp_flags;
|
---|
| 403 | int res = async_obsolete_req_3_2(phoneid, IPC_M_SHARE_IN, (sysarg_t) dst,
|
---|
| 404 | (sysarg_t) size, arg, NULL, &tmp_flags);
|
---|
| 405 |
|
---|
| 406 | if (flags)
|
---|
| 407 | *flags = (unsigned int) tmp_flags;
|
---|
| 408 |
|
---|
| 409 | return res;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | int async_obsolete_forward_fast(ipc_callid_t callid, int phoneid, sysarg_t imethod,
|
---|
| 413 | sysarg_t arg1, sysarg_t arg2, unsigned int mode)
|
---|
| 414 | {
|
---|
| 415 | return ipc_forward_fast(callid, phoneid, imethod, arg1, arg2, mode);
|
---|
| 416 | }
|
---|
| 417 |
|
---|
| 418 | int async_obsolete_forward_slow(ipc_callid_t callid, int phoneid, sysarg_t imethod,
|
---|
| 419 | sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
|
---|
| 420 | unsigned int mode)
|
---|
| 421 | {
|
---|
| 422 | return ipc_forward_slow(callid, phoneid, imethod, arg1, arg2, arg3, arg4,
|
---|
| 423 | arg5, mode);
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | /** Wrapper for forwarding any data that is about to be received
|
---|
| 427 | *
|
---|
| 428 | */
|
---|
| 429 | int async_obsolete_data_write_forward_fast(int phoneid, sysarg_t method, sysarg_t arg1,
|
---|
| 430 | sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
|
---|
| 431 | {
|
---|
| 432 | ipc_callid_t callid;
|
---|
| 433 | if (!async_data_write_receive(&callid, NULL)) {
|
---|
| 434 | ipc_answer_0(callid, EINVAL);
|
---|
| 435 | return EINVAL;
|
---|
| 436 | }
|
---|
| 437 |
|
---|
| 438 | aid_t msg = async_obsolete_send_fast(phoneid, method, arg1, arg2, arg3, arg4,
|
---|
| 439 | dataptr);
|
---|
| 440 | if (msg == 0) {
|
---|
| 441 | ipc_answer_0(callid, EINVAL);
|
---|
| 442 | return EINVAL;
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | int retval = ipc_forward_fast(callid, phoneid, 0, 0, 0,
|
---|
| 446 | IPC_FF_ROUTE_FROM_ME);
|
---|
| 447 | if (retval != EOK) {
|
---|
| 448 | async_wait_for(msg, NULL);
|
---|
| 449 | ipc_answer_0(callid, retval);
|
---|
| 450 | return retval;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | sysarg_t rc;
|
---|
| 454 | async_wait_for(msg, &rc);
|
---|
| 455 |
|
---|
| 456 | return (int) rc;
|
---|
| 457 | }
|
---|
| 458 |
|
---|
| 459 | /** @}
|
---|
| 460 | */
|
---|