Changeset cd50486 in mainline for kernel/generic/src/proc/task.c


Ignore:
Timestamp:
2011-02-06T22:03:55Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25971d2
Parents:
1110ebd (diff), 960ff451 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/task.c

    r1110ebd rcd50486  
    384384{
    385385        task_id_t taskid;
    386         int rc;
    387 
    388         rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
     386        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
    389387        if (rc != 0)
    390388                return (sysarg_t) rc;
    391 
     389       
    392390        return (sysarg_t) task_kill(taskid);
    393391}
     
    520518}
    521519
     520/** Kill the currently running task.
     521 *
     522 * @param notify Send out fault notifications.
     523 *
     524 * @return Zero on success or an error code from errno.h.
     525 *
     526 */
     527void task_kill_self(bool notify)
     528{
     529        /*
     530         * User space can subscribe for FAULT events to take action
     531         * whenever a task faults (to take a dump, run a debugger, etc.).
     532         * The notification is always available, but unless udebug is enabled,
     533         * that's all you get.
     534        */
     535        if (notify) {
     536                if (event_is_subscribed(EVENT_FAULT)) {
     537                        /* Notify the subscriber that a fault occurred. */
     538                        event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid),
     539                            UPPER32(TASK->taskid), (sysarg_t) THREAD);
     540               
     541#ifdef CONFIG_UDEBUG
     542                        /* Wait for a debugging session. */
     543                        udebug_thread_fault();
     544#endif
     545                }
     546        }
     547       
     548        irq_spinlock_lock(&tasks_lock, true);
     549        task_kill_internal(TASK);
     550        irq_spinlock_unlock(&tasks_lock, true);
     551       
     552        thread_exit();
     553}
     554
     555/** Process syscall to terminate the current task.
     556 *
     557 * @param notify Send out fault notifications.
     558 *
     559 */
     560sysarg_t sys_task_exit(sysarg_t notify)
     561{
     562        task_kill_self(notify);
     563       
     564        /* Unreachable */
     565        return EOK;
     566}
     567
    522568static bool task_print_walker(avltree_node_t *node, void *arg)
    523569{
Note: See TracChangeset for help on using the changeset viewer.