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