Skip to content

Commit

Permalink
ltp: sigprocmask fix
Browse files Browse the repository at this point in the history
1. change signal/sig_procmask.c and pthread/pthread_sigmask.c together
2. clear signals unconditionally

Signed-off-by: guanyi <[email protected]>
  • Loading branch information
guanyi authored and xiaoxiang781216 committed Aug 1, 2023
1 parent f8ce0cd commit 55a727b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sched/pthread/pthread_sigmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@

int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
{
int ret = nxsig_procmask(how, set, oset);
sigset_t nset;
int ret;

/* SIGKILL and SIGSTOP should not be added to signal mask */

if (set != NULL)
{
nset = *set;
nxsig_delset(&nset, SIGKILL);
nxsig_delset(&nset, SIGSTOP);
set = &nset;
}

ret = nxsig_procmask(how, set, oset);
return ret < 0 ? -ret : OK;
}
11 changes: 11 additions & 0 deletions sched/signal/sig_procmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,19 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)

int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
{
sigset_t nset;
int ret;

/* SIGKILL and SIGSTOP should not be added to signal mask */

if (set != NULL)
{
nset = *set;
nxsig_delset(&nset, SIGKILL);
nxsig_delset(&nset, SIGSTOP);
set = &nset;
}

/* Let nxsig_procmask do all of the work */

ret = nxsig_procmask(how, set, oset);
Expand Down

0 comments on commit 55a727b

Please sign in to comment.