/** Register clonable service. * * @param service Service to be registered. * @param phone Phone to be used for connections to the service. * @param call Pointer to call structure. * */ void register_clonable(sysarg_t service, sysarg_t phone, ipc_call_t *call, ipc_callid_t callid) { link_t *req_link; req_link = list_first(&cs_req); if (req_link == NULL) { /* There was no pending connection request. */ printf("%s: Unexpected clonable server.\n", NAME); ipc_answer_0(callid, EBUSY); return; } cs_req_t *csr = list_get_instance(req_link, cs_req_t, link); list_remove(req_link); /* Currently we can only handle a single type of clonable service. */ assert(csr->service == SERVICE_LOAD); ipc_answer_0(callid, EOK); ipc_forward_fast(csr->callid, phone, IPC_GET_ARG2(csr->call), IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE); free(csr); ipc_hangup(phone); }
/** Process pending connection requests */ void process_pending_conn(void) { loop: list_foreach(pending_conn, link, pending_conn_t, pending) { ht_link_t *link = hash_table_find(&service_hash_table, &pending->service); if (!link) continue; hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link); (void) ipc_forward_fast(pending->callid, hashed_service->phone, pending->iface, pending->arg3, 0, IPC_FF_NONE); list_remove(&pending->link); free(pending); goto loop; }