Kill the currently running task. * * @param notify Send out fault notifications. * * @return Zero on success or an error code from errno.h. * */
| 590 | * |
| 591 | */ |
| 592 | void task_kill_self(bool notify) |
| 593 | { |
| 594 | /* |
| 595 | * User space can subscribe for FAULT events to take action |
| 596 | * whenever a task faults (to take a dump, run a debugger, etc.). |
| 597 | * The notification is always available, but unless udebug is enabled, |
| 598 | * that's all you get. |
| 599 | */ |
| 600 | if (notify) { |
| 601 | /* Notify the subscriber that a fault occurred. */ |
| 602 | if (event_notify_3(EVENT_FAULT, false, LOWER32(TASK->taskid), |
| 603 | UPPER32(TASK->taskid), (sysarg_t) THREAD) == EOK) { |
| 604 | #ifdef CONFIG_UDEBUG |
| 605 | /* Wait for a debugging session. */ |
| 606 | udebug_thread_fault(); |
| 607 | #endif |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | irq_spinlock_lock(&tasks_lock, true); |
| 612 | task_kill_internal(TASK); |
| 613 | irq_spinlock_unlock(&tasks_lock, true); |
| 614 | |
| 615 | thread_exit(); |
| 616 | } |
| 617 | |
| 618 | /** Process syscall to terminate the current task. |
| 619 | * |
no test coverage detected