Changeset cce8a83 in mainline for uspace/lib/c/generic/loc.c
- Timestamp:
- 2011-08-16T17:31:34Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45058baa
- Parents:
- 6d605e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loc.c
r6d605e6 rcce8a83 291 291 } 292 292 293 /** Get service name. 294 * 295 * Provided ID of a service, return its name. 296 * 297 * @param svc_id Service ID 298 * @param name Place to store pointer to new string. Caller should 299 * free it using free(). 300 * @return EOK on success or negative error code 301 */ 302 int loc_service_get_name(service_id_t svc_id, char **name) 303 { 304 async_exch_t *exch; 305 char name_buf[LOC_NAME_MAXLEN + 1]; 306 307 *name = NULL; 308 memset(name_buf, 0, LOC_NAME_MAXLEN + 1); 309 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 310 311 ipc_call_t answer; 312 aid_t req = async_send_1(exch, LOC_SERVICE_GET_NAME, svc_id, &answer); 313 int rc = async_data_read_start(exch, name_buf, LOC_NAME_MAXLEN); 314 315 loc_exchange_end(exch); 316 317 if (rc != EOK) { 318 async_wait_for(req, NULL); 319 return rc; 320 } 321 322 sysarg_t retval; 323 async_wait_for(req, &retval); 324 325 if (retval != EOK) 326 return retval; 327 328 *name = str_dup(name_buf); 329 if (*name == NULL) 330 return ENOMEM; 331 332 return EOK; 333 } 334 335 293 336 int loc_namespace_get_id(const char *name, service_id_t *handle, 294 337 unsigned int flags)
Note:
See TracChangeset
for help on using the changeset viewer.