Changeset 1fb4a49 in mainline


Ignore:
Timestamp:
2019-08-07T05:34:50Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
5cd2290
Parents:
3ea98e8
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-10-18 10:51:05)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 05:34:50)
Message:

kernel: Add exit reason parameter to EVENT_EXIT

  • So that own termination can be distinguished from kills by (typically) third party.
  • Translation from exit_reason_t to task_exit_t is left to uspace (taskman).

Conflicts:

kernel/generic/include/proc/task.h
kernel/generic/src/proc/task.c

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/proc/task.h

    r3ea98e8 r1fb4a49  
    4040typedef uint64_t task_id_t;
    4141
     42typedef enum {
     43        /** Task terminated synchronously on its own request. */
     44        EXIT_REASON_SELF,
     45        /** Task was killed by kill request (own or outer). */
     46        EXIT_REASON_KILLED
     47} exit_reason_t;
     48
    4249#endif
    4350
  • kernel/generic/include/proc/task.h

    r3ea98e8 r1fb4a49  
    9797        cap_info_t *cap_info;
    9898
     99        /** Exit reason. */
     100        exit_reason_t exit_reason;
     101       
    99102        /* IPC stuff */
    100103
  • kernel/generic/src/proc/task.c

    r3ea98e8 r1fb4a49  
    8383
    8484/* Forward declarations. */
    85 static void task_kill_internal(task_t *);
     85static void task_kill_internal(task_t *, exit_reason_t);
    8686static errno_t tsk_constructor(void *, unsigned int);
    8787static size_t tsk_destructor(void *);
     
    527527}
    528528
    529 static void task_kill_internal(task_t *task)
     529static void task_kill_internal(task_t *task, exit_reason_t exit_reason)
    530530{
    531531        irq_spinlock_lock(&task->lock, false);
    532532        irq_spinlock_lock(&threads_lock, false);
     533
     534        task->exit_reason = exit_reason;
    533535
    534536        /*
     
    578580        }
    579581
    580         task_kill_internal(task);
     582        task_kill_internal(task, EXIT_REASON_KILLED);
    581583        irq_spinlock_unlock(&tasks_lock, true);
    582584
     
    611613
    612614        irq_spinlock_lock(&tasks_lock, true);
    613         task_kill_internal(TASK);
     615        task_kill_internal(TASK, EXIT_REASON_SELF);
    614616        irq_spinlock_unlock(&tasks_lock, true);
    615617
  • kernel/generic/src/proc/thread.c

    r3ea98e8 r1fb4a49  
    527527                         * after any IPC cleanup operations. Ignore any errors.
    528528                         */
    529                         (void)event_notify_2(EVENT_EXIT, false,
    530                             LOWER32(TASK->taskid), UPPER32(TASK->taskid));
     529                        (void)event_notify_3(EVENT_EXIT, false,
     530                            LOWER32(TASK->taskid), UPPER32(TASK->taskid),
     531                            TASK->exit_reason);
    531532                }
    532533        }
Note: See TracChangeset for help on using the changeset viewer.