mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
sched/signal: Fix nxsig_ismember() return value behavior
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
nxsig_ismember() has a return type of int, but the current implementation returns a boolean value, which is incorrect. All callers should determine membership by checking whether the return value is 1 or 0, which is also consistent with the POSIX sigismember() API. Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
committed by
Xiang Xiao
parent
817e4ee354
commit
ba05c7f133
@@ -149,7 +149,7 @@ static int signalfd_file_close(FAR struct file *filep)
|
|||||||
|
|
||||||
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
||||||
{
|
{
|
||||||
if (nxsig_ismember(&dev->sigmask, signo))
|
if (nxsig_ismember(&dev->sigmask, signo) == 1)
|
||||||
{
|
{
|
||||||
signal(signo, SIG_DFL);
|
signal(signo, SIG_DFL);
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ int signalfd(int fd, FAR const sigset_t *mask, int flags)
|
|||||||
dev = filep->f_priv;
|
dev = filep->f_priv;
|
||||||
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
||||||
{
|
{
|
||||||
if (nxsig_ismember(&dev->sigmask, signo))
|
if (nxsig_ismember(&dev->sigmask, signo) == 1)
|
||||||
{
|
{
|
||||||
signal(signo, SIG_DFL);
|
signal(signo, SIG_DFL);
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ int signalfd(int fd, FAR const sigset_t *mask, int flags)
|
|||||||
act.sa_user = dev;
|
act.sa_user = dev;
|
||||||
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
||||||
{
|
{
|
||||||
if (nxsig_ismember(&dev->sigmask, signo))
|
if (nxsig_ismember(&dev->sigmask, signo) == 1)
|
||||||
{
|
{
|
||||||
nxsig_action(signo, &act, NULL, false);
|
nxsig_action(signo, &act, NULL, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ int nxsig_ismember(FAR const sigset_t *set, int signo)
|
|||||||
{
|
{
|
||||||
/* Check if the signal is in the set */
|
/* Check if the signal is in the set */
|
||||||
|
|
||||||
return ((set->_elem[_SIGSET_NDX(signo)] & _SIGNO2SET(signo)) != 0);
|
return (set->_elem[_SIGSET_NDX(signo)] & _SIGNO2SET(signo)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ static int group_signal_handler(pid_t pid, FAR void *arg)
|
|||||||
|
|
||||||
/* Is this signal unblocked on this thread? */
|
/* Is this signal unblocked on this thread? */
|
||||||
|
|
||||||
if (!nxsig_ismember(&tcb->sigprocmask, info->siginfo->si_signo) &&
|
if ((nxsig_ismember(&tcb->sigprocmask, info->siginfo->si_signo) != 1) &&
|
||||||
!info->ptcb && tcb != info->atcb)
|
!info->ptcb && tcb != info->atcb)
|
||||||
{
|
{
|
||||||
/* Yes.. remember this TCB if we have not encountered any
|
/* Yes.. remember this TCB if we have not encountered any
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
|
|||||||
|
|
||||||
if (stcb->task_state == TSTATE_WAIT_SIG &&
|
if (stcb->task_state == TSTATE_WAIT_SIG &&
|
||||||
(masked == 0 ||
|
(masked == 0 ||
|
||||||
nxsig_ismember(&stcb->sigwaitmask, info->si_signo)))
|
(nxsig_ismember(&stcb->sigwaitmask, info->si_signo) == 1)))
|
||||||
{
|
{
|
||||||
if (stcb->sigunbinfo != NULL)
|
if (stcb->sigunbinfo != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int nxsig_lowest(sigset_t *set)
|
|||||||
|
|
||||||
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
|
||||||
{
|
{
|
||||||
if (nxsig_ismember(set, signo))
|
if (nxsig_ismember(set, signo) == 1)
|
||||||
{
|
{
|
||||||
return signo;
|
return signo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
|||||||
* that we were waiting for?
|
* that we were waiting for?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (nxsig_ismember(set, rtcb->sigunbinfo->si_signo))
|
if (nxsig_ismember(set, rtcb->sigunbinfo->si_signo) == 1)
|
||||||
{
|
{
|
||||||
/* Yes.. the return value is the number of the signal that
|
/* Yes.. the return value is the number of the signal that
|
||||||
* awakened us.
|
* awakened us.
|
||||||
|
|||||||
Reference in New Issue
Block a user