Changes in uspace/srv/loader/main.c [ffa2c8ef:228e490] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
rffa2c8ef r228e490 50 50 #include <fcntl.h> 51 51 #include <sys/types.h> 52 #include <ipc/ipc.h> 52 53 #include <ipc/services.h> 53 54 #include <ipc/loader.h> … … 94 95 95 96 /** Used to limit number of connections to one. */ 96 static bool connected = false;97 static bool connected; 97 98 98 99 static void ldr_get_taskid(ipc_callid_t rid, ipc_call_t *request) … … 105 106 106 107 if (!async_data_read_receive(&callid, &len)) { 107 async_answer_0(callid, EINVAL);108 async_answer_0(rid, EINVAL);108 ipc_answer_0(callid, EINVAL); 109 ipc_answer_0(rid, EINVAL); 109 110 return; 110 111 } … … 114 115 115 116 async_data_read_finalize(callid, &task_id, len); 116 async_answer_0(rid, EOK);117 ipc_answer_0(rid, EOK); 117 118 } 118 119 … … 134 135 } 135 136 136 async_answer_0(rid, rc);137 ipc_answer_0(rid, rc); 137 138 } 138 139 … … 154 155 } 155 156 156 async_answer_0(rid, rc);157 ipc_answer_0(rid, rc); 157 158 } 158 159 … … 187 188 if (_argv == NULL) { 188 189 free(buf); 189 async_answer_0(rid, ENOMEM);190 ipc_answer_0(rid, ENOMEM); 190 191 return; 191 192 } … … 219 220 } 220 221 221 async_answer_0(rid, rc);222 ipc_answer_0(rid, rc); 222 223 } 223 224 … … 243 244 if (_filv == NULL) { 244 245 free(buf); 245 async_answer_0(rid, ENOMEM);246 ipc_answer_0(rid, ENOMEM); 246 247 return; 247 248 } … … 270 271 } 271 272 272 async_answer_0(rid, EOK);273 ipc_answer_0(rid, EOK); 273 274 } 274 275 … … 286 287 if (rc != EE_OK) { 287 288 DPRINTF("Failed to load executable '%s'.\n", pathname); 288 async_answer_0(rid, EINVAL);289 ipc_answer_0(rid, EINVAL); 289 290 return 1; 290 291 } … … 303 304 /* Statically linked program */ 304 305 is_dyn_linked = false; 305 async_answer_0(rid, EOK);306 ipc_answer_0(rid, EOK); 306 307 return 0; 307 308 } … … 311 312 DPRINTF("Failed to load interpreter '%s.'\n", 312 313 prog_info.interp); 313 async_answer_0(rid, EINVAL);314 ipc_answer_0(rid, EINVAL); 314 315 return 1; 315 316 } 316 317 317 318 is_dyn_linked = true; 318 async_answer_0(rid, EOK);319 ipc_answer_0(rid, EOK); 319 320 320 321 return 0; … … 342 343 DPRINTF("Entry point: %p\n", interp_info.entry); 343 344 344 async_answer_0(rid, EOK);345 ipc_answer_0(rid, EOK); 345 346 elf_run(&interp_info, &pcb); 346 347 } else { 347 348 /* Statically linked program */ 348 async_answer_0(rid, EOK);349 ipc_answer_0(rid, EOK); 349 350 elf_run(&prog_info, &pcb); 350 351 } … … 366 367 /* Already have a connection? */ 367 368 if (connected) { 368 async_answer_0(iid, ELIMIT);369 ipc_answer_0(iid, ELIMIT); 369 370 return; 370 371 } … … 373 374 374 375 /* Accept the connection */ 375 async_answer_0(iid, EOK);376 ipc_answer_0(iid, EOK); 376 377 377 378 /* Ignore parameters, the connection is already open */ … … 413 414 DPRINTF("Responding EINVAL to method %d.\n", 414 415 IPC_GET_IMETHOD(call)); 415 async_answer_0(callid, EINVAL);416 ipc_answer_0(callid, EINVAL); 416 417 } 417 418 } … … 422 423 int main(int argc, char *argv[]) 423 424 { 425 sysarg_t phonead; 426 task_id_t id; 427 int rc; 428 429 connected = false; 430 431 /* Introduce this task to the NS (give it our task ID). */ 432 id = task_get_id(); 433 rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id)); 434 if (rc != EOK) 435 return -1; 436 424 437 /* Set a handler of incomming connections. */ 425 438 async_set_client_connection(ldr_connection); 426 439 427 /* Introduce this task to the NS (give it our task ID). */428 task_id_t id = task_get_id();429 int rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id));430 if (rc != EOK)431 return -1;432 433 440 /* Register at naming service. */ 434 if ( service_register(SERVICE_LOAD) != EOK)441 if (ipc_connect_to_me(PHONE_NS, SERVICE_LOAD, 0, 0, &phonead) != 0) 435 442 return -2; 436 443 437 444 async_manager(); 438 445
Note:
See TracChangeset
for help on using the changeset viewer.