Changes in uspace/srv/loader/main.c [8a1fb09:27b76ca] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
r8a1fb09 r27b76ca 52 52 #include <ipc/services.h> 53 53 #include <ipc/loader.h> 54 #include <ipc/ns.h> 55 #include <macros.h> 54 #include <ns.h> 56 55 #include <loader/pcb.h> 57 56 #include <entry_point.h> … … 60 59 #include <str.h> 61 60 #include <as.h> 62 63 #include <elf .h>64 #include < elf_load.h>61 #include <elf/elf.h> 62 #include <elf/elf_load.h> 63 #include <vfs/vfs.h> 65 64 66 65 #ifdef CONFIG_RTLD … … 91 90 92 91 /** Number of preset files */ 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; 92 static unsigned int filc = 0; 98 93 99 94 static elf_info_t prog_info; … … 241 236 static void ldr_set_files(ipc_callid_t rid, ipc_call_t *request) 242 237 { 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; 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; 259 249 } 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 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 284 257 async_answer_0(rid, EOK); 285 258 } … … 310 283 311 284 pcb.filc = filc; 312 pcb.filv = filv;313 285 314 286 if (prog_info.interp == NULL) { … … 350 322 351 323 /* Initialize list of loaded modules */ 352 list_initialize(&runtime_env->modules _head);353 list_append(&prog_mod.modules_link, &runtime_env->modules _head);324 list_initialize(&runtime_env->modules); 325 list_append(&prog_mod.modules_link, &runtime_env->modules); 354 326 355 327 /* Pointer to program module. Used as root of the module graph. */ … … 412 384 * to execute the loaded program). 413 385 */ 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 386 static void ldr_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 387 { 420 388 /* Already have a connection? */ 421 389 if (connected) { … … 430 398 431 399 /* Ignore parameters, the connection is already open */ 432 (void) iid;433 400 (void) icall; 434 401 435 while (1) { 436 callid = async_get_call(&call); 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)) 408 exit(0); 437 409 438 410 switch (IPC_GET_IMETHOD(call)) { 439 case IPC_M_PHONE_HUNGUP:440 exit(0);441 411 case LOADER_GET_TASKID: 442 412 ldr_get_taskid(callid, &call); … … 465 435 } 466 436 467 if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) 468 async_answer_0(callid, retval); 437 async_answer_0(callid, retval); 469 438 } 470 439 } … … 479 448 /* Introduce this task to the NS (give it our task ID). */ 480 449 task_id_t id = task_get_id(); 481 int rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id));450 int rc = ns_intro(id); 482 451 if (rc != EOK) 483 452 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.