Changeset 7171760 in mainline for uspace/lib/c/generic/loader.c
- Timestamp:
- 2011-08-18T12:05:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b33ec43
- Parents:
- 866e627
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loader.c
r866e627 r7171760 256 256 * 257 257 */ 258 int loader_set_files(loader_t *ldr, fdi_node_t *const files[]) 259 { 260 /* 261 * Serialize the arguments into a single array. First 262 * compute size of the buffer needed. 263 */ 264 fdi_node_t *const *ap = files; 265 size_t count = 0; 266 while (*ap != NULL) { 267 count++; 268 ap++; 269 } 270 271 fdi_node_t *files_buf; 272 files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t)); 273 if (files_buf == NULL) 274 return ENOMEM; 275 276 /* Fill the buffer */ 277 size_t i; 278 for (i = 0; i < count; i++) 279 files_buf[i] = *files[i]; 280 258 int loader_set_files(loader_t *ldr, int * const files[]) 259 { 281 260 /* Send serialized files to the loader */ 282 261 async_exch_t *exch = async_exchange_begin(ldr->sess); 283 284 ipc_call_t answer; 285 aid_t req = async_send_0(exch, LOADER_SET_FILES, &answer); 286 sysarg_t rc = async_data_write_start(exch, (void *) files_buf, 287 count * sizeof(fdi_node_t)); 288 289 async_exchange_end(exch); 290 free(files_buf); 291 262 async_exch_t *vfs_exch = vfs_exchange_begin(); 263 264 int i; 265 for (i = 0; files[i]; i++) 266 ; 267 268 ipc_call_t answer; 269 aid_t req = async_send_1(exch, LOADER_SET_FILES, i, &answer); 270 271 sysarg_t rc; 272 273 for (i = 0; files[i]; i++) { 274 rc = async_state_change_start(exch, VFS_PASS_HANDLE, *files[i], 275 0, vfs_exch); 276 if (rc != EOK) 277 break; 278 } 279 280 vfs_exchange_end(vfs_exch); 281 async_exchange_end(exch); 282 292 283 if (rc != EOK) { 293 284 async_wait_for(req, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.