sched/sig_pending: sigpending() should return caller pending signals only

Previously sigpending() returned all pending signals in the group, which is not
POSIX compliant. It should return signals pending only for the caller, so
a signal send with pthread_kill() intended for another thread should not be
returned (it's not pending for a caller).

This fixes the pthread_create.c/test9 test case from
PSE52 Open Group Threads Test Suite.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2025-09-16 13:12:10 +02:00 committed by Matteo Golin
parent 3fb227d48e
commit 0c9d0b3f84

View file

@ -86,13 +86,10 @@ sigset_t nxsig_pendingset(FAR struct tcb_s *stcb)
if (stcb == NULL)
{
group = this_task()->group;
}
else
{
group = stcb->group;
stcb = this_task();
}
group = stcb->group;
DEBUGASSERT(group);
sigemptyset(&sigpendset);
@ -101,7 +98,7 @@ sigset_t nxsig_pendingset(FAR struct tcb_s *stcb)
for (sigpend = (FAR sigpendq_t *)group->tg_sigpendingq.head;
(sigpend); sigpend = sigpend->flink)
{
if (stcb == NULL || sigpend->tcb == NULL || stcb == sigpend->tcb)
if (sigpend->tcb == NULL || stcb == sigpend->tcb)
{
nxsig_addset(&sigpendset, sigpend->info.si_signo);
}