Changeset e1e4192 in mainline for uspace/lib/c
- Timestamp:
- 2012-06-03T20:45:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 90478727
- Parents:
- f7e69f5 (diff), 3123d2a (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. - Location:
- uspace/lib/c/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
rf7e69f5 re1e4192 44 44 { 45 45 async_exch_t *exch = async_exchange_begin(inet_sess); 46 46 47 47 ipc_call_t answer; 48 48 aid_t req = async_send_0(exch, INET_CALLBACK_CREATE, &answer); 49 49 int rc = async_connect_to_me(exch, 0, 0, 0, inet_cb_conn, NULL); 50 50 async_exchange_end(exch); 51 51 52 52 if (rc != EOK) 53 53 return rc; 54 54 55 55 sysarg_t retval; 56 56 async_wait_for(req, &retval); 57 if (retval != EOK) 58 return retval; 59 60 return EOK; 57 58 return retval; 61 59 } 62 60 63 61 static int inet_set_proto(uint8_t protocol) 64 62 { 65 int rc;66 67 63 async_exch_t *exch = async_exchange_begin(inet_sess); 68 rc = async_req_1_0(exch, INET_SET_PROTO, protocol);64 int rc = async_req_1_0(exch, INET_SET_PROTO, protocol); 69 65 async_exchange_end(exch); 70 66 71 67 return rc; 72 68 } … … 80 76 assert(inet_ev_ops == NULL); 81 77 assert(inet_protocol == 0); 82 78 83 79 rc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc, 84 80 IPC_FLAG_BLOCKING); 85 81 if (rc != EOK) 86 82 return ENOENT; 87 83 88 84 inet_sess = loc_service_connect(EXCHANGE_SERIALIZE, inet_svc, 89 85 IPC_FLAG_BLOCKING); 90 86 if (inet_sess == NULL) 91 87 return ENOENT; 92 88 93 89 if (inet_set_proto(protocol) != EOK) { 94 90 async_hangup(inet_sess); … … 96 92 return EIO; 97 93 } 98 94 99 95 if (inet_callback_create() != EOK) { 100 96 async_hangup(inet_sess); … … 102 98 return EIO; 103 99 } 104 100 105 101 inet_protocol = protocol; 106 102 inet_ev_ops = ev_ops; -
uspace/lib/c/generic/inetcfg.c
rf7e69f5 re1e4192 119 119 120 120 assert(inetcfg_sess == NULL); 121 121 122 122 rc = loc_service_get_id(SERVICE_NAME_INETCFG, &inet_svc, 123 123 IPC_FLAG_BLOCKING); 124 124 if (rc != EOK) 125 125 return ENOENT; 126 126 127 127 inetcfg_sess = loc_service_connect(EXCHANGE_SERIALIZE, inet_svc, 128 128 IPC_FLAG_BLOCKING); 129 129 if (inetcfg_sess == NULL) 130 130 return ENOENT; 131 131 132 132 return EOK; 133 133 } -
uspace/lib/c/generic/inetping.c
rf7e69f5 re1e4192 49 49 50 50 assert(inetping_sess == NULL); 51 51 52 52 inetping_ev_ops = ev_ops; 53 53 54 54 rc = loc_service_get_id(SERVICE_NAME_INETPING, &inetping_svc, 55 55 IPC_FLAG_BLOCKING); 56 56 if (rc != EOK) 57 57 return ENOENT; 58 58 59 59 inetping_sess = loc_service_connect(EXCHANGE_SERIALIZE, inetping_svc, 60 60 IPC_FLAG_BLOCKING); 61 61 if (inetping_sess == NULL) 62 62 return ENOENT; 63 63 64 64 async_exch_t *exch = async_exchange_begin(inetping_sess); 65 65 66 66 rc = async_connect_to_me(exch, 0, 0, 0, inetping_cb_conn, NULL); 67 67 async_exchange_end(exch); 68 68 69 69 if (rc != EOK) { 70 70 async_hangup(inetping_sess); … … 72 72 return rc; 73 73 } 74 74 75 75 return EOK; 76 76 } -
uspace/lib/c/generic/iplink.c
rf7e69f5 re1e4192 49 49 iplink_t **riplink) 50 50 { 51 iplink_t *iplink = NULL; 52 int rc; 53 54 iplink = calloc(1, sizeof(iplink_t)); 51 iplink_t *iplink = calloc(1, sizeof(iplink_t)); 55 52 if (iplink == NULL) 56 53 return ENOMEM; 57 54 58 55 iplink->sess = sess; 59 56 iplink->ev_ops = ev_ops; 60 57 61 58 async_exch_t *exch = async_exchange_begin(sess); 62 63 rc = async_connect_to_me(exch, 0, 0, 0, iplink_cb_conn, iplink);59 60 int rc = async_connect_to_me(exch, 0, 0, 0, iplink_cb_conn, iplink); 64 61 async_exchange_end(exch); 65 62 66 63 if (rc != EOK) 67 64 goto error; 68 65 69 66 *riplink = iplink; 70 67 return EOK; 71 68 72 69 error: 73 70 if (iplink != NULL) 74 71 free(iplink); 75 72 76 73 return rc; 77 74 } -
uspace/lib/c/generic/net/socket_client.c
rf7e69f5 re1e4192 283 283 static async_sess_t *socket_get_tcp_sess(void) 284 284 { 285 if (socket_globals.tcp_sess == NULL) {285 if (socket_globals.tcp_sess == NULL) 286 286 socket_globals.tcp_sess = service_bind(SERVICE_TCP, 287 287 0, 0, SERVICE_TCP, socket_connection); 288 } 289 288 290 289 return socket_globals.tcp_sess; 291 290 } … … 300 299 static async_sess_t *socket_get_udp_sess(void) 301 300 { 302 if (socket_globals.udp_sess == NULL) {301 if (socket_globals.udp_sess == NULL) 303 302 socket_globals.udp_sess = service_bind(SERVICE_UDP, 304 303 0, 0, SERVICE_UDP, socket_connection); 305 } 306 304 307 305 return socket_globals.udp_sess; 308 306 }
Note:
See TracChangeset
for help on using the changeset viewer.