Changes in uspace/lib/c/generic/inet/tcp.c [b7fd2a0:f9b2cb4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet/tcp.c
rb7fd2a0 rf9b2cb4c 42 42 43 43 static void tcp_cb_conn(ipc_callid_t, ipc_call_t *, void *); 44 static errno_t tcp_conn_fibril(void *);44 static int tcp_conn_fibril(void *); 45 45 46 46 /** Incoming TCP connection info … … 59 59 * 60 60 * @param tcp TCP service 61 * @return EOK on success or anerror code62 */ 63 static errno_t tcp_callback_create(tcp_t *tcp)61 * @return EOK on success or negative error code 62 */ 63 static int tcp_callback_create(tcp_t *tcp) 64 64 { 65 65 async_exch_t *exch = async_exchange_begin(tcp->sess); … … 68 68 69 69 port_id_t port; 70 errno_t rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0,70 int rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0, 71 71 tcp_cb_conn, tcp, &port); 72 72 … … 76 76 return rc; 77 77 78 errno_t retval;78 sysarg_t retval; 79 79 async_wait_for(req, &retval); 80 80 … … 88 88 * cannot be contacted 89 89 */ 90 errno_t tcp_create(tcp_t **rtcp)90 int tcp_create(tcp_t **rtcp) 91 91 { 92 92 tcp_t *tcp; 93 93 service_id_t tcp_svcid; 94 errno_t rc;94 int rc; 95 95 96 96 tcp = calloc(1, sizeof(tcp_t)); … … 161 161 * @return EOK on success, ENOMEM if out of memory 162 162 */ 163 static errno_t tcp_conn_new(tcp_t *tcp, sysarg_t id, tcp_cb_t *cb, void *arg,163 static int tcp_conn_new(tcp_t *tcp, sysarg_t id, tcp_cb_t *cb, void *arg, 164 164 tcp_conn_t **rconn) 165 165 { … … 205 205 * @param rconn Place to store pointer to new connection 206 206 * 207 * @return EOK on success or anerror code.208 */ 209 errno_t tcp_conn_create(tcp_t *tcp, inet_ep2_t *epp, tcp_cb_t *cb, void *arg,207 * @return EOK on success or negative error code. 208 */ 209 int tcp_conn_create(tcp_t *tcp, inet_ep2_t *epp, tcp_cb_t *cb, void *arg, 210 210 tcp_conn_t **rconn) 211 211 { … … 216 216 exch = async_exchange_begin(tcp->sess); 217 217 aid_t req = async_send_0(exch, TCP_CONN_CREATE, &answer); 218 errno_t rc = async_data_write_start(exch, (void *)epp,218 sysarg_t rc = async_data_write_start(exch, (void *)epp, 219 219 sizeof(inet_ep2_t)); 220 220 async_exchange_end(exch); 221 221 222 222 if (rc != EOK) { 223 errno_t rc_orig;223 sysarg_t rc_orig; 224 224 async_wait_for(req, &rc_orig); 225 225 if (rc_orig != EOK) … … 240 240 return EOK; 241 241 error: 242 return ( errno_t) rc;242 return (int) rc; 243 243 } 244 244 … … 260 260 261 261 exch = async_exchange_begin(conn->tcp->sess); 262 errno_t rc = async_req_1_0(exch, TCP_CONN_DESTROY, conn->id);262 sysarg_t rc = async_req_1_0(exch, TCP_CONN_DESTROY, conn->id); 263 263 async_exchange_end(exch); 264 264 … … 275 275 * @return EOK on success, EINVAL if no connection with the given ID exists 276 276 */ 277 static errno_t tcp_conn_get(tcp_t *tcp, sysarg_t id, tcp_conn_t **rconn)277 static int tcp_conn_get(tcp_t *tcp, sysarg_t id, tcp_conn_t **rconn) 278 278 { 279 279 list_foreach(tcp->conn, ltcp, tcp_conn_t, conn) { … … 316 316 * @param rlst Place to store pointer to new listener 317 317 * 318 * @return EOK on success or anerror code319 */ 320 errno_t tcp_listener_create(tcp_t *tcp, inet_ep_t *ep, tcp_listen_cb_t *lcb,318 * @return EOK on success or negative error code 319 */ 320 int tcp_listener_create(tcp_t *tcp, inet_ep_t *ep, tcp_listen_cb_t *lcb, 321 321 void *larg, tcp_cb_t *cb, void *arg, tcp_listener_t **rlst) 322 322 { … … 331 331 exch = async_exchange_begin(tcp->sess); 332 332 aid_t req = async_send_0(exch, TCP_LISTENER_CREATE, &answer); 333 errno_t rc = async_data_write_start(exch, (void *)ep,333 sysarg_t rc = async_data_write_start(exch, (void *)ep, 334 334 sizeof(inet_ep_t)); 335 335 async_exchange_end(exch); 336 336 337 337 if (rc != EOK) { 338 errno_t rc_orig;338 sysarg_t rc_orig; 339 339 async_wait_for(req, &rc_orig); 340 340 if (rc_orig != EOK) … … 360 360 error: 361 361 free(lst); 362 return ( errno_t) rc;362 return (int) rc; 363 363 } 364 364 … … 377 377 378 378 exch = async_exchange_begin(lst->tcp->sess); 379 errno_t rc = async_req_1_0(exch, TCP_LISTENER_DESTROY, lst->id);379 sysarg_t rc = async_req_1_0(exch, TCP_LISTENER_DESTROY, lst->id); 380 380 async_exchange_end(exch); 381 381 … … 392 392 * @return EOK on success, EINVAL if no listener with the given ID is found 393 393 */ 394 static errno_t tcp_listener_get(tcp_t *tcp, sysarg_t id, tcp_listener_t **rlst)394 static int tcp_listener_get(tcp_t *tcp, sysarg_t id, tcp_listener_t **rlst) 395 395 { 396 396 list_foreach(tcp->listener, ltcp, tcp_listener_t, lst) { … … 424 424 * @return EOK if connection is established, EIO otherwise 425 425 */ 426 errno_t tcp_conn_wait_connected(tcp_conn_t *conn)426 int tcp_conn_wait_connected(tcp_conn_t *conn) 427 427 { 428 428 fibril_mutex_lock(&conn->lock); … … 446 446 * @param bytes Data size in bytes 447 447 * 448 * @return EOK on success or anerror code449 */ 450 errno_t tcp_conn_send(tcp_conn_t *conn, const void *data, size_t bytes)451 { 452 async_exch_t *exch; 453 errno_t rc;448 * @return EOK on success or negative error code 449 */ 450 int tcp_conn_send(tcp_conn_t *conn, const void *data, size_t bytes) 451 { 452 async_exch_t *exch; 453 sysarg_t rc; 454 454 455 455 exch = async_exchange_begin(conn->tcp->sess); … … 478 478 * 479 479 * @param conn Connection 480 * @return EOK on success or anerror code481 */ 482 errno_t tcp_conn_send_fin(tcp_conn_t *conn)480 * @return EOK on success or negative error code 481 */ 482 int tcp_conn_send_fin(tcp_conn_t *conn) 483 483 { 484 484 async_exch_t *exch; 485 485 486 486 exch = async_exchange_begin(conn->tcp->sess); 487 errno_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id);487 sysarg_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id); 488 488 async_exchange_end(exch); 489 489 … … 494 494 * 495 495 * @param conn Connection 496 * @return EOK on success or anerror code497 */ 498 errno_t tcp_conn_push(tcp_conn_t *conn)496 * @return EOK on success or negative error code 497 */ 498 int tcp_conn_push(tcp_conn_t *conn) 499 499 { 500 500 async_exch_t *exch; 501 501 502 502 exch = async_exchange_begin(conn->tcp->sess); 503 errno_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id);503 sysarg_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id); 504 504 async_exchange_end(exch); 505 505 … … 510 510 * 511 511 * @param conn Connection 512 * @return EOK on success or anerror code513 */ 514 errno_t tcp_conn_reset(tcp_conn_t *conn)512 * @return EOK on success or negative error code 513 */ 514 int tcp_conn_reset(tcp_conn_t *conn) 515 515 { 516 516 async_exch_t *exch; 517 517 518 518 exch = async_exchange_begin(conn->tcp->sess); 519 errno_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id);519 sysarg_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id); 520 520 async_exchange_end(exch); 521 521 … … 538 538 * 539 539 * @return EOK on success, EAGAIN if no received data is pending, or other 540 * error code in case of other error541 */ 542 errno_t tcp_conn_recv(tcp_conn_t *conn, void *buf, size_t bsize, size_t *nrecv)540 * negative error code in case of other error 541 */ 542 int tcp_conn_recv(tcp_conn_t *conn, void *buf, size_t bsize, size_t *nrecv) 543 543 { 544 544 async_exch_t *exch; … … 553 553 exch = async_exchange_begin(conn->tcp->sess); 554 554 aid_t req = async_send_1(exch, TCP_CONN_RECV, conn->id, &answer); 555 errno_t rc = async_data_read_start(exch, buf, bsize);555 int rc = async_data_read_start(exch, buf, bsize); 556 556 async_exchange_end(exch); 557 557 … … 562 562 } 563 563 564 errno_t retval;564 sysarg_t retval; 565 565 async_wait_for(req, &retval); 566 566 if (retval != EOK) { … … 586 586 * @param nrecv Place to store actual number of received bytes 587 587 * 588 * @return EOK on success or anerror code589 */ 590 errno_t tcp_conn_recv_wait(tcp_conn_t *conn, void *buf, size_t bsize,588 * @return EOK on success or negative error code 589 */ 590 int tcp_conn_recv_wait(tcp_conn_t *conn, void *buf, size_t bsize, 591 591 size_t *nrecv) 592 592 { … … 602 602 exch = async_exchange_begin(conn->tcp->sess); 603 603 aid_t req = async_send_1(exch, TCP_CONN_RECV_WAIT, conn->id, &answer); 604 errno_t rc = async_data_read_start(exch, buf, bsize);604 int rc = async_data_read_start(exch, buf, bsize); 605 605 async_exchange_end(exch); 606 606 … … 616 616 } 617 617 618 errno_t retval;618 sysarg_t retval; 619 619 async_wait_for(req, &retval); 620 620 if (retval != EOK) { … … 641 641 tcp_conn_t *conn; 642 642 sysarg_t conn_id; 643 errno_t rc;643 int rc; 644 644 645 645 conn_id = IPC_GET_ARG1(*icall); … … 669 669 tcp_conn_t *conn; 670 670 sysarg_t conn_id; 671 errno_t rc;671 int rc; 672 672 673 673 conn_id = IPC_GET_ARG1(*icall); … … 697 697 tcp_conn_t *conn; 698 698 sysarg_t conn_id; 699 errno_t rc;699 int rc; 700 700 701 701 conn_id = IPC_GET_ARG1(*icall); … … 725 725 tcp_conn_t *conn; 726 726 sysarg_t conn_id; 727 errno_t rc;727 int rc; 728 728 729 729 conn_id = IPC_GET_ARG1(*icall); … … 769 769 fid_t fid; 770 770 tcp_in_conn_t *cinfo; 771 errno_t rc;771 int rc; 772 772 773 773 lst_id = IPC_GET_ARG1(*icall); … … 863 863 * @param arg Argument, incoming connection information (@c tcp_in_conn_t) 864 864 */ 865 static errno_t tcp_conn_fibril(void *arg)865 static int tcp_conn_fibril(void *arg) 866 866 { 867 867 tcp_in_conn_t *cinfo = (tcp_in_conn_t *)arg;
Note:
See TracChangeset
for help on using the changeset viewer.