Changeset eb083ad in mainline for uspace/lib/c/generic/ns.c


Ignore:
Timestamp:
2012-05-17T21:09:06Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8fde078
Parents:
a8b8086 (diff), 3e67ab1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 edited

Legend:

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

    ra8b8086 reb083ad  
    3737#include <async.h>
    3838#include <macros.h>
     39#include <errno.h>
    3940#include "private/ns.h"
    4041
     
    4849}
    4950
    50 async_sess_t *service_connect(exch_mgmt_t mgmt, sysarg_t service, sysarg_t arg2,
     51async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2,
    5152    sysarg_t arg3)
    5253{
     
    7273}
    7374
    74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, sysarg_t service,
     75async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service,
    7576    sysarg_t arg2, sysarg_t arg3)
    7677{
     
    8182            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
    8283        async_exchange_end(exch);
    83 
     84       
    8485        if (!sess)
    8586                return NULL;
     
    9192         */
    9293        async_sess_args_set(sess, arg2, arg3, 0);
     94       
     95        return sess;
     96}
     97
     98/** Create bidirectional connection with a service
     99 *
     100 * @param[in] service         Service.
     101 * @param[in] arg1            First parameter.
     102 * @param[in] arg2            Second parameter.
     103 * @param[in] arg3            Third parameter.
     104 * @param[in] client_receiver Message receiver.
     105 *
     106 * @return Session to the service.
     107 * @return Other error codes as defined by async_connect_to_me().
     108 *
     109 */
     110async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2,
     111    sysarg_t arg3, async_client_conn_t client_receiver)
     112{
     113        /* Connect to the needed service */
     114        async_sess_t *sess =
     115            service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);
     116        if (sess != NULL) {
     117                /* Request callback connection */
     118                async_exch_t *exch = async_exchange_begin(sess);
     119                int rc = async_connect_to_me(exch, arg1, arg2, arg3,
     120                    client_receiver, NULL);
     121                async_exchange_end(exch);
     122               
     123                if (rc != EOK) {
     124                        async_hangup(sess);
     125                        errno = rc;
     126                        return NULL;
     127                }
     128        }
    93129       
    94130        return sess;
Note: See TracChangeset for help on using the changeset viewer.