Changeset 5cd2290 in mainline
- Timestamp:
- 2019-08-07T05:35:46Z (5 years ago)
- Children:
- b22b0a94
- Parents:
- 1fb4a49
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-10-18 10:53:14)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-07 05:35:46)
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/proc/task_wait.c
r1fb4a49 r5cd2290 262 262 TASSERT(rc == EOK); 263 263 TASSERT(task_wait_get(&wait) == 0); 264 //TASSERT(texit == TASK_EXIT_UNEXPECTED); // TODO resolve this in taskman/kernel264 TASSERT(texit == TASK_EXIT_UNEXPECTED); 265 265 TPRINTF("OK\n"); 266 266 /* ---- */ -
uspace/srv/taskman/main.c
r1fb4a49 r5cd2290 122 122 static void task_exit_event(ipc_callid_t iid, ipc_call_t *icall, void *arg) 123 123 { 124 // TODO design substitution for taskmon (monitoring)125 124 task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall)); 126 printf("%s:%i from %llu/%i\n", __func__, __LINE__, id, (task_exit_t)arg); 127 task_terminated(id, (task_exit_t)arg); 125 exit_reason_t exit_reason = IPC_GET_ARG3(*icall); 126 printf("%s:%i from %llu/%i\n", __func__, __LINE__, id, exit_reason); 127 task_terminated(id, exit_reason); 128 } 129 130 static void task_fault_event(ipc_callid_t iid, ipc_call_t *icall, void *arg) 131 { 132 task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall)); 133 printf("%s:%i from %llu\n", __func__, __LINE__, id); 134 task_failed(id); 128 135 } 129 136 … … 254 261 } 255 262 256 rc = async_event_subscribe(EVENT_EXIT, task_exit_event, (void *)TASK_EXIT_NORMAL);263 rc = async_event_subscribe(EVENT_EXIT, task_exit_event, NULL); 257 264 if (rc != EOK) { 258 265 printf("Cannot register for exit events (%i).\n", rc); … … 260 267 } 261 268 262 rc = async_event_subscribe(EVENT_FAULT, task_ exit_event, (void *)TASK_EXIT_UNEXPECTED);269 rc = async_event_subscribe(EVENT_FAULT, task_fault_event, NULL); 263 270 if (rc != EOK) { 264 271 printf("Cannot register for fault events (%i).\n", rc); -
uspace/srv/taskman/task.c
r1fb4a49 r5cd2290 64 64 ht_link_t link; 65 65 66 task_id_t id; /**< task id. */ 67 task_exit_t exit; /**< task is done. */ 66 task_id_t id; /**< task id. */ 67 task_exit_t exit; /**< task's uspace exit status. */ 68 bool failed; /**< task failed. */ 68 69 retval_t retval_type; /**< task returned a value. */ 69 int retval; /**< the return value. */70 int retval; /**< the return value. */ 70 71 } hashed_task_t; 71 72 … … 302 303 ht->id = call->in_task_id; 303 304 ht->exit = TASK_EXIT_RUNNING; 305 ht->failed = false; 304 306 ht->retval_type = RVAL_UNSET; 305 307 ht->retval = -1; … … 339 341 } 340 342 341 void task_terminated(task_id_t id, task_exit_t texit)343 void task_terminated(task_id_t id, exit_reason_t exit_reason) 342 344 { 343 345 /* Mark task as finished. */ … … 351 353 352 354 /* 353 * If daemon returns a value and then fails/is killed, it's unexpected354 * termination.355 * If daemon returns a value and then fails/is killed, it's an 356 * unexpected termination. 355 357 */ 356 if (ht->retval_type == RVAL_UNSET || texit == TASK_EXIT_UNEXPECTED) {358 if (ht->retval_type == RVAL_UNSET || exit_reason == EXIT_REASON_KILLED) { 357 359 ht->exit = TASK_EXIT_UNEXPECTED; 358 } else { 359 ht->exit = texit; 360 } else if (ht->failed) { 361 ht->exit = TASK_EXIT_UNEXPECTED; 362 } else { 363 ht->exit = TASK_EXIT_NORMAL; 360 364 } 361 365 process_pending_wait(); 362 366 363 367 hash_table_remove_item(&task_hash_table, &ht->link); 368 finish: 369 fibril_rwlock_write_unlock(&task_hash_table_lock); 370 } 371 372 void task_failed(task_id_t id) 373 { 374 /* Mark task as failed. */ 375 fibril_rwlock_write_lock(&task_hash_table_lock); 376 ht_link_t *link = hash_table_find(&task_hash_table, &id); 377 if (link == NULL) { 378 goto finish; 379 } 380 381 hashed_task_t *ht = hash_table_get_inst(link, hashed_task_t, link); 382 383 ht->failed = true; 384 // TODO design substitution for taskmon (monitoring) = invoke dump utility 385 364 386 finish: 365 387 fibril_rwlock_write_unlock(&task_hash_table_lock); -
uspace/srv/taskman/task.h
r1fb4a49 r5cd2290 45 45 46 46 extern int task_intro(ipc_call_t *, bool); 47 extern void task_terminated(task_id_t, task_exit_t); 47 extern void task_terminated(task_id_t, exit_reason_t); 48 extern void task_failed(task_id_t); 48 49 49 50 #endif
Note:
See TracChangeset
for help on using the changeset viewer.