sched/signal: Fix nxsig_ismember() return value behavior
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:
wangchengdong
2025-11-21 15:44:59 +08:00
committed by Xiang Xiao
parent 817e4ee354
commit ba05c7f133
6 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -149,7 +149,7 @@ static int signalfd_file_close(FAR struct file *filep)
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);
}
@@ -379,7 +379,7 @@ int signalfd(int fd, FAR const sigset_t *mask, int flags)
dev = filep->f_priv;
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);
}
@@ -394,7 +394,7 @@ int signalfd(int fd, FAR const sigset_t *mask, int flags)
act.sa_user = dev;
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);
}
+1 -1
View File
@@ -68,7 +68,7 @@ int nxsig_ismember(FAR const sigset_t *set, int signo)
{
/* 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;
}
}
+1 -1
View File
@@ -127,7 +127,7 @@ static int group_signal_handler(pid_t pid, FAR void *arg)
/* 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)
{
/* Yes.. remember this TCB if we have not encountered any
+1 -1
View File
@@ -550,7 +550,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
if (stcb->task_state == TSTATE_WAIT_SIG &&
(masked == 0 ||
nxsig_ismember(&stcb->sigwaitmask, info->si_signo)))
(nxsig_ismember(&stcb->sigwaitmask, info->si_signo) == 1)))
{
if (stcb->sigunbinfo != NULL)
{
+1 -1
View File
@@ -50,7 +50,7 @@ int nxsig_lowest(sigset_t *set)
for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
{
if (nxsig_ismember(set, signo))
if (nxsig_ismember(set, signo) == 1)
{
return signo;
}
+1 -1
View File
@@ -419,7 +419,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
* 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
* awakened us.