Changeset 0dd16778 in mainline for uspace/lib/c/generic/async.c


Ignore:
Timestamp:
2015-08-22T14:32:11Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f9b2cb4c
Parents:
78bb04b
Message:

start migrating devman to interfaces

File:
1 edited

Legend:

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

    r78bb04b r0dd16778  
    22722272        sess->phone = phone;
    22732273        sess->arg1 = arg1;
     2274        sess->arg2 = arg2;
     2275        sess->arg3 = arg3;
     2276       
     2277        fibril_mutex_initialize(&sess->remote_state_mtx);
     2278        sess->remote_state_data = NULL;
     2279       
     2280        list_initialize(&sess->exch_list);
     2281        fibril_mutex_initialize(&sess->mutex);
     2282        atomic_set(&sess->refcnt, 0);
     2283       
     2284        return sess;
     2285}
     2286
     2287/** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
     2288 *
     2289 * Ask through phone for a new connection to some service and block until
     2290 * success.
     2291 *
     2292 * @param exch  Exchange for sending the message.
     2293 * @param iface Connection interface.
     2294 * @param arg2  User defined argument.
     2295 * @param arg3  User defined argument.
     2296 *
     2297 * @return New session on success or NULL on error.
     2298 *
     2299 */
     2300async_sess_t *async_connect_me_to_iface(async_exch_t *exch, iface_t iface,
     2301    sysarg_t arg2, sysarg_t arg3)
     2302{
     2303        if (exch == NULL) {
     2304                errno = ENOENT;
     2305                return NULL;
     2306        }
     2307       
     2308        async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
     2309        if (sess == NULL) {
     2310                errno = ENOMEM;
     2311                return NULL;
     2312        }
     2313       
     2314        int phone = async_connect_me_to_internal(exch->phone, iface, arg2,
     2315            arg3, 0);
     2316        if (phone < 0) {
     2317                errno = phone;
     2318                free(sess);
     2319                return NULL;
     2320        }
     2321       
     2322        sess->iface = iface;
     2323        sess->phone = phone;
     2324        sess->arg1 = iface;
    22742325        sess->arg2 = arg2;
    22752326        sess->arg3 = arg3;
Note: See TracChangeset for help on using the changeset viewer.