sched/signal: Implement SA_NODEFER and SA_RESETHAND

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I9baa72b272c8877022cd94722824f393c7087721
This commit is contained in:
Xiang Xiao 2021-03-26 18:15:17 +08:00 committed by Alan Carvalho de Assis
parent c1c4ca4ffd
commit bea6e0ddd7
3 changed files with 14 additions and 2 deletions

View File

@ -249,6 +249,14 @@
* (always assumed) */ * (always assumed) */
#define SA_NOCLDWAIT (1 << 2) /* If signo=SIGCHLD, exit status of child #define SA_NOCLDWAIT (1 << 2) /* If signo=SIGCHLD, exit status of child
* processes will be discarded */ * processes will be discarded */
#define SA_ONSTACK (1 << 3) /* Indicates that a registered stack_t
* will be used */
#define SA_RESTART (1 << 4) /* Flag to get restarting signals
* (which were the default long ago) */
#define SA_NODEFER (1 << 5) /* Prevents the current signal from
* being masked in the handler */
#define SA_RESETHAND (1 << 6) /* Clears the handler when the signal
* is delivered */
/* These are the possible values of the signfo si_code field */ /* These are the possible values of the signfo si_code field */

View File

@ -106,8 +106,7 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
*/ */
savesigprocmask = stcb->sigprocmask; savesigprocmask = stcb->sigprocmask;
newsigprocmask = savesigprocmask | sigq->mask | newsigprocmask = savesigprocmask | sigq->mask;
SIGNO2SET(sigq->info.si_signo);
stcb->sigprocmask = newsigprocmask; stcb->sigprocmask = newsigprocmask;
#ifndef CONFIG_BUILD_FLAT #ifndef CONFIG_BUILD_FLAT

View File

@ -93,6 +93,11 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb, siginfo_t *info)
sigq->action.sighandler = sigact->act.sa_u._sa_sigaction; sigq->action.sighandler = sigact->act.sa_u._sa_sigaction;
sigq->mask = sigact->act.sa_mask; sigq->mask = sigact->act.sa_mask;
if ((sigact->act.sa_flags & SA_NODEFER) == 0)
{
sigq->mask |= SIGNO2SET(info->si_signo);
}
memcpy(&sigq->info, info, sizeof(siginfo_t)); memcpy(&sigq->info, info, sizeof(siginfo_t));
/* Put it at the end of the pending signals list */ /* Put it at the end of the pending signals list */