From 017adac7a4805a111607b9e7dc8e16990e844aae Mon Sep 17 00:00:00 2001 From: JerryH Date: Thu, 20 Jan 2022 16:49:13 +0800 Subject: [PATCH] feature: Newlib support signal. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改signal适配支持Newlic close #I4RD3H Signed-off-by: JerryH Change-Id: I59f59856a275f5a4f802a1ea7d08e9405a2fb6aa --- components/signal/BUILD.gn | 1 + components/signal/Kconfig | 2 +- kal/posix/Kconfig | 4 +-- kal/posix/src/pipe.c | 2 +- kal/posix/src/signal.c | 54 -------------------------------------- 5 files changed, 5 insertions(+), 58 deletions(-) diff --git a/components/signal/BUILD.gn b/components/signal/BUILD.gn index e473daa9..590f9556 100644 --- a/components/signal/BUILD.gn +++ b/components/signal/BUILD.gn @@ -31,6 +31,7 @@ import("//kernel/liteos_m/liteos.gni") module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ "los_signal.c" ] + configs += [ "$LITEOSTOPDIR:warn_config" ] } config("public") { diff --git a/components/signal/Kconfig b/components/signal/Kconfig index c9bd7c97..6808b9c5 100644 --- a/components/signal/Kconfig +++ b/components/signal/Kconfig @@ -1,6 +1,6 @@ config KERNEL_SIGNAL bool "Enable Signal" - default n + default y depends on KERNEL_EXTKERNEL help Select y to build LiteOS with signal. diff --git a/kal/posix/Kconfig b/kal/posix/Kconfig index dcf32c15..73571f9e 100644 --- a/kal/posix/Kconfig +++ b/kal/posix/Kconfig @@ -62,13 +62,13 @@ config POSIX_MQUEUE_API config POSIX_PIPE_API bool "Enable POSIX Pipe API" - default n + default y help Answer Y to enable LiteOS support POSIX Pipe API. config POSIX_SIGNAL_API bool "Enable POSIX Signal API" - default n + default y depends on KERNEL_SIGNAL help Answer Y to enable LiteOS support POSIX Signal API. diff --git a/kal/posix/src/pipe.c b/kal/posix/src/pipe.c index 845b5450..0aa10a8d 100644 --- a/kal/posix/src/pipe.c +++ b/kal/posix/src/pipe.c @@ -28,7 +28,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include "securec.h" #include "los_fs.h" diff --git a/kal/posix/src/signal.c b/kal/posix/src/signal.c index dd8dc1f2..1cc402c4 100644 --- a/kal/posix/src/signal.c +++ b/kal/posix/src/signal.c @@ -77,60 +77,6 @@ void (*signal(int sig, void (*func)(int)))(int) return h; } -int sigemptyset(sigset_t *set) -{ - if (set == NULL) { - errno = EINVAL; - return -1; - } - - *set = 0; - return 0; -} - -int sigfillset(sigset_t *set) -{ - if (set == NULL) { - errno = EINVAL; - return -1; - } - - *set = ~0; - return 0; -} - -int sigaddset(sigset_t *set, int sig) -{ - if ((set == NULL) || !OS_SIGNAL_VALID(sig)) { - errno = EINVAL; - return -1; - } - - *set |= LOS_SIGNAL_MASK(sig); - return 0; -} - -int sigdelset(sigset_t *set, int sig) -{ - if ((set == NULL) || !OS_SIGNAL_VALID(sig)) { - errno = EINVAL; - return -1; - } - - *set &= ~LOS_SIGNAL_MASK(sig); - return 0; -} - -int sigismember(const sigset_t *set, int sig) -{ - if ((set == NULL) || !OS_SIGNAL_VALID(sig)) { - errno = EINVAL; - return -1; - } - - return ((*set & LOS_SIGNAL_MASK(sig)) != 0); -} - int sigprocmask(int how, const sigset_t *set, sigset_t *oset) { unsigned int ret = LOS_SignalMask(how, set, oset); -- GitLab