Changeset b5cf742a in mainline for uspace/lib/c
- Timestamp:
- 2013-06-28T16:22:42Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- edf0d27
- Parents:
- e52b4b5
- Location:
- uspace/lib/c/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
re52b4b5 rb5cf742a 169 169 inet_addr_unpack(IPC_GET_ARG2(*call), &dgram.dest); 170 170 dgram.tos = IPC_GET_ARG3(*call); 171 171 172 172 rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size); 173 173 if (rc != EOK) { … … 175 175 return; 176 176 } 177 177 178 178 rc = inet_ev_ops->recv(&dgram); 179 179 async_answer_0(callid, rc); … … 185 185 ipc_call_t call; 186 186 ipc_callid_t callid = async_get_call(&call); 187 187 188 188 if (!IPC_GET_IMETHOD(call)) { 189 189 /* TODO: Handle hangup */ 190 190 return; 191 191 } 192 192 193 193 switch (IPC_GET_IMETHOD(call)) { 194 194 case INET_EV_RECV: -
uspace/lib/c/generic/inetcfg.c
re52b4b5 rb5cf742a 159 159 *addr_id = IPC_GET_ARG1(answer); 160 160 161 return retval;161 return (int) retval; 162 162 } 163 163 … … 178 178 size_t act_size; 179 179 char name_buf[LOC_NAME_MAXLEN + 1]; 180 181 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 182 180 181 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 182 183 183 ipc_call_t answer; 184 184 aid_t req = async_send_1(exch, INETCFG_ADDR_GET, addr_id, &answer); 185 185 aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply); 186 186 async_wait_for(dreq, &dretval); 187 188 async_exchange_end(exch); 189 187 188 async_exchange_end(exch); 189 190 190 if (dretval != EOK) { 191 191 async_forget(req); 192 192 return dretval; 193 193 } 194 194 195 195 sysarg_t retval; 196 196 async_wait_for(req, &retval); 197 197 198 198 if (retval != EOK) 199 return retval;200 199 return (int) retval; 200 201 201 act_size = IPC_GET_ARG2(dreply); 202 202 assert(act_size <= LOC_NAME_MAXLEN); 203 203 204 name_buf[act_size] = '\0'; 204 205 … … 207 208 ainfo->ilink = IPC_GET_ARG3(answer); 208 209 ainfo->name = str_dup(name_buf); 209 210 210 211 return EOK; 211 212 } … … 340 341 341 342 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 342 343 343 344 ipc_call_t answer; 344 345 aid_t req = async_send_1(exch, INETCFG_SROUTE_GET, sroute_id, &answer); 345 346 aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply); 346 347 async_wait_for(dreq, &dretval); 347 348 async_exchange_end(exch); 349 348 349 async_exchange_end(exch); 350 350 351 if (dretval != EOK) { 351 352 async_forget(req); 352 353 return dretval; 353 354 } 354 355 355 356 sysarg_t retval; 356 357 async_wait_for(req, &retval); 357 358 358 359 if (retval != EOK) 359 return retval;360 360 return (int) retval; 361 361 362 act_size = IPC_GET_ARG2(dreply); 362 363 assert(act_size <= LOC_NAME_MAXLEN); … … 367 368 inet_addr_unpack(IPC_GET_ARG3(answer), &srinfo->router); 368 369 srinfo->name = str_dup(name_buf); 369 370 370 371 return EOK; 371 372 } -
uspace/lib/c/generic/iplink.c
re52b4b5 rb5cf742a 99 99 sysarg_t retval; 100 100 async_wait_for(req, &retval); 101 if (retval != EOK)102 return retval;103 101 104 return EOK;102 return (int) retval; 105 103 } 106 104 … … 169 167 static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 170 168 { 171 iplink_t *iplink = (iplink_t *) arg;172 169 iplink_t *iplink = (iplink_t *) arg; 170 173 171 while (true) { 174 172 ipc_call_t call; 175 173 ipc_callid_t callid = async_get_call(&call); 176 174 177 175 if (!IPC_GET_IMETHOD(call)) { 178 176 /* TODO: Handle hangup */ 179 177 return; 180 178 } 181 179 182 180 switch (IPC_GET_IMETHOD(call)) { 183 181 case IPLINK_EV_RECV: -
uspace/lib/c/generic/iplink_srv.c
re52b4b5 rb5cf742a 44 44 ipc_call_t *call) 45 45 { 46 int rc;47 46 size_t mtu; 48 49 rc = srv->ops->get_mtu(srv, &mtu); 47 int rc = srv->ops->get_mtu(srv, &mtu); 50 48 async_answer_1(callid, rc, mtu); 51 49 } … … 70 68 iplink_srv_sdu_t sdu; 71 69 int rc; 72 70 73 71 sdu.lsrc = IPC_GET_ARG1(*call); 74 72 sdu.ldest = IPC_GET_ARG2(*call); 75 73 76 74 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 77 75 if (rc != EOK) { … … 79 77 return; 80 78 } 81 79 82 80 rc = srv->ops->send(srv, &sdu); 83 81 free(sdu.data); … … 98 96 iplink_srv_t *srv = (iplink_srv_t *)arg; 99 97 int rc; 100 98 101 99 fibril_mutex_lock(&srv->lock); 102 100 if (srv->connected) { … … 105 103 return EBUSY; 106 104 } 107 105 108 106 srv->connected = true; 109 107 fibril_mutex_unlock(&srv->lock); 110 108 111 109 /* Accept the connection */ 112 110 async_answer_0(iid, EOK); 113 111 114 112 async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE); 115 113 if (sess == NULL) 116 114 return ENOMEM; 117 115 118 116 srv->client_sess = sess; 119 117 120 118 rc = srv->ops->open(srv); 121 119 if (rc != EOK) 122 120 return rc; 123 121 124 122 while (true) { 125 123 ipc_call_t call; 126 124 ipc_callid_t callid = async_get_call(&call); 127 125 sysarg_t method = IPC_GET_IMETHOD(call); 128 126 129 127 if (!method) { 130 128 /* The other side has hung up */ … … 135 133 break; 136 134 } 137 135 138 136 switch (method) { 139 137 case IPLINK_GET_MTU: … … 153 151 } 154 152 } 155 153 156 154 return srv->ops->close(srv); 157 155 } … … 161 159 if (srv->client_sess == NULL) 162 160 return EIO; 163 161 164 162 async_exch_t *exch = async_exchange_begin(srv->client_sess); 165 163 166 164 ipc_call_t answer; 167 165 aid_t req = async_send_2(exch, IPLINK_EV_RECV, (sysarg_t) sdu->lsrc, … … 169 167 int rc = async_data_write_start(exch, sdu->data, sdu->size); 170 168 async_exchange_end(exch); 171 169 172 170 if (rc != EOK) { 173 171 async_forget(req); 174 172 return rc; 175 173 } 176 174 177 175 sysarg_t retval; 178 176 async_wait_for(req, &retval); 179 177 if (retval != EOK) 180 178 return retval; 181 179 182 180 return EOK; 183 181 }
Note:
See TracChangeset
for help on using the changeset viewer.