This commit adds support for default signal actions for SIGSTOP, SIGSTP, and SIGCONT.

Squashed commit of the following:

    Add procfs support to show stopped tasks.  Add nxsig_action() to solve a chicken and egg problem:  We needed to use sigaction to set default actions, but sigaction() would refuse to set actions if the default actions could not be caught or ignored.

    sched/signal:  Add configuration option to selectively enabled/disable default signal actions for SIGSTOP/SIGSTP/SIGCONT and SIGKILL/SIGINT.  Fix some compilation issues.

    sched/sched:  Okay.. I figured out a way to handle state changes that may occur while they were stopped. If a task/thread was already blocked when SIGSTOP/SIGSTP was received, it will restart in the running state.  I will appear that to the task/thread that the blocked condition was interrupt by a signal and returns the EINTR error.

    sched/group and sched/sched:  Finish framework for continue/resume logic.

    sched/signal:  Roughing out basic structure to support task suspend/resume
This commit is contained in:
Gregory Nutt
2018-08-30 10:27:18 -06:00
parent 20fc3ebcdd
commit a7265d71c6
22 changed files with 815 additions and 75 deletions
+16
View File
@@ -182,6 +182,12 @@ volatile dq_queue_t g_waitingformqnotfull;
volatile dq_queue_t g_waitingforfill;
#endif
#ifdef CONFIG_SIG_SIGSTOP_ACTION
/* This is the list of all tasks that have been stopped via SIGSTOP or SIGSTP */
volatile dq_queue_t g_stoppedtasks;
#endif
/* This the list of all tasks that have been initialized, but not yet
* activated. NOTE: This is the only list that is not prioritized.
*/
@@ -300,6 +306,13 @@ const struct tasklist_s g_tasklisttable[NUM_TASK_STATES] =
TLIST_ATTR_PRIORITIZED
}
#endif
#ifdef CONFIG_SIG_SIGSTOP_ACTION
,
{ /* TSTATE_TASK_STOPPED */
&g_stoppedtasks,
0 /* See tcb->prev_state */
},
#endif
};
/* This is the current initialization state. The level of initialization
@@ -397,6 +410,9 @@ void os_start(void)
#endif
#ifdef CONFIG_PAGING
dq_init(&g_waitingforfill);
#endif
#ifdef CONFIG_SIG_SIGSTOP_ACTION
dq_init(&g_stoppedtasks);
#endif
dq_init(&g_inactivetasks);
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \