You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/12/28 15:06:05 UTC
[nuttx] 01/03: signal/nxsig_pengingset: move nxsig_pendingset to common header
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3927d878e4f96c47c4321824e047338a3a26ea41
Author: dongjiuzhu1 <do...@xiaomi.com>
AuthorDate: Wed Oct 19 10:32:14 2022 +0800
signal/nxsig_pengingset: move nxsig_pendingset to common header
Signed-off-by: dongjiuzhu1 <do...@xiaomi.com>
---
include/nuttx/signal.h | 19 +++++++++++++++++++
sched/signal/sig_pending.c | 17 ++++++++++-------
sched/signal/signal.h | 4 ----
3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/include/nuttx/signal.h b/include/nuttx/signal.h
index 04e38ca4d2..76afe2e22d 100644
--- a/include/nuttx/signal.h
+++ b/include/nuttx/signal.h
@@ -32,6 +32,7 @@
#include <signal.h>
#include <nuttx/wqueue.h>
+#include <nuttx/sched.h>
/****************************************************************************
* Pre-processor Definitions
@@ -190,6 +191,24 @@ int nxsig_addset(FAR sigset_t *set, int signo);
int nxsig_delset(FAR sigset_t *set, int signo);
+/****************************************************************************
+ * Name: nxsig_pendingset
+ *
+ * Description:
+ * Convert the list of pending signals into a signal set
+ *
+ * Input Parameters:
+ * stcb - The specific tcb of return pending set.
+ *
+ * Returned Value:
+ * Return the pending signal set.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+sigset_t nxsig_pendingset(FAR struct tcb_s *stcb);
+
/****************************************************************************
* Name: nxsig_procmask
*
diff --git a/sched/signal/sig_pending.c b/sched/signal/sig_pending.c
index e7628a2966..ec4a0412d1 100644
--- a/sched/signal/sig_pending.c
+++ b/sched/signal/sig_pending.c
@@ -58,16 +58,13 @@
int sigpending(FAR sigset_t *set)
{
- FAR struct tcb_s *rtcb = this_task();
- int ret = ERROR;
-
if (set)
{
- *set = nxsig_pendingset(rtcb);
- ret = OK;
+ *set = nxsig_pendingset(NULL);
+ return OK;
}
- return ret;
+ return ERROR;
}
/****************************************************************************
@@ -80,11 +77,17 @@ int sigpending(FAR sigset_t *set)
sigset_t nxsig_pendingset(FAR struct tcb_s *stcb)
{
- FAR struct task_group_s *group = stcb->group;
+ FAR struct task_group_s *group;
sigset_t sigpendset;
FAR sigpendq_t *sigpend;
irqstate_t flags;
+ if (stcb == NULL)
+ {
+ stcb = this_task();
+ }
+
+ group = stcb->group;
DEBUGASSERT(group);
sigpendset = NULL_SIGNAL_SET;
diff --git a/sched/signal/signal.h b/sched/signal/signal.h
index e257f57dfd..0553b8e3b0 100644
--- a/sched/signal/signal.h
+++ b/sched/signal/signal.h
@@ -163,10 +163,6 @@ _sa_handler_t nxsig_default(FAR struct tcb_s *tcb, int signo,
int nxsig_default_initialize(FAR struct tcb_s *tcb);
#endif
-/* sig_pending.c */
-
-sigset_t nxsig_pendingset(FAR struct tcb_s *stcb);
-
/* sig_dispatch.c */
int nxsig_tcbdispatch(FAR struct tcb_s *stcb,