/*! @brief Main timer server message loop. Simply loops through recieving and dispatching messages repeatedly. */ static void timer_server_mainloop(void) { struct timeserv_state *s = &timeServ; srv_msg_t msg; while (1) { msg.message = seL4_Recv(s->commonState.anonEP, &msg.badge); timer_server_handle_message(s, &msg); client_table_postaction(&s->commonState.clientTable); } }
/*! @brief Main console server message loop. Simply loops through recieving and dispatching messages repeatedly. */ static void console_server_mainloop(void) { struct conserv_state *s = &conServ; srv_msg_t msg; while (1) { msg.message = seL4_Recv(conServCommon->anonEP, &msg.badge); console_server_handle_message(s, &msg); client_table_postaction(&conServCommon->clientTable); } }
/*! @brief Main CPIO file server message loop. Simply loops through recieving and dispatching messages repeatedly. */ static void fileserv_mainloop(void) { struct fs_state *s = &fileServ; srv_msg_t msg; while (1) { dvprintf("Fileserver blocking for message...\n"); msg.message = seL4_Wait(fileServCommon->anonEP, &msg.badge); fileserv_handle_message(s, &msg); client_table_postaction(&fileServCommon->clientTable); } }
struct srv_client* srv_ctable_connect_direct_handler(srv_common_t *srv, srv_msg_t *m, seL4_CPtr liveness, int* _errno) { assert(srv && srv->magic == SRV_MAGIC && m); /* Check that the liveness cap passed in correctly. */ if(!srv_check_dispatch_caps(m, 0x00000000, 1)) { SET_ERRNO_PTR(_errno, EINVALIDPARAM); return NULL; } int error = ENOMEM; /* Copyout the liveness cap, create session cap cslot. Do not printf before the copyout. */ seL4_CPtr livenessCP = rpc_copyout_cptr(liveness); if (!liveness || !livenessCP) { goto error0; } /* Allocate the client structure. */ struct srv_client *c = client_alloc(&srv->clientTable, livenessCP); if (!c) { goto error1; } dprintf("Adding new %s client cID = %d. Hi! (:D)\n", srv->config.serverName, c->cID); assert(c->session); /* Authenticate the client to the process server, using its liveness cap. */ error = proc_watch_client(c->liveness, srv->notifyClientFaultDeathAsyncEP, &c->deathID); if (error != ESUCCESS) { goto error2; } SET_ERRNO_PTR(_errno, ESUCCESS); return c; /* Exit stack. */ error2: client_queue_delete(&srv->clientTable, c->cID); client_table_postaction(&srv->clientTable); error1: seL4_CNode_Delete(REFOS_CSPACE, livenessCP, REFOS_CDEPTH); csfree(livenessCP); error0: SET_ERRNO_PTR(_errno, error); return NULL; }
/*! @brief Main timer server message loop. Simply loops through recieving and dispatching messages repeatedly. */ static void timer_server_mainloop(void) { struct timeserv_state *s = &timeServ; srv_msg_t msg; seL4_DebugPrintf("timer1 will go EP\n"); while (1) { seL4_DebugPrintf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<start to receive on EP<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); msg.message = seL4_Wait(s->commonState.anonEP, &msg.badge); seL4_DebugPrintf("<<<<<<<<<<<<<<<<<<<<<<<<<<<timeserver resume on EP>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); timer_server_handle_message(s, &msg); client_table_postaction(&s->commonState.clientTable); } }
static int test_thread(void * arg) { struct timeserv_state *s = &timeServ; srv_msg_t msg; seL4_DebugPrintf("timer2 will go AEP\n"); while(1) { seL4_DebugPrintf("\n################# Blocked on AEP #################\n"); msg.message = seL4_Wait(s->commonState.notifyAsyncEP, &msg.badge); seL4_DebugPrintf("\n@@@@@@@@@@@@@@@@@ Resumed on AEP @@@@@@@@@@@@@@@@@\n"); timer_server_handle_message(s, &msg); client_table_postaction(&s->commonState.clientTable); } return 0; }