Changes in uspace/srv/loader/main.c [27b76ca:8a1fb09] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
r27b76ca r8a1fb09 52 52 #include <ipc/services.h> 53 53 #include <ipc/loader.h> 54 #include <ns.h> 54 #include <ipc/ns.h> 55 #include <macros.h> 55 56 #include <loader/pcb.h> 56 57 #include <entry_point.h> … … 59 60 #include <str.h> 60 61 #include <as.h> 61 #include <elf/elf.h> 62 #include <elf /elf_load.h>63 #include < vfs/vfs.h>62 63 #include <elf.h> 64 #include <elf_load.h> 64 65 65 66 #ifdef CONFIG_RTLD … … 90 91 91 92 /** Number of preset files */ 92 static unsigned int filc = 0; 93 static int filc = 0; 94 /** Preset files vector */ 95 static fdi_node_t **filv = NULL; 96 /** Buffer holding all preset files */ 97 static fdi_node_t *fil_buf = NULL; 93 98 94 99 static elf_info_t prog_info; … … 236 241 static void ldr_set_files(ipc_callid_t rid, ipc_call_t *request) 237 242 { 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; 243 fdi_node_t *buf; 244 size_t buf_size; 245 int rc = async_data_write_accept((void **) &buf, false, 0, 0, 246 sizeof(fdi_node_t), &buf_size); 247 248 if (rc == EOK) { 249 int count = buf_size / sizeof(fdi_node_t); 250 251 /* 252 * Allocate new filv 253 */ 254 fdi_node_t **_filv = (fdi_node_t **) calloc(count + 1, sizeof(fdi_node_t *)); 255 if (_filv == NULL) { 256 free(buf); 257 async_answer_0(rid, ENOMEM); 258 return; 249 259 } 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 260 261 /* 262 * Fill the new filv with argument pointers 263 */ 264 int i; 265 for (i = 0; i < count; i++) 266 _filv[i] = &buf[i]; 267 268 _filv[count] = NULL; 269 270 /* 271 * Copy temporary data to global variables 272 */ 273 if (fil_buf != NULL) 274 free(fil_buf); 275 276 if (filv != NULL) 277 free(filv); 278 279 filc = count; 280 fil_buf = buf; 281 filv = _filv; 282 } 283 257 284 async_answer_0(rid, EOK); 258 285 } … … 283 310 284 311 pcb.filc = filc; 312 pcb.filv = filv; 285 313 286 314 if (prog_info.interp == NULL) { … … 322 350 323 351 /* Initialize list of loaded modules */ 324 list_initialize(&runtime_env->modules );325 list_append(&prog_mod.modules_link, &runtime_env->modules );352 list_initialize(&runtime_env->modules_head); 353 list_append(&prog_mod.modules_link, &runtime_env->modules_head); 326 354 327 355 /* Pointer to program module. Used as root of the module graph. */ … … 384 412 * to execute the loaded program). 385 413 */ 386 static void ldr_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 387 { 414 static void ldr_connection(ipc_callid_t iid, ipc_call_t *icall) 415 { 416 ipc_callid_t callid; 417 ipc_call_t call; 418 int retval; 419 388 420 /* Already have a connection? */ 389 421 if (connected) { … … 398 430 399 431 /* Ignore parameters, the connection is already open */ 432 (void) iid; 400 433 (void) icall; 401 434 402 while (true) { 403 int retval; 404 ipc_call_t call; 405 ipc_callid_t callid = async_get_call(&call); 406 407 if (!IPC_GET_IMETHOD(call)) 435 while (1) { 436 callid = async_get_call(&call); 437 438 switch (IPC_GET_IMETHOD(call)) { 439 case IPC_M_PHONE_HUNGUP: 408 440 exit(0); 409 410 switch (IPC_GET_IMETHOD(call)) {411 441 case LOADER_GET_TASKID: 412 442 ldr_get_taskid(callid, &call); … … 435 465 } 436 466 437 async_answer_0(callid, retval); 467 if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) 468 async_answer_0(callid, retval); 438 469 } 439 470 } … … 448 479 /* Introduce this task to the NS (give it our task ID). */ 449 480 task_id_t id = task_get_id(); 450 int rc = ns_intro(id);481 int rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id)); 451 482 if (rc != EOK) 452 483 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.