Changeset 4ff66ae in mainline
- Timestamp:
- 2019-08-07T11:18:35Z (5 years ago)
- Children:
- 87a31ef2
- Parents:
- bb57a00
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-11-13 03:13:03)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-07 11:18:35)
- Location:
- uspace
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/proc/task_anywait.c
rbb57a00 r4ff66ae 111 111 int rc; 112 112 113 rc = task_register_event_handler(task_event_handler );113 rc = task_register_event_handler(task_event_handler, false); 114 114 TASSERT(rc == EOK); 115 115 -
uspace/lib/c/generic/task_event.c
rbb57a00 r4ff66ae 83 83 * Blocks, calls handler in another fibril 84 84 */ 85 int task_register_event_handler(task_event_handler_t handler )85 int task_register_event_handler(task_event_handler_t handler, bool past_events) 86 86 { 87 87 /* … … 95 95 96 96 async_exch_t *exch = taskman_exchange_begin(); 97 aid_t req = async_send_ 0(exch, TASKMAN_EVENT_CALLBACK, NULL);97 aid_t req = async_send_1(exch, TASKMAN_EVENT_CALLBACK, past_events, NULL); 98 98 99 99 int rc = async_connect_to_me(exch, 0, 0, 0, taskman_event_conn, NULL); -
uspace/lib/c/generic/taskman.c
rbb57a00 r4ff66ae 127 127 */ 128 128 129 int taskman_dump_events(void)130 {131 assert(session_taskman);132 133 async_exch_t *exch = async_exchange_begin(session_taskman);134 int rc = async_req_0_0(exch, TASKMAN_DUMP_EVENTS);135 taskman_exchange_end(exch);136 137 return rc;138 }139 140 129 async_sess_t *taskman_get_session(void) 141 130 { -
uspace/lib/c/include/ipc/taskman.h
rbb57a00 r4ff66ae 44 44 TASKMAN_EVENT_CALLBACK, 45 45 TASKMAN_NEW_TASK, 46 TASKMAN_I_AM_NS, 47 TASKMAN_DUMP_EVENTS 46 TASKMAN_I_AM_NS 48 47 } taskman_request_t; 49 48 -
uspace/lib/c/include/taskman.h
rbb57a00 r4ff66ae 40 40 #endif 41 41 42 extern int taskman_dump_events(void);43 44 42 /* Internal functions to be used by loader only */ 45 43 #ifndef TASKMAN_DISABLE_ASYNC -
uspace/srv/sysman/main.c
rbb57a00 r4ff66ae 215 215 sysman_events_init(); 216 216 job_queue_init(); 217 sm_task_init();218 217 219 218 /* … … 246 245 } 247 246 248 /* We're almost ready, scan forboot time tasks */249 rc = taskman_dump_events();247 /* Start listening task events and scan boot time tasks */ 248 rc = sm_task_start(); 250 249 if (rc != EOK) { 251 250 sysman_log(LVL_FATAL, -
uspace/srv/sysman/sm_task.c
rbb57a00 r4ff66ae 206 206 } 207 207 208 int sm_task_init(void) 209 { 210 int rc = task_register_event_handler(&sm_task_event_handler); 211 212 //TODO dump taskman info for boot time tasks 208 int sm_task_start(void) 209 { 210 int rc = task_register_event_handler(&sm_task_event_handler, true); 213 211 return rc; 214 212 } -
uspace/srv/sysman/sm_task.h
rbb57a00 r4ff66ae 33 33 typedef struct sm_task_event sm_task_event_t; 34 34 35 extern int sm_task_ init(void);35 extern int sm_task_start(void); 36 36 37 37 #endif -
uspace/srv/taskman/event.c
rbb57a00 r4ff66ae 188 188 } 189 189 190 int event_register_listener(task_id_t id, async_sess_t *sess) 190 static bool dump_walker(task_t *t, void *arg) 191 { 192 event_notify(t, arg); 193 return true; 194 } 195 196 void event_register_listener(task_id_t id, bool past_events, async_sess_t *sess, 197 ipc_callid_t iid) 191 198 { 192 199 int rc = EOK; 200 /* 201 * We have lock of tasks structures so that we can guarantee 202 * that dump receiver will receive tasks correctly ordered (retval, 203 * exit updates are serialized via exclusive lock). 204 */ 193 205 fibril_rwlock_write_lock(&task_hash_table_lock); 194 206 fibril_rwlock_write_lock(&listeners_lock); … … 203 215 t->sess = sess; 204 216 217 /* 218 * Answer caller first, so that they are not unnecessarily waiting 219 * while we dump events. 220 */ 221 async_answer_0(iid, rc); 222 if (past_events) { 223 task_foreach(&dump_walker, t->sess); 224 } 225 205 226 finish: 206 227 fibril_rwlock_write_unlock(&listeners_lock); 207 228 fibril_rwlock_write_unlock(&task_hash_table_lock); 208 return rc;209 }210 211 static bool dump_walker(task_t *t, void *arg)212 {213 event_notify(t, arg);214 return true;215 }216 217 void dump_events(task_id_t receiver_id, ipc_callid_t iid)218 {219 int rc = EOK;220 /*221 * We have shared lock of tasks structures so that we can guarantee222 * that dump receiver will receive tasks correctly ordered (retval,223 * exit updates are serialized via exclusive lock).224 */225 fibril_rwlock_read_lock(&task_hash_table_lock);226 227 task_t *receiver = task_get_by_id(receiver_id);228 if (receiver == NULL) {229 rc = ENOENT;230 goto finish;231 }232 if (receiver->sess == NULL) {233 rc = ENOENT;234 goto finish;235 }236 237 /*238 * Answer caller first, so that they are not unnecessarily waiting239 * while we dump events.240 */241 async_answer_0(iid, rc);242 task_foreach(&dump_walker, receiver->sess);243 244 finish:245 fibril_rwlock_read_unlock(&task_hash_table_lock);246 229 if (rc != EOK) { 247 230 async_answer_0(iid, rc); -
uspace/srv/taskman/event.h
rbb57a00 r4ff66ae 41 41 extern int event_init(void); 42 42 43 extern int event_register_listener(task_id_t, async_sess_t *); 43 extern void event_register_listener(task_id_t, bool, async_sess_t *, 44 ipc_callid_t); 44 45 extern void dump_events(task_id_t, ipc_callid_t); 45 46 extern void wait_for_task(task_id_t, int, ipc_callid_t, task_id_t); -
uspace/srv/taskman/main.c
rbb57a00 r4ff66ae 186 186 DPRINTF("%s:%i from %llu\n", __func__, __LINE__, icall->in_task_id); 187 187 188 bool past_events = IPC_GET_ARG1(*icall); 189 188 190 /* Atomic -- will be used for notifications only */ 189 191 async_sess_t *sess = async_callback_receive(EXCHANGE_ATOMIC); … … 193 195 } 194 196 195 int rc = event_register_listener(icall->in_task_id, sess); 196 async_answer_0(iid, rc); 197 } 198 199 static void taskman_ctl_dump_events(ipc_callid_t iid, ipc_call_t *icall) 200 { 201 DPRINTF("%s:%i from %llu\n", __func__, __LINE__, icall->in_task_id); 202 203 dump_events(icall->in_task_id, iid); 197 event_register_listener(icall->in_task_id, past_events, sess, iid); 204 198 } 205 199 … … 263 257 taskman_ctl_ev_callback(iid, icall); 264 258 break; 265 case TASKMAN_DUMP_EVENTS:266 taskman_ctl_dump_events(iid, icall);267 break;268 259 default: 269 260 return false; … … 274 265 static bool handle_implicit_call(ipc_callid_t iid, ipc_call_t *icall) 275 266 { 276 DPRINTF("%s:%i %i(%i) from %llu\n", __func__, __LINE__,267 /*DPRINTF("%s:%i %i(%i) from %llu\n", __func__, __LINE__, 277 268 IPC_GET_IMETHOD(*icall), 278 269 IPC_GET_ARG1(*icall), 279 icall->in_task_id); 270 icall->in_task_id);*/ 280 271 281 272 if (IPC_GET_IMETHOD(*icall) < IPC_FIRST_USER_METHOD) {
Note:
See TracChangeset
for help on using the changeset viewer.