Changeset 241f1985 in mainline for uspace/lib/c/generic/task_event.c
- Timestamp:
- 2019-08-31T10:45:17Z (5 years ago)
- Children:
- 102f641
- Parents:
- f92b315
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-23 22:04:34)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-31 10:45:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/task_event.c
rf92b315 r241f1985 37 37 #include <macros.h> 38 38 #include <task.h> 39 #include <assert.h> 39 40 40 41 #include "private/taskman.h" … … 42 43 static task_event_handler_t task_event_handler = NULL; 43 44 44 static void taskman_task_event(ipc_call id_t iid, ipc_call_t *icall)45 static void taskman_task_event(ipc_call_t *icall) 45 46 { 46 47 task_id_t tid = (task_id_t) 47 MERGE_LOUP32( IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall));48 int flags = IPC_GET_ARG3(*icall);49 task_exit_t texit = IPC_GET_ARG4(*icall);50 int retval = IPC_GET_ARG5(*icall);48 MERGE_LOUP32(ipc_get_arg1(icall), ipc_get_arg2(icall)); 49 int flags = ipc_get_arg3(icall); 50 task_exit_t texit = ipc_get_arg4(icall); 51 int retval = ipc_get_arg5(icall); 51 52 52 53 task_event_handler(tid, flags, texit, retval); 53 54 54 async_answer_0(i id, EOK);55 async_answer_0(icall, EOK); 55 56 } 56 57 57 static void taskman_event_conn(ipc_call id_t iid, ipc_call_t *icall, void *arg)58 static void taskman_event_conn(ipc_call_t *icall, void *arg) 58 59 { 59 60 /* Accept connection */ 60 async_answer_0(i id, EOK);61 async_answer_0(icall, EOK); 61 62 62 63 while (true) { 63 64 ipc_call_t call; 64 ipc_callid_t callid = async_get_call(&call); 65 66 if (!IPC_GET_IMETHOD(call)) { 65 66 if (!async_get_call(&call) || !ipc_get_imethod(&call)) { 67 67 /* Hangup, end of game */ 68 68 break; 69 69 } 70 70 71 switch ( IPC_GET_IMETHOD(call)) {71 switch (ipc_get_imethod(&call)) { 72 72 case TASKMAN_EV_TASK: 73 taskman_task_event( callid,&call);73 taskman_task_event(&call); 74 74 break; 75 75 default: 76 async_answer_0( callid, ENOTSUP);76 async_answer_0(&call, ENOTSUP); 77 77 break; 78 78 } … … 83 83 * Blocks, calls handler in another fibril 84 84 */ 85 int task_register_event_handler(task_event_handler_t handler, bool past_events)85 errno_t task_register_event_handler(task_event_handler_t handler, bool past_events) 86 86 { 87 87 /* … … 97 97 aid_t req = async_send_1(exch, TASKMAN_EVENT_CALLBACK, past_events, NULL); 98 98 99 int rc = async_connect_to_me(exch, 0, 0, 0, taskman_event_conn, NULL); 99 port_id_t port; 100 errno_t rc = async_create_callback_port(exch, INTERFACE_TASKMAN_CB, 0, 0, 101 taskman_event_conn, NULL, &port); 100 102 taskman_exchange_end(exch); 101 103 … … 104 106 } 105 107 106 sysarg_t retval;108 errno_t retval; 107 109 async_wait_for(req, &retval); 108 110 return retval;
Note:
See TracChangeset
for help on using the changeset viewer.