Changeset bfd1546 in mainline for uspace/srv/loader/main.c
- Timestamp:
- 2009-02-15T00:01:06Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08b777e
- Parents:
- 4cac212c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
r4cac212c rbfd1546 51 51 #include <sys/types.h> 52 52 #include <ipc/ipc.h> 53 #include <ipc/services.h> 53 54 #include <ipc/loader.h> 54 55 #include <loader/pcb.h> … … 80 81 static bool is_dyn_linked; 81 82 83 /** Used to limit number of connections to one. */ 84 static bool connected; 82 85 83 86 static void loader_get_taskid(ipc_callid_t rid, ipc_call_t *request) … … 297 300 ipc_call_t call; 298 301 int retval; 302 303 /* Already have a connection? */ 304 if (connected) { 305 ipc_answer_0(iid, ELIMIT); 306 return; 307 } 308 309 connected = true; 310 311 /* Accept the connection */ 312 ipc_answer_0(iid, EOK); 299 313 300 314 /* Ignore parameters, the connection is already open */ … … 339 353 int main(int argc, char *argv[]) 340 354 { 341 ipc_callid_t callid; 342 ipc_call_t call; 343 ipcarg_t phone_hash; 344 345 /* The first call only communicates the incoming phone hash */ 346 callid = ipc_wait_for_call(&call); 347 348 if (IPC_GET_METHOD(call) != LOADER_HELLO) { 349 if (IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) 350 ipc_answer_0(callid, EINVAL); 351 return 1; 352 } 353 354 ipc_answer_0(callid, EOK); 355 phone_hash = call.in_phone_hash; 356 357 /* 358 * Up until now async must not be used as it couldn't 359 * handle incoming requests. (Which means e.g. printf() 360 * cannot be used) 361 */ 362 async_new_connection(phone_hash, 0, NULL, loader_connection); 355 ipcarg_t phonead; 356 357 connected = false; 358 359 /* Set a handler of incomming connections. */ 360 async_set_client_connection(loader_connection); 361 362 /* Register at naming service. */ 363 if (ipc_connect_to_me(PHONE_NS, SERVICE_LOAD, 0, 0, &phonead) != 0) 364 return -1; 365 363 366 async_manager(); 364 367 365 /* notreached */368 /* Never reached */ 366 369 return 0; 367 370 }
Note:
See TracChangeset
for help on using the changeset viewer.