sched/signal: Cosmetic changes

This commit is contained in:
Yoshinori Sugino 2020-10-05 00:48:34 +09:00 committed by Xiang Xiao
parent a562fba971
commit e4094eff12

View File

@ -87,12 +87,12 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb, siginfo_t *info)
sigact = nxsig_find_action(stcb->group, info->si_signo); sigact = nxsig_find_action(stcb->group, info->si_signo);
/* Check if a valid signal handler is available and if the signal is /* Check if a valid signal handler is available and if the signal is
* unblocked. NOTE: There is no default action. * unblocked. NOTE: There is no default action.
*/ */
if ((sigact) && (sigact->act.sa_u._sa_sigaction)) if ((sigact) && (sigact->act.sa_u._sa_sigaction))
{ {
/* Allocate a new element for the signal queue. NOTE: /* Allocate a new element for the signal queue. NOTE:
* nxsig_alloc_pendingsigaction will force a system crash if it is * nxsig_alloc_pendingsigaction will force a system crash if it is
* unable to allocate memory for the signal data. * unable to allocate memory for the signal data.
*/ */
@ -222,8 +222,8 @@ static FAR sigpendq_t *
* Name: nxsig_add_pendingsignal * Name: nxsig_add_pendingsignal
* *
* Description: * Description:
* Add the specified signal to the signal pending list. NOTE: This * Add the specified signal to the signal pending list. NOTE: This
* function will queue only one entry for each pending signal. This * function will queue only one entry for each pending signal. This
* was done intentionally so that a run-away sender cannot consume * was done intentionally so that a run-away sender cannot consume
* all of memory. * all of memory.
* *
@ -282,7 +282,7 @@ static void nxsig_add_pendingsignal(FAR struct tcb_s *stcb,
* *
* Description: * Description:
* All signals received the task (whatever the source) go through this * All signals received the task (whatever the source) go through this
* function to be processed. This function is responsible for: * function to be processed. This function is responsible for:
* *
* - Determining if the signal is blocked. * - Determining if the signal is blocked.
* - Queuing and dispatching signal actions * - Queuing and dispatching signal actions
@ -290,7 +290,7 @@ static void nxsig_add_pendingsignal(FAR struct tcb_s *stcb,
* - Queuing pending signals. * - Queuing pending signals.
* *
* This function will deliver the signal to the task associated with * This function will deliver the signal to the task associated with
* the specified TCB. This function should *not* typically be used * the specified TCB. This function should *not* typically be used
* to dispatch signals since it will *not* follow the group signal * to dispatch signals since it will *not* follow the group signal
* deliver algorithms. * deliver algorithms.
* *
@ -325,13 +325,13 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
#ifdef CONFIG_LIB_SYSCALL #ifdef CONFIG_LIB_SYSCALL
/* Check if the signal is masked OR if the signal is received while we are /* Check if the signal is masked OR if the signal is received while we are
* processing a system call -- in either case, it will be added to the * processing a system call -- in either case, it will be added to the
* list of pending signals. Unmasked user signal actions will be deferred * list of pending signals. Unmasked user signal actions will be deferred
* while we process the system call. * while we process the system call.
* *
* If a thread calls a blocking system call, the thread will still be * If a thread calls a blocking system call, the thread will still be
* unblocked when the signal occurs (see OTHER SIGNAL HANDLING below), but * unblocked when the signal occurs (see OTHER SIGNAL HANDLING below), but
* any associated user signal action will be deferred until the system * any associated user signal action will be deferred until the system
* call returns. For example, if the application calls sem_wait(), the * call returns. For example, if the application calls sem_wait(), the
* following would occur: * following would occur:
* *
* 1. System call entry logic will block user signal handling and call * 1. System call entry logic will block user signal handling and call
@ -349,16 +349,16 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
if ((masked == 1) || (stcb->flags & TCB_FLAG_SYSCALL) != 0) if ((masked == 1) || (stcb->flags & TCB_FLAG_SYSCALL) != 0)
#else #else
/* Check if the signal is masked. In that case, it will be added to the /* Check if the signal is masked. In that case, it will be added to the
* list of pending signals. * list of pending signals.
*/ */
if (masked == 1) if (masked == 1)
#endif #endif
{ {
/* Check if the task is waiting for this pending signal. If so, then /* Check if the task is waiting for this pending signal. If so, then
* unblock it. This must be performed in a critical section because * unblock it. This must be performed in a critical section because
* signals can be queued * from the interrupt level. * signals can be queued from the interrupt level.
*/ */
flags = enter_critical_section(); flags = enter_critical_section();
@ -401,7 +401,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
up_schedule_sigaction(stcb, nxsig_deliver); up_schedule_sigaction(stcb, nxsig_deliver);
/* Check if the task is waiting for an unmasked signal. If so, then /* Check if the task is waiting for an unmasked signal. If so, then
* unblock it. This must be performed in a critical section because * unblock it. This must be performed in a critical section because
* signals can be queued from the interrupt level. * signals can be queued from the interrupt level.
*/ */
@ -423,7 +423,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
/************************* OTHER SIGNAL HANDLING **************************/ /************************* OTHER SIGNAL HANDLING **************************/
/* Performed only if the signal is unmasked. These actions also must /* Performed only if the signal is unmasked. These actions also must
* happen within a system call. * happen within a system call.
*/ */
@ -482,7 +482,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
* *
* Description: * Description:
* This is the front-end for nxsig_tcbdispatch that should be typically * This is the front-end for nxsig_tcbdispatch that should be typically
* be used to dispatch a signal. If HAVE_GROUP_MEMBERS is defined, * be used to dispatch a signal. If HAVE_GROUP_MEMBERS is defined,
* then function will follow the group signal delivery algorithms: * then function will follow the group signal delivery algorithms:
* *
* This front-end does the following things before calling * This front-end does the following things before calling
@ -516,7 +516,7 @@ int nxsig_dispatch(pid_t pid, FAR siginfo_t *info)
stcb = nxsched_get_tcb(pid); stcb = nxsched_get_tcb(pid);
if (stcb != NULL) if (stcb != NULL)
{ {
/* The task/thread associated with this PID is still active. Get its /* The task/thread associated with this PID is still active. Get its
* task group. * task group.
*/ */
@ -524,9 +524,9 @@ int nxsig_dispatch(pid_t pid, FAR siginfo_t *info)
} }
else else
{ {
/* The task/thread associated with this PID has exited. In the normal /* The task/thread associated with this PID has exited. In the normal
* usage model, the PID should correspond to the PID of the task that * usage model, the PID should correspond to the PID of the task that
* created the task group. Try looking it up. * created the task group. Try looking it up.
*/ */
group = group_findbypid(pid); group = group_findbypid(pid);