MCPcopy Create free account
hub / github.com/HelenOS/helenos / task_kill_self

Function task_kill_self

kernel/generic/src/proc/task.c:592–616  ·  view source on GitHub ↗

Kill the currently running task. * * @param notify Send out fault notifications. * * @return Zero on success or an error code from errno.h. * */

Source from the content-addressed store, hash-verified

590 *
591 */
592void 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 *

Callers 4

sys_task_exitFunction · 0.85
syscall_handlerFunction · 0.85
fault_from_uspace_coreFunction · 0.85
as_page_faultFunction · 0.85

Calls 5

udebug_thread_faultFunction · 0.85
irq_spinlock_lockFunction · 0.85
task_kill_internalFunction · 0.85
irq_spinlock_unlockFunction · 0.85
thread_exitFunction · 0.70

Tested by

no test coverage detected