Changeset 8869f7b in mainline for uspace/lib/c/generic/async.c


Ignore:
Timestamp:
2011-06-08T19:44:33Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4a4c8bcf
Parents:
0eff68e
Message:

async framework: add support for in-band IPC_M_CONNECT_TO_ME processing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    r0eff68e r8869f7b  
    23392339 * @param mgmt Exchange management style.
    23402340 *
    2341  * @return New async session or NULL on failure.
     2341 * @return New async session.
     2342 * @return NULL on failure.
    23422343 *
    23432344 */
     
    23772378}
    23782379
     2380/** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
     2381 *
     2382 * If the call is IPC_M_CONNECT_TO_ME then a new
     2383 * async session is created. However, the phone is
     2384 * not accepted automatically.
     2385 *
     2386 * @param mgmt   Exchange management style.
     2387 * @param call   Call data.
     2388 *
     2389 * @return New async session.
     2390 * @return NULL on failure.
     2391 * @return NULL if the call is not IPC_M_CONNECT_TO_ME.
     2392 *
     2393 */
     2394async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call)
     2395{
     2396        int phone = (int) IPC_GET_ARG5(*call);
     2397       
     2398        if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) ||
     2399            (phone < 0))
     2400                return NULL;
     2401       
     2402        async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
     2403        if (sess == NULL)
     2404                return NULL;
     2405       
     2406        sess->mgmt = mgmt;
     2407        sess->phone = phone;
     2408        sess->arg1 = 0;
     2409        sess->arg2 = 0;
     2410        sess->arg3 = 0;
     2411       
     2412        list_initialize(&sess->exch_list);
     2413        fibril_mutex_initialize(&sess->mutex);
     2414        atomic_set(&sess->refcnt, 0);
     2415       
     2416        return sess;
     2417}
     2418
    23792419/** @}
    23802420 */
Note: See TracChangeset for help on using the changeset viewer.