Changes in uspace/lib/c/generic/ns.c [01900b6:09ab0a9a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ns.c
r01900b6 r09ab0a9a 49 49 async_port_handler_t handler, void *data) 50 50 { 51 errno_t rc; 52 async_sess_t *sess = ns_session_get(&rc); 53 if (sess == NULL) 54 return rc; 51 async_sess_t *sess = ns_session_get(); 52 if (sess == NULL) 53 return EIO; 55 54 56 55 port_id_t port; 57 rc = async_create_port(iface, handler, data, &port);56 errno_t rc = async_create_port(iface, handler, data, &port); 58 57 if (rc != EOK) 59 58 return rc; … … 82 81 async_set_fallback_port_handler(handler, data); 83 82 84 errno_t rc; 85 async_sess_t *sess = ns_session_get(&rc); 86 if (sess == NULL) 87 return rc; 83 async_sess_t *sess = ns_session_get(); 84 if (sess == NULL) 85 return EIO; 88 86 89 87 async_exch_t *exch = async_exchange_begin(sess); … … 91 89 ipc_call_t answer; 92 90 aid_t req = async_send_1(exch, NS_REGISTER_BROKER, service, &answer); 93 rc = async_connect_to_me(exch, INTERFACE_ANY, service, 0);91 errno_t rc = async_connect_to_me(exch, INTERFACE_ANY, service, 0); 94 92 95 93 async_exchange_end(exch); … … 105 103 } 106 104 107 /** Connect to a singleton service. 108 * 109 * @param service Singleton service ID. 110 * @param iface Interface to connect to. 111 * @param arg3 Custom connection argument. 112 * @param rc Placeholder for return code. Unused if NULL. 113 * 114 * @return New session on success or NULL on error. 115 * 116 */ 117 async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3, 118 errno_t *rc) 119 { 120 async_sess_t *sess = ns_session_get(rc); 105 async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3) 106 { 107 async_sess_t *sess = ns_session_get(); 121 108 if (sess == NULL) 122 109 return NULL; … … 127 114 128 115 async_sess_t *csess = 129 async_connect_me_to(exch, iface, service, arg3 , rc);116 async_connect_me_to(exch, iface, service, arg3); 130 117 async_exchange_end(exch); 131 118 … … 143 130 } 144 131 145 /** Wait and connect to a singleton service.146 *147 * @param service Singleton service ID.148 * @param iface Interface to connect to.149 * @param arg3 Custom connection argument.150 * @param rc Placeholder for return code. Unused if NULL.151 *152 * @return New session on success or NULL on error.153 *154 */155 132 async_sess_t *service_connect_blocking(service_t service, iface_t iface, 156 sysarg_t arg3 , errno_t *rc)157 { 158 async_sess_t *sess = ns_session_get( rc);133 sysarg_t arg3) 134 { 135 async_sess_t *sess = ns_session_get(); 159 136 if (sess == NULL) 160 137 return NULL; … … 162 139 async_exch_t *exch = async_exchange_begin(sess); 163 140 async_sess_t *csess = 164 async_connect_me_to_blocking(exch, iface, service, arg3 , rc);141 async_connect_me_to_blocking(exch, iface, service, arg3); 165 142 async_exchange_end(exch); 166 143 … … 180 157 errno_t ns_ping(void) 181 158 { 182 errno_t rc; 183 async_sess_t *sess = ns_session_get(&rc); 184 if (sess == NULL) 185 return rc; 186 187 async_exch_t *exch = async_exchange_begin(sess); 188 rc = async_req_0_0(exch, NS_PING); 159 async_sess_t *sess = ns_session_get(); 160 if (sess == NULL) 161 return EIO; 162 163 async_exch_t *exch = async_exchange_begin(sess); 164 errno_t rc = async_req_0_0(exch, NS_PING); 189 165 async_exchange_end(exch); 190 166 … … 194 170 errno_t ns_intro(task_id_t id) 195 171 { 196 errno_t rc;197 async_sess_t *sess = ns_session_get( &rc);198 if (sess == NULL) 199 return EIO; 200 201 async_exch_t *exch = async_exchange_begin(sess);202 rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));203 async_exchange_end(exch); 204 205 return rc; 206 } 207 208 async_sess_t *ns_session_get( errno_t *rc)172 async_exch_t *exch; 173 async_sess_t *sess = ns_session_get(); 174 if (sess == NULL) 175 return EIO; 176 177 exch = async_exchange_begin(sess); 178 errno_t rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id)); 179 async_exchange_end(exch); 180 181 return rc; 182 } 183 184 async_sess_t *ns_session_get(void) 209 185 { 210 186 async_exch_t *exch; … … 212 188 if (sess_ns == NULL) { 213 189 exch = async_exchange_begin(&session_ns); 214 sess_ns = async_connect_me_to(exch, 0, 0, 0 , rc);190 sess_ns = async_connect_me_to(exch, 0, 0, 0); 215 191 async_exchange_end(exch); 216 192 if (sess_ns == NULL)
Note:
See TracChangeset
for help on using the changeset viewer.