From dc7f8f136c72f0528c6ca4f3033f00edf2a9b3cd Mon Sep 17 00:00:00 2001 From: fangxinyong Date: Wed, 5 Jul 2023 11:55:21 +0800 Subject: [PATCH] signal: correct to const pointer for sigorset and sigandset the two GNU functions, should use const input pointer parameter. https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigorset.html https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigandset.html Signed-off-by: fangxinyong --- include/signal.h | 6 ++++-- libs/libc/signal/sig_andset.c | 3 ++- libs/libc/signal/sig_orset.c | 3 ++- sched/signal/sig_procmask.c | 3 +-- sched/signal/sig_timedwait.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/signal.h b/include/signal.h index 2ce1473098..fa00c94119 100644 --- a/include/signal.h +++ b/include/signal.h @@ -359,7 +359,8 @@ int raise(int signo); int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *oact); int sigaddset(FAR sigset_t *set, int signo); -int sigandset(FAR sigset_t *dest, FAR sigset_t *left, FAR sigset_t *right); +int sigandset(FAR sigset_t *dest, FAR const sigset_t *left, + FAR const sigset_t *right); int sigdelset(FAR sigset_t *set, int signo); int sigemptyset(FAR sigset_t *set); int sigfillset(FAR sigset_t *set); @@ -368,7 +369,8 @@ int sigisemptyset(FAR sigset_t *set); int sigismember(FAR const sigset_t *set, int signo); int sigignore(int signo); _sa_handler_t signal(int signo, _sa_handler_t func); -int sigorset(FAR sigset_t *dest, FAR sigset_t *left, FAR sigset_t *right); +int sigorset(FAR sigset_t *dest, FAR const sigset_t *left, + FAR const sigset_t *right); int sigpause(int signo); int sigpending(FAR sigset_t *set); int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); diff --git a/libs/libc/signal/sig_andset.c b/libs/libc/signal/sig_andset.c index eebec7b5c8..57474dff46 100644 --- a/libs/libc/signal/sig_andset.c +++ b/libs/libc/signal/sig_andset.c @@ -53,7 +53,8 @@ * ****************************************************************************/ -int sigandset(FAR sigset_t *dest, FAR sigset_t *left, FAR sigset_t *right) +int sigandset(FAR sigset_t *dest, FAR const sigset_t *left, + FAR const sigset_t *right) { int ndx; diff --git a/libs/libc/signal/sig_orset.c b/libs/libc/signal/sig_orset.c index 63e9672d24..d253cb4d79 100644 --- a/libs/libc/signal/sig_orset.c +++ b/libs/libc/signal/sig_orset.c @@ -53,7 +53,8 @@ * ****************************************************************************/ -int sigorset(FAR sigset_t *dest, FAR sigset_t *left, FAR sigset_t *right) +int sigorset(FAR sigset_t *dest, FAR const sigset_t *left, + FAR const sigset_t *right) { int ndx; diff --git a/sched/signal/sig_procmask.c b/sched/signal/sig_procmask.c index 3cca9b1491..092273544f 100644 --- a/sched/signal/sig_procmask.c +++ b/sched/signal/sig_procmask.c @@ -119,8 +119,7 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset) */ case SIG_BLOCK: - sigorset(&rtcb->sigprocmask, &rtcb->sigprocmask, - (FAR sigset_t *)set); + sigorset(&rtcb->sigprocmask, &rtcb->sigprocmask, set); break; /* The resulting set is the intersection of the current set and diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 190d6de577..c75eaf8eda 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -261,7 +261,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, */ intersection = nxsig_pendingset(rtcb); - sigandset(&intersection, &intersection, (FAR sigset_t *)set); + sigandset(&intersection, &intersection, set); if (!sigisemptyset(&intersection)) { /* One or more of the signals in intersections is sufficient to cause