Changes in uspace/srv/loader/main.c [27b76ca:79ae36dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
r27b76ca r79ae36dd 59 59 #include <str.h> 60 60 #include <as.h> 61 #include <elf/elf.h> 62 #include <elf/elf_load.h> 63 #include <vfs/vfs.h> 61 #include <elf.h> 62 #include <elf_load.h> 64 63 65 64 #ifdef CONFIG_RTLD … … 90 89 91 90 /** Number of preset files */ 92 static unsigned int filc = 0; 91 static int filc = 0; 92 /** Preset files vector */ 93 static fdi_node_t **filv = NULL; 94 /** Buffer holding all preset files */ 95 static fdi_node_t *fil_buf = NULL; 93 96 94 97 static elf_info_t prog_info; … … 236 239 static void ldr_set_files(ipc_callid_t rid, ipc_call_t *request) 237 240 { 238 size_t count = IPC_GET_ARG1(*request); 239 240 async_exch_t *vfs_exch = vfs_exchange_begin(); 241 242 for (filc = 0; filc < count; filc++) { 243 ipc_callid_t callid; 244 int fd; 245 246 if (!async_state_change_receive(&callid, NULL, NULL, NULL)) { 247 async_answer_0(callid, EINVAL); 248 break; 241 fdi_node_t *buf; 242 size_t buf_size; 243 int rc = async_data_write_accept((void **) &buf, false, 0, 0, 244 sizeof(fdi_node_t), &buf_size); 245 246 if (rc == EOK) { 247 int count = buf_size / sizeof(fdi_node_t); 248 249 /* 250 * Allocate new filv 251 */ 252 fdi_node_t **_filv = (fdi_node_t **) calloc(count + 1, sizeof(fdi_node_t *)); 253 if (_filv == NULL) { 254 free(buf); 255 async_answer_0(rid, ENOMEM); 256 return; 249 257 } 250 async_state_change_finalize(callid, vfs_exch); 251 fd = fd_wait(); 252 assert(fd == (int) filc); 253 } 254 255 vfs_exchange_end(vfs_exch); 256 258 259 /* 260 * Fill the new filv with argument pointers 261 */ 262 int i; 263 for (i = 0; i < count; i++) 264 _filv[i] = &buf[i]; 265 266 _filv[count] = NULL; 267 268 /* 269 * Copy temporary data to global variables 270 */ 271 if (fil_buf != NULL) 272 free(fil_buf); 273 274 if (filv != NULL) 275 free(filv); 276 277 filc = count; 278 fil_buf = buf; 279 filv = _filv; 280 } 281 257 282 async_answer_0(rid, EOK); 258 283 } … … 283 308 284 309 pcb.filc = filc; 310 pcb.filv = filv; 285 311 286 312 if (prog_info.interp == NULL) { … … 322 348 323 349 /* Initialize list of loaded modules */ 324 list_initialize(&runtime_env->modules );325 list_append(&prog_mod.modules_link, &runtime_env->modules );350 list_initialize(&runtime_env->modules_head); 351 list_append(&prog_mod.modules_link, &runtime_env->modules_head); 326 352 327 353 /* Pointer to program module. Used as root of the module graph. */ … … 384 410 * to execute the loaded program). 385 411 */ 386 static void ldr_connection(ipc_callid_t iid, ipc_call_t *icall , void *arg)412 static void ldr_connection(ipc_callid_t iid, ipc_call_t *icall) 387 413 { 388 414 /* Already have a connection? */
Note:
See TracChangeset
for help on using the changeset viewer.