diff --git a/arch/arm/include/arm/irq.h b/arch/arm/include/arm/irq.h index 59acf1aba7e22..61b68a1cae2b4 100644 --- a/arch/arm/include/arm/irq.h +++ b/arch/arm/include/arm/irq.h @@ -129,11 +129,13 @@ #ifndef __ASSEMBLY__ struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ uint32_t *saved_regs; +#endif /* Register save area with XCPTCONTEXT_SIZE, only valid when: * 1.The task isn't running or diff --git a/arch/arm/include/armv6-m/irq.h b/arch/arm/include/armv6-m/irq.h index 6d75ccf466651..e0daad1261218 100644 --- a/arch/arm/include/armv6-m/irq.h +++ b/arch/arm/include/armv6-m/irq.h @@ -158,6 +158,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -171,6 +172,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif #ifdef CONFIG_LIB_SYSCALL /* The following array holds the return address and the exc_return value diff --git a/arch/arm/include/armv7-a/irq.h b/arch/arm/include/armv7-a/irq.h index e1fb1ff6f9050..b7b298c22c013 100644 --- a/arch/arm/include/armv7-a/irq.h +++ b/arch/arm/include/armv7-a/irq.h @@ -259,6 +259,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -273,6 +274,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area with XCPTCONTEXT_SIZE, only valid when: * 1.The task isn't running or diff --git a/arch/arm/include/armv7-m/irq.h b/arch/arm/include/armv7-m/irq.h index 8c1cf80368c39..1f37bb6fbb546 100644 --- a/arch/arm/include/armv7-m/irq.h +++ b/arch/arm/include/armv7-m/irq.h @@ -214,6 +214,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -228,6 +229,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ #ifdef CONFIG_LIB_SYSCALL /* The following array holds the return address and the exc_return value diff --git a/arch/arm/include/armv7-r/irq.h b/arch/arm/include/armv7-r/irq.h index d25064c9ed801..6686cbc6a2662 100644 --- a/arch/arm/include/armv7-r/irq.h +++ b/arch/arm/include/armv7-r/irq.h @@ -259,6 +259,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -272,6 +273,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area with XCPTCONTEXT_SIZE, only valid when: * 1.The task isn't running or diff --git a/arch/arm/include/armv8-m/irq.h b/arch/arm/include/armv8-m/irq.h index a9fb63b9c86aa..3d4290eeb7fb2 100644 --- a/arch/arm/include/armv8-m/irq.h +++ b/arch/arm/include/armv8-m/irq.h @@ -225,6 +225,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -239,6 +240,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ #ifdef CONFIG_LIB_SYSCALL /* The following array holds the return address and the exc_return value diff --git a/arch/arm/include/armv8-r/irq.h b/arch/arm/include/armv8-r/irq.h index e08636f1e71f2..8d44efb644213 100644 --- a/arch/arm/include/armv8-r/irq.h +++ b/arch/arm/include/armv8-r/irq.h @@ -259,6 +259,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ @@ -272,6 +273,7 @@ struct xcptcontext uint32_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area with XCPTCONTEXT_SIZE, only valid when: * 1.The task isn't running or diff --git a/arch/arm/include/tlsr82/irq.h b/arch/arm/include/tlsr82/irq.h index 7a89ac77a7e4f..a8a551cbe3eb8 100644 --- a/arch/arm/include/tlsr82/irq.h +++ b/arch/arm/include/tlsr82/irq.h @@ -160,12 +160,13 @@ #ifndef __ASSEMBLY__ struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved register array pointer used during * signal processing. */ uint32_t *saved_regs; - +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area */ uint32_t *regs; diff --git a/arch/arm/src/arm/CMakeLists.txt b/arch/arm/src/arm/CMakeLists.txt index 7441d85d92724..f428d321b76e4 100644 --- a/arch/arm/src/arm/CMakeLists.txt +++ b/arch/arm/src/arm/CMakeLists.txt @@ -39,6 +39,10 @@ list( arm_vectortab.S arm_saveusercontext.S) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(CONFIG_PAGING) list(APPEND SRCS arm_pginitialize.c arm_checkmapping.c arm_allocpage.c arm_va2pte.c) diff --git a/arch/arm/src/arm/Make.defs b/arch/arm/src/arm/Make.defs index faff6009b70f9..43afb28c92003 100644 --- a/arch/arm/src/arm/Make.defs +++ b/arch/arm/src/arm/Make.defs @@ -27,13 +27,17 @@ include common/Make.defs HEAD_ASRC = arm_head.S CMN_CSRCS += arm_dataabort.c arm_doirq.c arm_initialstate.c -CMN_CSRCS += arm_prefetchabort.c arm_schedulesigaction.c -CMN_CSRCS += arm_sigdeliver.c arm_syscall.c arm_tcbinfo.c +CMN_CSRCS += arm_prefetchabort.c +CMN_CSRCS += arm_syscall.c arm_tcbinfo.c CMN_CSRCS += arm_undefinedinsn.c CMN_ASRCS += arm_cache.S arm_vectors.S arm_vectortab.S CMN_ASRCS += arm_saveusercontext.S +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifeq ($(CONFIG_LEGACY_PAGING),y) CMN_CSRCS += arm_pginitialize.c arm_checkmapping.c arm_allocpage.c arm_va2pte.c endif diff --git a/arch/arm/src/armv6-m/CMakeLists.txt b/arch/arm/src/armv6-m/CMakeLists.txt index 194788120d9b1..79858544241eb 100644 --- a/arch/arm/src/armv6-m/CMakeLists.txt +++ b/arch/arm/src/armv6-m/CMakeLists.txt @@ -27,13 +27,15 @@ set(SRCS arm_doirq.c arm_hardfault.c arm_initialstate.c - arm_schedulesigaction.c - arm_sigdeliver.c arm_svcall.c arm_systemreset.c arm_tcbinfo.c arm_trigger_irq.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) list(APPEND SRCS arm_vectors.c) endif() diff --git a/arch/arm/src/armv6-m/Make.defs b/arch/arm/src/armv6-m/Make.defs index 0bd98bc57c4ea..f79d8f4b44544 100644 --- a/arch/arm/src/armv6-m/Make.defs +++ b/arch/arm/src/armv6-m/Make.defs @@ -27,10 +27,14 @@ include common/Make.defs CMN_ASRCS += arm_exception.S arm_saveusercontext.S CMN_CSRCS += arm_cpuinfo.c arm_doirq.c arm_hardfault.c arm_initialstate.c -CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c arm_svcall.c +CMN_CSRCS += arm_svcall.c CMN_CSRCS += arm_systemreset.c arm_tcbinfo.c CMN_CSRCS += arm_trigger_irq.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) CMN_CSRCS += arm_vectors.c endif diff --git a/arch/arm/src/armv7-a/CMakeLists.txt b/arch/arm/src/armv7-a/CMakeLists.txt index dcb6cdad90729..27cfd8bbb82b1 100644 --- a/arch/arm/src/armv7-a/CMakeLists.txt +++ b/arch/arm/src/armv7-a/CMakeLists.txt @@ -43,14 +43,16 @@ list( arm_initialstate.c arm_mmu.c arm_prefetchabort.c - arm_schedulesigaction.c - arm_sigdeliver.c arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c arm_perf.c cp15_cacheops.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(CONFIG_ARMV7A_GICv2M) list(APPEND SRCS arm_gicv2m.c) endif() diff --git a/arch/arm/src/armv7-a/Make.defs b/arch/arm/src/armv7-a/Make.defs index 690226f943f0b..07154bda71209 100644 --- a/arch/arm/src/armv7-a/Make.defs +++ b/arch/arm/src/armv7-a/Make.defs @@ -38,10 +38,13 @@ CMN_ASRCS += arm_cpuhead.S arm_vectors.S arm_saveusercontext.S CMN_CSRCS += arm_cache.c arm_cpuinfo.c arm_dataabort.c CMN_CSRCS += arm_doirq.c arm_gicv2.c arm_gicv2_dump.c CMN_CSRCS += arm_initialstate.c arm_mmu.c arm_prefetchabort.c -CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c CMN_CSRCS += arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c cp15_cacheops.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifeq ($(CONFIG_ARMV7A_GICv2M),y) CMN_CSRCS += arm_gicv2m.c endif diff --git a/arch/arm/src/armv7-m/CMakeLists.txt b/arch/arm/src/armv7-m/CMakeLists.txt index 3490f5c581a5f..f5bd7b858d47b 100644 --- a/arch/arm/src/armv7-m/CMakeLists.txt +++ b/arch/arm/src/armv7-m/CMakeLists.txt @@ -34,8 +34,6 @@ set(SRCS arm_itm.c arm_memfault.c arm_perf.c - arm_schedulesigaction.c - arm_sigdeliver.c arm_svcall.c arm_systemreset.c arm_tcbinfo.c @@ -43,6 +41,10 @@ set(SRCS arm_usagefault.c arm_dbgmonitor.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) list(APPEND SRCS arm_vectors.c) endif() diff --git a/arch/arm/src/armv7-m/Make.defs b/arch/arm/src/armv7-m/Make.defs index 8edd3e1ca9c01..b75697c9dc532 100644 --- a/arch/arm/src/armv7-m/Make.defs +++ b/arch/arm/src/armv7-m/Make.defs @@ -29,10 +29,13 @@ CMN_ASRCS += arm_exception.S arm_saveusercontext.S CMN_CSRCS += arm_busfault.c arm_cache.c arm_cpuinfo.c arm_doirq.c CMN_CSRCS += arm_hardfault.c arm_initialstate.c arm_itm.c CMN_CSRCS += arm_memfault.c arm_perf.c -CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c CMN_CSRCS += arm_svcall.c arm_systemreset.c arm_tcbinfo.c CMN_CSRCS += arm_trigger_irq.c arm_usagefault.c arm_dbgmonitor.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) CMN_CSRCS += arm_vectors.c endif diff --git a/arch/arm/src/armv7-r/CMakeLists.txt b/arch/arm/src/armv7-r/CMakeLists.txt index 5006f13659f59..f127f628ae4b5 100644 --- a/arch/arm/src/armv7-r/CMakeLists.txt +++ b/arch/arm/src/armv7-r/CMakeLists.txt @@ -39,14 +39,16 @@ list( arm_doirq.c arm_initialstate.c arm_prefetchabort.c - arm_schedulesigaction.c - arm_sigdeliver.c arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c arm_perf.c cp15_cacheops.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(NOT CONFIG_ARCH_CHIP STREQUAL tms570) list(APPEND SRCS arm_gicv2.c arm_gicv2_dump.c) endif() diff --git a/arch/arm/src/armv7-r/Make.defs b/arch/arm/src/armv7-r/Make.defs index a0c29c9d72cc1..70480712b2b00 100644 --- a/arch/arm/src/armv7-r/Make.defs +++ b/arch/arm/src/armv7-r/Make.defs @@ -34,7 +34,6 @@ HEAD_ASRC += arm_vectortab.S CMN_CSRCS += arm_cache.c arm_cpuinfo.c arm_dataabort.c CMN_CSRCS += arm_doirq.c arm_gicv2.c arm_gicv2_dump.c CMN_CSRCS += arm_initialstate.c arm_prefetchabort.c -CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c CMN_CSRCS += arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c cp15_cacheops.c @@ -42,6 +41,10 @@ CMN_CSRCS += arm_perf.c cp15_cacheops.c CMN_ASRCS += arm_head.S arm_vectors.S arm_saveusercontext.S +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifeq ($(CONFIG_ARMV7R_HAVE_PTM), y) CMN_CSRCS += arm_timer.c endif diff --git a/arch/arm/src/armv8-m/CMakeLists.txt b/arch/arm/src/armv8-m/CMakeLists.txt index 52542a7fda09b..f982aa5b526c0 100644 --- a/arch/arm/src/armv8-m/CMakeLists.txt +++ b/arch/arm/src/armv8-m/CMakeLists.txt @@ -34,16 +34,18 @@ set(SRCS arm_memfault.c arm_perf.c arm_sau.c - arm_schedulesigaction.c arm_securefault.c arm_secure_irq.c - arm_sigdeliver.c arm_svcall.c arm_systemreset.c arm_tcbinfo.c arm_trigger_irq.c arm_usagefault.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(NOT CONFIG_ARCH_HAVE_CUSTOM_VECTORS) list(APPEND SRCS arm_vectors.c) endif() diff --git a/arch/arm/src/armv8-m/Make.defs b/arch/arm/src/armv8-m/Make.defs index 0d1a8222a3186..17c60e8c54b83 100644 --- a/arch/arm/src/armv8-m/Make.defs +++ b/arch/arm/src/armv8-m/Make.defs @@ -29,11 +29,15 @@ CMN_ASRCS += arm_exception.S arm_saveusercontext.S CMN_CSRCS += arm_busfault.c arm_cache.c arm_cpuinfo.c arm_doirq.c CMN_CSRCS += arm_hardfault.c arm_initialstate.c arm_itm.c CMN_CSRCS += arm_memfault.c arm_perf.c arm_sau.c -CMN_CSRCS += arm_schedulesigaction.c arm_securefault.c arm_secure_irq.c -CMN_CSRCS += arm_sigdeliver.c arm_svcall.c +CMN_CSRCS += arm_securefault.c arm_secure_irq.c +CMN_CSRCS += arm_svcall.c CMN_CSRCS += arm_systemreset.c arm_tcbinfo.c CMN_CSRCS += arm_trigger_irq.c arm_usagefault.c arm_dbgmonitor.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + ifneq ($(CONFIG_ARCH_HAVE_CUSTOM_VECTORS),y) CMN_CSRCS += arm_vectors.c endif diff --git a/arch/arm/src/armv8-r/CMakeLists.txt b/arch/arm/src/armv8-r/CMakeLists.txt index 23dcc0fd03320..916f49d833af9 100644 --- a/arch/arm/src/armv8-r/CMakeLists.txt +++ b/arch/arm/src/armv8-r/CMakeLists.txt @@ -41,14 +41,16 @@ list( arm_gicv3.c arm_initialstate.c arm_prefetchabort.c - arm_schedulesigaction.c - arm_sigdeliver.c arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c arm_perf.c cp15_cacheops.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_schedulesigaction.c arm_sigdeliver.c) +endif() + if(CONFIG_ARCH_FPU) list(APPEND SRCS arm_fpucmp.c arm_fpuconfig.S) endif() diff --git a/arch/arm/src/armv8-r/Make.defs b/arch/arm/src/armv8-r/Make.defs index 8883d8e55f48c..e1086b8e78598 100644 --- a/arch/arm/src/armv8-r/Make.defs +++ b/arch/arm/src/armv8-r/Make.defs @@ -34,10 +34,13 @@ HEAD_ASRC += arm_vectortab.S CMN_CSRCS += arm_timer.c arm_cache.c arm_cpuinfo.c arm_dataabort.c CMN_CSRCS += arm_doirq.c arm_gicv3.c CMN_CSRCS += arm_initialstate.c arm_prefetchabort.c -CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c CMN_CSRCS += arm_syscall.c arm_tcbinfo.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c cp15_cacheops.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c +endif + # Common C source files CMN_ASRCS += arm_head.S arm_vectors.S arm_saveusercontext.S diff --git a/arch/arm/src/common/CMakeLists.txt b/arch/arm/src/common/CMakeLists.txt index 4f4a3eeb0ff7e..a47d071a59ec3 100644 --- a/arch/arm/src/common/CMakeLists.txt +++ b/arch/arm/src/common/CMakeLists.txt @@ -52,11 +52,14 @@ if(NOT CONFIG_ARCH_IDLE_CUSTOM) endif() if(CONFIG_BUILD_PROTECTED OR CONFIG_BUILD_KERNEL) - list(APPEND SRCS arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c) + list(APPEND SRCS arm_task_start.c arm_pthread_start.c) - if(CONFIG_BUILD_PROTECTED) - target_sources(arch_interface - PRIVATE ${ARCH_TOOLCHAIN_PATH}/arm_signal_handler.S) + if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm_signal_dispatch.c) + if(CONFIG_BUILD_PROTECTED) + target_sources(arch_interface + PRIVATE ${ARCH_TOOLCHAIN_PATH}/arm_signal_handler.S) + endif() endif() endif() diff --git a/arch/arm/src/common/Make.defs b/arch/arm/src/common/Make.defs index 7616bd472de28..bec209f47b643 100644 --- a/arch/arm/src/common/Make.defs +++ b/arch/arm/src/common/Make.defs @@ -40,9 +40,11 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED)$(CONFIG_BUILD_KERNEL),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c - CMN_CSRCS += arm_signal_dispatch.c - ifeq ($(CONFIG_BUILD_PROTECTED),y) - CMN_UASRCS += arm_signal_handler.S + ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) + CMN_CSRCS += arm_signal_dispatch.c + ifeq ($(CONFIG_BUILD_PROTECTED),y) + CMN_UASRCS += arm_signal_handler.S + endif endif endif diff --git a/arch/arm64/include/irq.h b/arch/arm64/include/irq.h index 773097ff06d07..91e4b8981ef5a 100644 --- a/arch/arm64/include/irq.h +++ b/arch/arm64/include/irq.h @@ -259,6 +259,7 @@ extern "C" struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS #ifdef CONFIG_BUILD_KERNEL /* This is the saved address to use when returning from a user-space * signal handler. @@ -267,16 +268,18 @@ struct xcptcontext uintptr_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* task stack reg context */ uint64_t *regs; #ifndef CONFIG_BUILD_FLAT uint64_t *initregs; #endif - +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* task context, for signal process */ uint64_t *saved_regs; +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ #ifdef CONFIG_ARCH_FPU uint64_t *fpu_regs; diff --git a/arch/arm64/src/common/CMakeLists.txt b/arch/arm64/src/common/CMakeLists.txt index 4a8c826755bd1..335cf602a48ce 100644 --- a/arch/arm64/src/common/CMakeLists.txt +++ b/arch/arm64/src/common/CMakeLists.txt @@ -32,7 +32,6 @@ list(APPEND SRCS arm64_initialize.c arm64_initialstate.c arm64_boot.c) list(APPEND SRCS arm64_nputs.c arm64_createstack.c) list(APPEND SRCS arm64_releasestack.c arm64_stackframe.c arm64_usestack.c) list(APPEND SRCS arm64_exit.c arm64_fork.c) -list(APPEND SRCS arm64_schedulesigaction.c arm64_sigdeliver.c) list(APPEND SRCS arm64_getintstack.c arm64_registerdump.c) list(APPEND SRCS arm64_perf.c arm64_tcbinfo.c) @@ -44,6 +43,10 @@ list(APPEND SRCS arm64_syscall.c) # Use common heap allocation for now (may need to be customized later) list(APPEND SRCS arm64_allocateheap.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm64_schedulesigaction.c arm64_sigdeliver.c) +endif() + if(NOT CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS arm64_idle.c) endif() @@ -89,8 +92,10 @@ if(CONFIG_SMP) endif() if(CONFIG_BUILD_KERNEL) - list(APPEND SRCS arm64_task_start.c arm64_pthread_start.c - arm64_signal_dispatch.c) + list(APPEND SRCS arm64_task_start.c arm64_pthread_start.c) + if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS arm64_signal_dispatch.c) + endif() endif() if(CONFIG_ARCH_KERNEL_STACK) diff --git a/arch/arm64/src/common/Make.defs b/arch/arm64/src/common/Make.defs index 2d8b1759e5557..7d202b9cd0dbb 100644 --- a/arch/arm64/src/common/Make.defs +++ b/arch/arm64/src/common/Make.defs @@ -39,7 +39,6 @@ CMN_CSRCS = arm64_initialize.c arm64_initialstate.c arm64_boot.c CMN_CSRCS += arm64_nputs.c arm64_createstack.c CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c CMN_CSRCS += arm64_exit.c arm64_fork.c -CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c CMN_CSRCS += arm64_perf.c arm64_tcbinfo.c @@ -50,6 +49,10 @@ CMN_CSRCS += arm64_syscall.c CMN_CSRCS += arm64_modifyreg8.c arm64_modifyreg16.c arm64_modifyreg32.c CMN_CSRCS += arm64_hwdebug.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c +endif + # Use common heap allocation for now (may need to be customized later) CMN_CSRCS += arm64_allocateheap.c diff --git a/arch/risc-v/include/irq.h b/arch/risc-v/include/irq.h index d25089b5da149..3dd83618d03e0 100644 --- a/arch/risc-v/include/irq.h +++ b/arch/risc-v/include/irq.h @@ -569,6 +569,7 @@ struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These additional register save locations are used to implement the * signal delivery trampoline. * @@ -587,6 +588,7 @@ struct xcptcontext uintptr_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ #ifdef CONFIG_ARCH_ADDRENV #ifdef CONFIG_ARCH_KERNEL_STACK diff --git a/arch/risc-v/src/common/CMakeLists.txt b/arch/risc-v/src/common/CMakeLists.txt index cb765c81fa8a1..0aa286423fc80 100644 --- a/arch/risc-v/src/common/CMakeLists.txt +++ b/arch/risc-v/src/common/CMakeLists.txt @@ -30,11 +30,14 @@ list(APPEND SRCS riscv_cpuinfo.c riscv_createstack.c riscv_doirq.c list(APPEND SRCS riscv_exit.c riscv_getintstack.c riscv_getnewintctx.c) list(APPEND SRCS riscv_initialize.c riscv_initialstate.c riscv_modifyreg32.c) list(APPEND SRCS riscv_nputs.c riscv_registerdump.c) -list(APPEND SRCS riscv_releasestack.c riscv_schedulesigaction.c - riscv_sigdeliver.c) +list(APPEND SRCS riscv_releasestack.c) list(APPEND SRCS riscv_stackframe.c riscv_tcbinfo.c riscv_swint.c) list(APPEND SRCS riscv_switchcontext.c riscv_usestack.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS riscv_schedulesigaction.c riscv_sigdeliver.c) +endif() + if(CONFIG_ONESHOT) list(APPEND SRCS riscv_mtimer.c) endif() diff --git a/arch/risc-v/src/common/Make.defs b/arch/risc-v/src/common/Make.defs index d39d6a7a3c9dd..6b657b05f1a30 100644 --- a/arch/risc-v/src/common/Make.defs +++ b/arch/risc-v/src/common/Make.defs @@ -32,10 +32,13 @@ CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_cpuinfo.c CMN_CSRCS += riscv_cpuidlestack.c riscv_doirq.c riscv_exit.c riscv_exception.c CMN_CSRCS += riscv_getnewintctx.c riscv_getintstack.c riscv_initialstate.c CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.c riscv_releasestack.c -CMN_CSRCS += riscv_registerdump.c riscv_stackframe.c riscv_schedulesigaction.c -CMN_CSRCS += riscv_sigdeliver.c riscv_switchcontext.c +CMN_CSRCS += riscv_registerdump.c riscv_stackframe.c riscv_switchcontext.c CMN_CSRCS += riscv_usestack.c riscv_tcbinfo.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += riscv_schedulesigaction.c riscv_sigdeliver.c +endif + ifeq ($(CONFIG_ONESHOT),y) CMN_CSRCS += riscv_mtimer.c endif diff --git a/arch/risc-v/src/common/riscv_exception_common.S b/arch/risc-v/src/common/riscv_exception_common.S index cae7250be2e6f..ec340bc96cd0b 100644 --- a/arch/risc-v/src/common/riscv_exception_common.S +++ b/arch/risc-v/src/common/riscv_exception_common.S @@ -239,7 +239,9 @@ handle_irq: REGSTORE s0, 0(sp) add s0, sp, (INT_REG_SIZE * 2) +#ifdef CONFIG_ENABLE_ALL_SIGNALS addi sp, sp, -XCPTCONTEXT_SIZE +#endif /* Call interrupt handler in C */ @@ -250,9 +252,10 @@ handle_irq: add sp, sp, (INT_REG_SIZE * 2) /* Restore sp */ - +#ifdef CONFIG_ENABLE_ALL_SIGNALS addi sp, sp, XCPTCONTEXT_SIZE #endif +#endif return_from_exception: diff --git a/arch/risc-v/src/common/riscv_signal_dispatch.c b/arch/risc-v/src/common/riscv_signal_dispatch.c index 80416c0694053..736cbeb4118b6 100644 --- a/arch/risc-v/src/common/riscv_signal_dispatch.c +++ b/arch/risc-v/src/common/riscv_signal_dispatch.c @@ -31,7 +31,7 @@ #include "riscv_internal.h" -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) +#ifdef __KERNEL__ /**************************************************************************** * Public Functions @@ -75,4 +75,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, (uintptr_t)info, (uintptr_t)ucontext); } -#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */ +#endif diff --git a/arch/tricore/include/tc3xx/irq.h b/arch/tricore/include/tc3xx/irq.h index d7b7b399540c4..a4e2bbc1bd7c8 100644 --- a/arch/tricore/include/tc3xx/irq.h +++ b/arch/tricore/include/tc3xx/irq.h @@ -118,12 +118,13 @@ #ifndef __ASSEMBLY__ struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of the context used during * signal processing. */ uintptr_t *saved_regs; - +#endif /* Register save area with XCPTCONTEXT_SIZE, only valid when: * 1.The task isn't running or * 2.The task is interrupted diff --git a/arch/tricore/src/common/CMakeLists.txt b/arch/tricore/src/common/CMakeLists.txt index 1183ed621e939..ada417765b5d2 100644 --- a/arch/tricore/src/common/CMakeLists.txt +++ b/arch/tricore/src/common/CMakeLists.txt @@ -36,8 +36,6 @@ set(SRCS tricore_registerdump.c tricore_releasestack.c tricore_saveusercontext.c - tricore_schedulesigaction.c - tricore_sigdeliver.c tricore_stackframe.c tricore_svcall.c tricore_switchcontext.c @@ -46,6 +44,10 @@ set(SRCS tricore_systimer.c tricore_usestack.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS tricore_schedulesigaction.c tricore_sigdeliver.c) +endif() + if(CONFIG_SPINLOCK) list(APPEND SRCS tricore_testset.c) endif() diff --git a/arch/tricore/src/common/Make.defs b/arch/tricore/src/common/Make.defs index c3e9c77dd30c2..256b31d004f73 100644 --- a/arch/tricore/src/common/Make.defs +++ b/arch/tricore/src/common/Make.defs @@ -37,8 +37,6 @@ CMN_CSRCS += tricore_nputs.c CMN_CSRCS += tricore_registerdump.c CMN_CSRCS += tricore_releasestack.c CMN_CSRCS += tricore_saveusercontext.c -CMN_CSRCS += tricore_schedulesigaction.c -CMN_CSRCS += tricore_sigdeliver.c CMN_CSRCS += tricore_stackframe.c CMN_CSRCS += tricore_svcall.c CMN_CSRCS += tricore_switchcontext.c @@ -47,6 +45,10 @@ CMN_CSRCS += tricore_trapcall.c CMN_CSRCS += tricore_systimer.c CMN_CSRCS += tricore_usestack.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += tricore_schedulesigaction.c tricore_sigdeliver.c +endif + ifeq ($(CONFIG_SPINLOCK),y) CMN_CSRCS += tricore_testset.c endif diff --git a/arch/x86/include/i486/irq.h b/arch/x86/include/i486/irq.h index a464d136991f0..20f76da9a196d 100644 --- a/arch/x86/include/i486/irq.h +++ b/arch/x86/include/i486/irq.h @@ -153,6 +153,7 @@ #ifndef __ASSEMBLY__ struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of instruction pointer and EFLAGS used during * signal processing. * @@ -164,7 +165,7 @@ struct xcptcontext uint32_t saved_eip; uint32_t saved_eflags; - +#endif /* Register save area */ uint32_t regs[XCPTCONTEXT_REGS]; diff --git a/arch/x86/src/qemu/Make.defs b/arch/x86/src/qemu/Make.defs index 893ad50af4b6e..034d5ca5bc8e9 100644 --- a/arch/x86/src/qemu/Make.defs +++ b/arch/x86/src/qemu/Make.defs @@ -34,8 +34,12 @@ CMN_CSRCS += x86_getintstack.c x86_initialize.c CMN_CSRCS += x86_modifyreg8.c x86_modifyreg16.c x86_modifyreg32.c CMN_CSRCS += x86_nputs.c x86_switchcontext.c x86_tcbinfo.c CMN_CSRCS += i486_irq.c i486_regdump.c i486_releasestack.c -CMN_CSRCS += i486_savestate.c i486_sigdeliver.c i486_stackframe.c -CMN_CSRCS += i486_schedulesigaction.c i486_usestack.c +CMN_CSRCS += i486_savestate.c i486_stackframe.c +CMN_CSRCS += i486_usestack.c + +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += i486_schedulesigaction.c i486_sigdeliver.c +endif # Required QEMU files diff --git a/arch/x86_64/include/intel64/irq.h b/arch/x86_64/include/intel64/irq.h index af852b141223e..a049bcc88c01c 100644 --- a/arch/x86_64/include/intel64/irq.h +++ b/arch/x86_64/include/intel64/irq.h @@ -520,6 +520,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS #ifdef CONFIG_BUILD_KERNEL /* This is the saved address to use when returning from a user-space * signal handler. @@ -544,6 +545,7 @@ struct xcptcontext uint64_t saved_ursp; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area - allocated from stack in up_initial_state() */ diff --git a/arch/x86_64/src/intel64/Make.defs b/arch/x86_64/src/intel64/Make.defs index 1dd6fea18f97c..041b66dd683d8 100644 --- a/arch/x86_64/src/intel64/Make.defs +++ b/arch/x86_64/src/intel64/Make.defs @@ -25,8 +25,8 @@ include common/Make.defs CMN_CSRCS += intel64_createstack.c intel64_initialstate.c intel64_irq.c CMN_CSRCS += intel64_map_region.c intel64_regdump.c intel64_releasestack.c CMN_CSRCS += intel64_rtc.c intel64_restore_auxstate.c -CMN_CSRCS += intel64_stackframe.c intel64_schedulesigaction.c -CMN_CSRCS += intel64_sigdeliver.c intel64_usestack.c x86_64_tcbinfo.c +CMN_CSRCS += intel64_stackframe.c +CMN_CSRCS += x86_64_tcbinfo.c CMN_CSRCS += intel64_systemreset.c intel64_freq.c intel64_cache.c # Required Intel64 files @@ -36,6 +36,10 @@ CHIP_CSRCS = intel64_start.c intel64_handlers.c intel64_idle.c intel64_lowsetup CHIP_CSRCS += intel64_serial.c intel64_rng.c intel64_check_capability.c CHIP_CSRCS += intel64_cpu.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += intel64_schedulesigaction.c intel64_sigdeliver.c +endif + ifeq ($(CONFIG_X86_64_UNWINDER_FRAME_POINTER),y) CMN_CSRCS += intel64_backtrace_fp.c endif diff --git a/arch/xtensa/include/irq.h b/arch/xtensa/include/irq.h index 5dc3e54b6cae9..edca0b5ebebb0 100644 --- a/arch/xtensa/include/irq.h +++ b/arch/xtensa/include/irq.h @@ -189,6 +189,7 @@ struct xcpt_syscall_s struct xcptcontext { +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* These are saved copies of registers used during signal processing. * * REVISIT: Because there is only one copy of these save areas, @@ -198,11 +199,12 @@ struct xcptcontext */ uint32_t *saved_regs; - +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ /* Register save area */ uint32_t *regs; +#ifdef CONFIG_ENABLE_ALL_SIGNALS #ifndef CONFIG_BUILD_FLAT /* This is the saved address to use when returning from a user-space * signal handler. @@ -210,6 +212,7 @@ struct xcptcontext uintptr_t sigreturn; #endif +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ #ifdef CONFIG_LIB_SYSCALL /* The following array holds the return address and the exc_return value diff --git a/arch/xtensa/src/common/CMakeLists.txt b/arch/xtensa/src/common/CMakeLists.txt index 089976c79e64f..8a474e4cf5400 100644 --- a/arch/xtensa/src/common/CMakeLists.txt +++ b/arch/xtensa/src/common/CMakeLists.txt @@ -69,14 +69,16 @@ list( xtensa_perf.c xtensa_releasestack.c xtensa_registerdump.c - xtensa_sigdeliver.c xtensa_swint.c xtensa_stackframe.c xtensa_saveusercontext.c - xtensa_schedsigaction.c xtensa_usestack.c xtensa_tcbinfo.c) +if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS xtensa_schedsigaction.c xtensa_sigdeliver.c) +endif() + # Configuration-dependent common Xtensa files if(CONFIG_ARCH_USE_TEXT_HEAP) diff --git a/arch/xtensa/src/common/Make.defs b/arch/xtensa/src/common/Make.defs index 7a6fe24ae9cce..93fb4a8b0d028 100644 --- a/arch/xtensa/src/common/Make.defs +++ b/arch/xtensa/src/common/Make.defs @@ -37,13 +37,17 @@ CMN_CSRCS += xtensa_getintstack.c xtensa_initialize.c xtensa_initialstate.c CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c CMN_CSRCS += xtensa_mpu.c xtensa_nputs.c xtensa_oneshot.c xtensa_perf.c -CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c +CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c -CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c +CMN_CSRCS += xtensa_saveusercontext.c CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c # Configuration-dependent common Xtensa files +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += xtensa_schedsigaction.c xtensa_sigdeliver.c +endif + ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y) CMN_ASRCS += xtensa_loadstore.S endif diff --git a/arch/z16/include/z16f/irq.h b/arch/z16/include/z16f/irq.h index f896f65034e61..9ebc90d50579e 100644 --- a/arch/z16/include/z16f/irq.h +++ b/arch/z16/include/z16f/irq.h @@ -167,6 +167,7 @@ struct xcptcontext uint16_t regs[XCPTCONTEXT_REGS]; +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* The following retains that state during signal execution. * * REVISIT: Because there is only one copy of these save areas, @@ -177,6 +178,7 @@ struct xcptcontext uint32_t saved_pc; /* Saved return address */ uint16_t saved_i; /* Saved interrupt state */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ }; #endif diff --git a/arch/z16/src/z16f/Make.defs b/arch/z16/src/z16f/Make.defs index 1563e48977c79..5533fe250065d 100644 --- a/arch/z16/src/z16f/Make.defs +++ b/arch/z16/src/z16f/Make.defs @@ -25,12 +25,16 @@ HEAD_SSRC = z16f_head.S CMN_CSRCS = z16_allocateheap.c z16_copystate.c z16_createstack.c z16_doirq.c CMN_CSRCS += z16_exit.c z16_initialstate.c z16_initialize.c z16_idle.c CMN_CSRCS += z16_nputs.c z16_registerdump.c z16_releasestack.c -CMN_CSRCS += z16_schedulesigaction.c z16_sigdeliver.c z16_switchcontext.c +CMN_CSRCS += z16_switchcontext.c CMN_CSRCS += z16_stackframe.c z16_usestack.c CHIP_SSRCS = z16f_lowuart.S z16f_saveusercontext.S z16f_restoreusercontext.S CHIP_CSRCS = z16f_clkinit.c z16f_sysexec.c z16f_irq.c z16f_serial.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += z16_schedulesigaction.c z16_sigdeliver.c +endif + ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += z16f_timerisr.c endif diff --git a/arch/z80/include/ez80/irq.h b/arch/z80/include/ez80/irq.h index 339eca4e10869..861cc98a91c78 100644 --- a/arch/z80/include/ez80/irq.h +++ b/arch/z80/include/ez80/irq.h @@ -248,6 +248,7 @@ struct xcptcontext chipreg_t regs[XCPTCONTEXT_REGS]; +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* The following retains that state during signal execution * * REVISIT: Because there is only one copy of these save areas, @@ -258,6 +259,7 @@ struct xcptcontext chipreg_t saved_pc; /* Saved return address */ chipreg_t saved_i; /* Saved interrupt state */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ }; #endif diff --git a/arch/z80/include/z180/irq.h b/arch/z80/include/z180/irq.h index 3afec6210724d..e121178ffe9a8 100644 --- a/arch/z80/include/z180/irq.h +++ b/arch/z80/include/z180/irq.h @@ -175,6 +175,7 @@ struct xcptcontext chipreg_t regs[XCPTCONTEXT_REGS]; +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* The following retains that state during signal execution * * REVISIT: Because there is only one copy of these save areas, @@ -185,6 +186,7 @@ struct xcptcontext uint16_t saved_pc; /* Saved return address */ uint16_t saved_i; /* Saved interrupt state */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ }; #endif diff --git a/arch/z80/include/z8/irq.h b/arch/z80/include/z8/irq.h index 37148633b8f51..454518d18bf8c 100644 --- a/arch/z80/include/z8/irq.h +++ b/arch/z80/include/z8/irq.h @@ -306,6 +306,7 @@ struct xcptcontext chipreg_t regs[XCPTCONTEXT_REGS]; +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* The following retains that state during signal execution * * REVISIT: Because there is only one copy of these save areas, @@ -316,6 +317,7 @@ struct xcptcontext uint16_t saved_pc; /* Saved return address */ uint16_t saved_irqctl; /* Saved interrupt state */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ }; #endif diff --git a/arch/z80/include/z80/irq.h b/arch/z80/include/z80/irq.h index 956b2d6461e5c..fcdc58a81eea4 100644 --- a/arch/z80/include/z80/irq.h +++ b/arch/z80/include/z80/irq.h @@ -90,6 +90,7 @@ struct xcptcontext chipreg_t regs[XCPTCONTEXT_REGS]; +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* The following retains that state during signal execution. * * REVISIT: Because there is only one copy of these save areas, @@ -100,6 +101,7 @@ struct xcptcontext uint16_t saved_pc; /* Saved return address */ uint16_t saved_i; /* Saved interrupt state */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ }; #endif diff --git a/arch/z80/src/ez80/Make.defs b/arch/z80/src/ez80/Make.defs index 61aa51c3c3caf..30adfacf377a7 100644 --- a/arch/z80/src/ez80/Make.defs +++ b/arch/z80/src/ez80/Make.defs @@ -55,9 +55,12 @@ CHIP_ASRCS += ez80_getsp.asm endif CHIP_CSRCS = ez80_clock.c ez80_initialstate.c ez80_irq.c ez80_copystate.c -CHIP_CSRCS += ez80_schedulesigaction.c ez80_sigdeliver.c CHIP_CSRCS += ez80_timerisr.c ez80_serial.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CHIP_CSRCS += ez80_schedulesigaction.c ez80_sigdeliver.c +endif + ifeq ($(CONFIG_ARCH_STACKDUMP),y) CHIP_CSRCS += ez80_registerdump.c endif diff --git a/arch/z80/src/z180/Make.defs b/arch/z80/src/z180/Make.defs index 61aab00c95d60..89e773ea03ffd 100644 --- a/arch/z80/src/z180/Make.defs +++ b/arch/z80/src/z180/Make.defs @@ -45,7 +45,11 @@ endif CHIP_CSRCS = z180_copystate.c z180_initialstate.c z180_io.c z180_irq.c CHIP_CSRCS += z180_lowscc.c z180_lowserial.c z180_modifiyreg8.c z180_mmu.c -CHIP_CSRCS += z180_registerdump.c z180_schedulesigaction.c z180_sigdeliver.c +CHIP_CSRCS += z180_registerdump.c + +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CHIP_CSRCS += z180_schedulesigaction.c z180_sigdeliver.c +endif ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += z180_timerisr.c diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs index 299b0b9a3e73d..4202496dd248a 100644 --- a/arch/z80/src/z8/Make.defs +++ b/arch/z80/src/z8/Make.defs @@ -30,9 +30,12 @@ CMN_CSRCS += z80_stackframe.c z80_usestack.c CHIP_SSRCS = z8_vector.S z8_saveusercontext.S z8_restorecontext.S CHIP_CSRCS = z8_initialstate.c z8_irq.c z8_saveirqcontext.c -CHIP_CSRCS += z8_schedulesigaction.c z8_sigdeliver.c CHIP_CSRCS += z8_serial.c z8_i2c.c z8_registerdump.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CMN_CSRCS += z8_schedulesigaction.c z8_sigdeliver.c +endif + ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += z8_timerisr.c endif diff --git a/arch/z80/src/z80/Make.defs b/arch/z80/src/z80/Make.defs index 0152299e47aad..fd31b350f65f6 100644 --- a/arch/z80/src/z80/Make.defs +++ b/arch/z80/src/z80/Make.defs @@ -37,5 +37,8 @@ CMN_CSRCS += z80_usestack.c CHIP_ASRCS = z80_saveusercontext.asm z80_restoreusercontext.asm CHIP_CSRCS = z80_initialstate.c z80_io.c z80_irq.c z80_copystate.c -CHIP_CSRCS += z80_schedulesigaction.c z80_sigdeliver.c CHIP_CSRCS += z80_registerdump.c + +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CHIP_CSRCS += z80_schedulesigaction.c z80_sigdeliver.c +endif diff --git a/drivers/syslog/syslog_write.c b/drivers/syslog/syslog_write.c index 889086c1b6672..8b3fefda709e8 100644 --- a/drivers/syslog/syslog_write.c +++ b/drivers/syslog/syslog_write.c @@ -56,8 +56,9 @@ static bool syslog_safe_to_block(void) { +#ifdef CONFIG_ENABLE_ALL_SIGNALS FAR const struct tcb_s *rtcb; - +#endif /* It's not safe to block in interrupts or when executing the idle loop */ if (up_interrupt_context() || sched_idletask()) @@ -67,11 +68,13 @@ static bool syslog_safe_to_block(void) /* It's not safe to block if a signal is being delivered */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS rtcb = nxsched_self(); if (rtcb->sigdeliver != NULL) { return false; } +#endif return true; } diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index 310bd63e5fb0b..a1a58fe1b5ab7 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -640,10 +640,11 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile, } /* Show the signal mask. Note: sigset_t is uint32_t on NuttX. */ - +#ifndef CONFIG_DISABLE_ALL_SIGNALS linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%-12s" SIGSET_FMT "\n", "SigMask:", SIGSET_ELEM(&tcb->sigprocmask)); +#endif copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset); diff --git a/fs/vfs/Kconfig b/fs/vfs/Kconfig index b84b08778b875..496b27261f603 100644 --- a/fs/vfs/Kconfig +++ b/fs/vfs/Kconfig @@ -51,6 +51,7 @@ endif # TIMER_FD config SIGNAL_FD bool "SignalFD" + depends on ENABLE_ALL_SIGNALS default n ---help--- Create a file descriptor for accepting signals diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 8657eb7a4577f..dde3c2257ab22 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -569,8 +569,9 @@ int up_backtrace(FAR struct tcb_s *tcb, * handler now. * ****************************************************************************/ - +#ifdef CONFIG_ENABLE_ALL_SIGNALS void up_schedule_sigaction(FAR struct tcb_s *tcb); +#endif /**************************************************************************** * Name: up_task_start @@ -662,7 +663,8 @@ void up_pthread_start(pthread_trampoline_t startup, * ****************************************************************************/ -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \ + defined(CONFIG_ENABLE_ALL_SIGNALS) void up_signal_dispatch(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext); #endif diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 8ee25f366f346..200efdc95bf84 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -515,11 +515,17 @@ struct task_group_s /* POSIX Signal Control Fields ********************************************/ +#ifndef CONFIG_DISABLE_ALL_SIGNALS + +#ifdef CONFIG_ENABLE_ALL_SIGNALS sq_queue_t tg_sigactionq; /* List of actions for signals */ sq_queue_t tg_sigpendingq; /* List of pending signals */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ + #ifdef CONFIG_SIG_DEFAULT sigset_t tg_sigdefault; /* Set of signals set to the default action */ #endif +#endif /* !CONFIG_DISABLE_ALL_SIGNALS */ #ifndef CONFIG_DISABLE_ENVIRON /* Environment variables **************************************************/ @@ -661,11 +667,22 @@ struct tcb_s /* POSIX Signal Control Fields ********************************************/ +#ifndef CONFIG_DISABLE_ALL_SIGNALS + sigset_t sigprocmask; /* Signals that are blocked */ sigset_t sigwaitmask; /* Waiting for pending signals */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS + + /* The following function pointer is non-zero if there are pending signals + * to be processed. + */ + + sig_deliver_t sigdeliver; sq_queue_t sigpendactionq; /* List of pending signal actions */ sq_queue_t sigpostedq; /* List of posted signals */ +#endif /* CONFIG_ENABLE_ALL_SIGNALS */ siginfo_t *sigunbinfo; /* Signal info when task unblocked */ +#endif /* !CONFIG_DISABLE_ALL_SIGNALS */ /* Robust mutex support ***************************************************/ @@ -708,11 +725,6 @@ struct tcb_s struct xcptcontext xcp; /* Interrupt register save area */ - /* The following function pointer is non-zero if there are pending signals - * to be processed. - */ - - sig_deliver_t sigdeliver; #if CONFIG_TASK_NAME_SIZE > 0 char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NUL terminator) */ #endif diff --git a/include/nuttx/userspace.h b/include/nuttx/userspace.h index 2166c89e680e8..98ecd35aca0fe 100644 --- a/include/nuttx/userspace.h +++ b/include/nuttx/userspace.h @@ -106,8 +106,10 @@ struct userspace_s /* Signal handler trampoline */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS CODE void (*signal_handler)(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext); +#endif /* User-space work queue support */ diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 63bfb57b1cd87..5753aa009b690 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -154,13 +154,17 @@ SYSCALL_LOOKUP(nxsem_wait_slow, 1) SYSCALL_LOOKUP(kill, 2) SYSCALL_LOOKUP(tgkill, 3) +#ifndef CONFIG_DISABLE_ALL_SIGNALS +#ifdef CONFIG_ENABLE_ALL_SIGNALS SYSCALL_LOOKUP(sigaction, 3) SYSCALL_LOOKUP(sigpending, 1) +#endif SYSCALL_LOOKUP(sigprocmask, 3) SYSCALL_LOOKUP(sigqueue, 3) SYSCALL_LOOKUP(sigsuspend, 1) SYSCALL_LOOKUP(sigtimedwait, 3) SYSCALL_LOOKUP(sigwaitinfo, 2) +#endif SYSCALL_LOOKUP(clock_nanosleep, 4) /* The following are only defined if the system clock is enabled in the diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv index 8aaf50630f59a..c3c0551521a8d 100644 --- a/libs/libc/libc.csv +++ b/libs/libc/libc.csv @@ -274,7 +274,7 @@ "sigemptyset","signal.h","","int","FAR sigset_t *" "sigfillset","signal.h","","int","FAR sigset_t *" "sigismember","signal.h","","int","FAR const sigset_t *","int" -"signal","signal.h","","_sa_handler_t","int","_sa_handler_t" +"signal","signal.h","defined(CONFIG_ENABLE_ALL_SIGNALS)","_sa_handler_t","int","_sa_handler_t" "sleep","unistd.h","","unsigned int","unsigned int" "snprintf","stdio.h","","int","FAR char *","size_t","FAR const IPTR char *","..." "sprintf","stdio.h","","int","FAR char *","FAR const IPTR char *","..." diff --git a/libs/libc/signal/CMakeLists.txt b/libs/libc/signal/CMakeLists.txt index 00ccefdda7a9f..4e1c7d8cc4bb6 100644 --- a/libs/libc/signal/CMakeLists.txt +++ b/libs/libc/signal/CMakeLists.txt @@ -20,27 +20,30 @@ # # ############################################################################## -target_sources( - c - PRIVATE sig_addset.c - sig_delset.c - sig_emptyset.c - sig_fillset.c - sig_nandset.c - sig_andset.c - sig_orset.c - sig_xorset.c - sig_isemptyset.c - sig_killpg.c - sig_altstack.c - sig_interrupt.c - sig_hold.c - sig_ignore.c - sig_ismember.c - sig_pause.c - sig_psignal.c - sig_raise.c - sig_relse.c - sig_set.c - sig_signal.c - sig_wait.c) +if(NOT CONFIG_DISABLE_ALL_SIGNALS) + set(SRCS + sig_addset.c + sig_delset.c + sig_emptyset.c + sig_fillset.c + sig_nandset.c + sig_andset.c + sig_orset.c + sig_xorset.c + sig_isemptyset.c + sig_killpg.c + sig_altstack.c + sig_hold.c + sig_ismember.c + sig_pause.c + sig_psignal.c + sig_raise.c + sig_relse.c + sig_wait.c) + + if(CONFIG_ENABLE_ALL_SIGNALS) + list(APPEND SRCS sig_ignore.c sig_interrupt.c sig_set.c sig_signal.c) + endif() + + target_sources(c PRIVATE ${SRCS}) +endif() diff --git a/libs/libc/signal/Make.defs b/libs/libc/signal/Make.defs index 7d42a239add7b..9a7964d56903b 100644 --- a/libs/libc/signal/Make.defs +++ b/libs/libc/signal/Make.defs @@ -22,13 +22,19 @@ # Add the signal C files to the build +ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y) CSRCS += sig_addset.c sig_delset.c sig_emptyset.c sig_fillset.c CSRCS += sig_nandset.c sig_andset.c sig_orset.c sig_xorset.c -CSRCS += sig_isemptyset.c sig_killpg.c sig_altstack.c sig_interrupt.c -CSRCS += sig_hold.c sig_ignore.c sig_ismember.c sig_pause.c sig_psignal.c -CSRCS += sig_raise.c sig_relse.c sig_set.c sig_signal.c sig_wait.c +CSRCS += sig_isemptyset.c sig_killpg.c sig_altstack.c +CSRCS += sig_hold.c sig_ismember.c sig_pause.c sig_psignal.c +CSRCS += sig_raise.c sig_relse.c sig_wait.c + +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CSRCS += sig_ignore.c sig_interrupt.c sig_set.c sig_signal.c +endif # Add the signal directory to the build DEPPATH += --dep-path signal VPATH += :signal +endif diff --git a/sched/Kconfig b/sched/Kconfig index 5370be5e5fa1d..e40fd9f717ffc 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -15,6 +15,53 @@ menuconfig DISABLE_OS_API if DISABLE_OS_API +choice + prompt "Signal support level" + default ENABLE_ALL_SIGNALS if !DEFAULT_SMALL + default ENABLE_PARTIAL_SIGNALS if DEFAULT_SMALL + +config ENABLE_ALL_SIGNALS + bool "Enable full signal support" + ---help--- + Enable full POSIX signal support, including signal handling, + thread cancellation, timers, and process-related notifications. + + This option provides the most complete signal functionality, + but increases code size and resource usage. + + Typical use cases: + - Applications relying on POSIX signals or timers + - Systems where memory and CPU resources are sufficient + +config ENABLE_PARTIAL_SIGNALS + bool "Enable partial signal support" + ---help--- + Disable process-related signal functionality while keeping + basic signal handling support. + + This option provides a balance between reduced resource usage + and limited signal functionality. + + Typical use cases: + - Applications using basic signals without fork/exec + - Resource-constrained real-time systems + +config DISABLE_ALL_SIGNALS + bool "Disable all signal support" + ---help--- + Disable all signal-related functionality, including signal + handling, thread cancellation, timers, and process-related + notifications. + + This option provides the smallest footprint and maximum + resource savings. + + Typical use cases: + - Hard real-time or safety-critical systems + - Applications that do not use POSIX signals or timers + +endchoice + config DISABLE_POSIX_TIMERS bool "Disable POSIX timers" default DEFAULT_SMALL @@ -1563,6 +1610,7 @@ endif # BOARD_LATE_INITIALIZE endmenu # RTOS hooks menu "Signal Configuration" + depends on !DISABLE_ALL_SIGNALS config SIG_PREALLOC_ACTIONS int "Number of pre-allocated sigactions" diff --git a/sched/group/CMakeLists.txt b/sched/group/CMakeLists.txt index cec78f235132f..6211a2c7c66ab 100644 --- a/sched/group/CMakeLists.txt +++ b/sched/group/CMakeLists.txt @@ -27,8 +27,11 @@ set(SRCS group_setupidlefiles.c group_setuptaskfiles.c group_foreachchild.c - group_killchildren.c - group_signal.c) + group_killchildren.c) + +if(NOT CONFIG_DISABLE_ALL_SIGNALS) + list(APPEND SRCS group_signal.c) +endif() if(CONFIG_SCHED_HAVE_PARENT) if(CONFIG_SCHED_CHILD_STATUS) diff --git a/sched/group/Make.defs b/sched/group/Make.defs index 61f0a03ec9a21..336beda8f211b 100644 --- a/sched/group/Make.defs +++ b/sched/group/Make.defs @@ -22,7 +22,11 @@ CSRCS += group_create.c group_join.c group_leave.c CSRCS += group_setupidlefiles.c group_setuptaskfiles.c -CSRCS += group_foreachchild.c group_killchildren.c group_signal.c +CSRCS += group_foreachchild.c group_killchildren.c + +ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y) +CSRCS += group_signal.c +endif ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) ifeq ($(CONFIG_SCHED_CHILD_STATUS),y) diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c index 5e69dc2d3499a..4ba91b1af97cc 100644 --- a/sched/group/group_leave.c +++ b/sched/group/group_leave.c @@ -86,7 +86,9 @@ static inline void group_release(FAR struct task_group_s *group) /* Release pending signals */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS nxsig_release(group); +#endif #ifndef CONFIG_DISABLE_PTHREAD /* Release pthread resources */ diff --git a/sched/group/group_signal.c b/sched/group/group_signal.c index a15b364ae862f..f3c734b47a0f1 100644 --- a/sched/group/group_signal.c +++ b/sched/group/group_signal.c @@ -77,7 +77,9 @@ static int group_signal_handler(pid_t pid, FAR void *arg) { FAR struct group_signal_s *info = (FAR struct group_signal_s *)arg; FAR struct tcb_s *tcb; +#ifdef CONFIG_ENABLE_ALL_SIGNALS FAR sigactq_t *sigact; +#endif int ret; /* Get the TCB associated with the group member */ @@ -141,6 +143,7 @@ static int group_signal_handler(pid_t pid, FAR void *arg) /* Is there also a action associated with the task group? */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS sigact = nxsig_find_action(tcb->group, info->siginfo->si_signo); if (sigact) { @@ -164,6 +167,7 @@ static int group_signal_handler(pid_t pid, FAR void *arg) return 1; /* Terminate the search */ } } +#endif } return 0; /* Keep searching */ diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index be28b4565ca21..1c7b931b05072 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -644,7 +644,9 @@ void nx_start(void) /* Initialize the signal facility (if in link) */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS nxsig_initialize(); +#endif #if !defined(CONFIG_DISABLE_MQUEUE) || !defined(CONFIG_DISABLE_MQUEUE_SYSV) /* Initialize the named message queue facility (if in link) */ diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 0c89d62a7dfe6..e541f05d9d9d6 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -405,7 +405,9 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg) #endif " %3d %-8s %-7s %-3c" " %-18s" +#ifndef CONFIG_DISABLE_ALL_SIGNALS " " SIGSET_FMT +#endif " %p" " %7zu" #ifdef CONFIG_STACK_COLORATION @@ -427,7 +429,9 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg) >> TCB_FLAG_TTYPE_SHIFT] , tcb->flags & TCB_FLAG_EXIT_PROCESSING ? 'P' : '-' , state +#ifndef CONFIG_DISABLE_ALL_SIGNALS , SIGSET_ELEM(&tcb->sigprocmask) +#endif , tcb->stack_base_ptr , tcb->adj_stack_size #ifdef CONFIG_STACK_COLORATION diff --git a/sched/signal/CMakeLists.txt b/sched/signal/CMakeLists.txt index 715db0a776baa..e24c5e664368f 100644 --- a/sched/signal/CMakeLists.txt +++ b/sched/signal/CMakeLists.txt @@ -20,37 +20,45 @@ # # ############################################################################## -set(SRCS - sig_initialize.c - sig_action.c - sig_procmask.c - sig_pending.c - sig_suspend.c - sig_kill.c - sig_tgkill.c - sig_queue.c - sig_waitinfo.c - sig_timedwait.c - sig_findaction.c - sig_allocpendingsigaction.c - sig_releasependingsigaction.c - sig_unmaskpendingsignal.c - sig_removependingsignal.c - sig_releasependingsignal.c - sig_lowest.c - sig_notification.c - sig_cleanup.c - sig_dispatch.c - sig_deliver.c - sig_pause.c - sig_nanosleep.c - sig_usleep.c - sig_sleep.c - sig_ppoll.c - sig_pselect.c) +if(NOT CONFIG_DISABLE_ALL_SIGNALS) + set(SRCS + sig_procmask.c + sig_suspend.c + sig_kill.c + sig_tgkill.c + sig_queue.c + sig_waitinfo.c + sig_timedwait.c + sig_lowest.c + sig_notification.c + sig_dispatch.c + sig_pause.c + sig_nanosleep.c + sig_usleep.c + sig_sleep.c + sig_ppoll.c + sig_pselect.c) -if(CONFIG_SIG_DEFAULT) - list(APPEND SRCS sig_default.c) -endif() + if(CONFIG_ENABLE_ALL_SIGNALS) + list( + APPEND + SRCS + sig_action.c + sig_allocpendingsigaction.c + sig_cleanup.c + sig_deliver.c + sig_findaction.c + sig_initialize.c + sig_pending.c + sig_releasependingsigaction.c + sig_releasependingsignal.c + sig_removependingsignal.c + sig_unmaskpendingsignal.c) + endif() + + if(CONFIG_SIG_DEFAULT) + list(APPEND SRCS sig_default.c) + endif() -target_sources(sched PRIVATE ${SRCS}) + target_sources(sched PRIVATE ${SRCS}) +endif() diff --git a/sched/signal/Make.defs b/sched/signal/Make.defs index cfb2ddc006080..72aa3eade135c 100644 --- a/sched/signal/Make.defs +++ b/sched/signal/Make.defs @@ -19,16 +19,17 @@ # under the License. # ############################################################################ +ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y) +CSRCS += sig_dispatch.c sig_kill.c sig_lowest.c sig_nanosleep.c +CSRCS += sig_notification.c sig_pause.c sig_ppoll.c sig_procmask.c +CSRCS += sig_pselect.c sig_queue.c sig_sleep.c sig_suspend.c sig_tgkill.c +CSRCS += sig_timedwait.c sig_usleep.c sig_waitinfo.c -CSRCS += sig_initialize.c -CSRCS += sig_action.c sig_procmask.c sig_pending.c sig_suspend.c -CSRCS += sig_kill.c sig_tgkill.c sig_queue.c sig_waitinfo.c sig_timedwait.c -CSRCS += sig_findaction.c sig_allocpendingsigaction.c -CSRCS += sig_releasependingsigaction.c sig_unmaskpendingsignal.c -CSRCS += sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c -CSRCS += sig_notification.c sig_cleanup.c sig_dispatch.c sig_deliver.c -CSRCS += sig_pause.c sig_nanosleep.c sig_usleep.c sig_sleep.c -CSRCS += sig_ppoll.c sig_pselect.c +ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) +CSRCS += sig_action.c sig_allocpendingsigaction.c sig_cleanup.c sig_deliver.c +CSRCS += sig_findaction.c sig_initialize.c sig_pending.c sig_releasependingsigaction.c +CSRCS += sig_releasependingsignal.c sig_removependingsignal.c sig_unmaskpendingsignal.c +endif ifeq ($(CONFIG_SIG_DEFAULT),y) CSRCS += sig_default.c @@ -38,3 +39,4 @@ endif DEPPATH += --dep-path signal VPATH += :signal +endif \ No newline at end of file diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 723799c17df14..142324c300616 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -50,6 +50,7 @@ * Private Types ****************************************************************************/ +#ifdef CONFIG_ENABLE_ALL_SIGNALS struct sig_arg_s { pid_t pid; @@ -428,6 +429,7 @@ static int nxsig_alloc_dyn_pending(FAR irqstate_t *flags) return ret; } +#endif /**************************************************************************** * Public Functions @@ -459,11 +461,13 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, bool group_dispatch) { FAR struct tcb_s *rtcb = this_task(); - FAR sigactq_t *sigact; irqstate_t flags; int masked; int ret = OK; +#ifdef CONFIG_ENABLE_ALL_SIGNALS + FAR sigactq_t *sigact; FAR sigpendq_t *sigpend = NULL; +#endif sinfo("TCB=%p pid=%d signo=%d code=%d value=%d masked=%s\n", stcb, stcb->pid, info->si_signo, info->si_code, @@ -488,10 +492,6 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, /************************** MASKED SIGNAL ACTIONS *************************/ - /* Find if there is a group sigaction associated with this signal */ - - sigact = nxsig_find_action(stcb->group, info->si_signo); - flags = enter_critical_section(); /* Make sure that there is always at least one sigpednq and sigq structure @@ -500,12 +500,14 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, * needs to be done here before using the task state or sigprocmask. */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS ret = nxsig_alloc_dyn_pending(&flags); if (ret < 0) { leave_critical_section(flags); return ret; } +#endif masked = nxsig_ismember(&stcb->sigprocmask, info->si_signo); @@ -573,16 +575,19 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, up_switch_context(this_task(), rtcb); } -#ifdef CONFIG_LIB_SYSCALL +#ifdef CONFIG_ENABLE_ALL_SIGNALS +# ifdef CONFIG_LIB_SYSCALL /* Must also add signal action if in system call */ if (masked == 0) { sigpend = nxsig_add_pendingsignal(stcb, info, group_dispatch); } +# endif #endif } +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* Its not one we are waiting for... Add it to the list of pending * signals. */ @@ -591,16 +596,22 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, { sigpend = nxsig_add_pendingsignal(stcb, info, group_dispatch); } +#endif } /************************* UNMASKED SIGNAL ACTIONS ************************/ else { +#ifdef CONFIG_ENABLE_ALL_SIGNALS + /* Find if there is a group sigaction associated with this signal */ + + sigact = nxsig_find_action(stcb->group, info->si_signo); + /* Queue any sigaction's requested by this task. */ ret = nxsig_queue_action(stcb, sigact, info); - +#endif /* Deliver of the signal must be performed in a critical section */ /* Check if the task is waiting for an unmasked signal. If so, then @@ -697,6 +708,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, leave_critical_section(flags); +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* Dispatch kernel action, if needed, in case a pending signal was added */ if (sigpend != NULL) @@ -704,6 +716,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info, nxsig_dispatch_kernel_action(stcb, &sigpend->info); } +#endif /* In case nxsig_ismember failed due to an invalid signal number */ if (masked < 0) diff --git a/sched/signal/sig_procmask.c b/sched/signal/sig_procmask.c index b9a180170cf98..1428877e0865b 100644 --- a/sched/signal/sig_procmask.c +++ b/sched/signal/sig_procmask.c @@ -145,7 +145,9 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR sigset_t *oset) /* Now, process any pending signals that were just unmasked */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS nxsig_unmask_pendingsignal(); +#endif } return ret; diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 096bae1cbaf71..02a8b1131aeb4 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -334,8 +334,10 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, FAR const struct timespec *timeout) { FAR struct tcb_s *rtcb; +#ifdef CONFIG_ENABLE_ALL_SIGNALS sigset_t intersection; FAR sigpendq_t *sigpend; +#endif irqstate_t flags; siginfo_t unbinfo; int ret; @@ -351,6 +353,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, flags = enter_critical_section(); rtcb = this_task(); +#ifdef CONFIG_ENABLE_ALL_SIGNALS /* Check if there is a pending signal corresponding to one of the * signals in the pending signal set argument. */ @@ -387,6 +390,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, /* We will have to wait for a signal to be posted to this task. */ else +#endif { rtcb->sigunbinfo = (info == NULL) ? &unbinfo : info; diff --git a/sched/signal/signal.h b/sched/signal/signal.h index 28fe4a9d02b66..e1cc3f1e3b6d6 100644 --- a/sched/signal/signal.h +++ b/sched/signal/signal.h @@ -120,7 +120,9 @@ typedef struct sigq_s sigq_t; * structures buffers structures. */ +#ifndef CONFIG_DISABLE_ALL_SIGNALS extern sigactq_t g_sigactions[CONFIG_SIG_PREALLOC_ACTIONS]; +#endif /* The g_sigfreeaction data structure is a list of available signal action * structures. @@ -164,7 +166,9 @@ struct task_group_s; /* sig_initializee.c */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS void nxsig_initialize(void); +#endif /* sig_action.c */ @@ -190,8 +194,10 @@ int nxsig_dispatch(pid_t pid, FAR siginfo_t *info, /* sig_cleanup.c */ +#ifdef CONFIG_ENABLE_ALL_SIGNALS void nxsig_cleanup(FAR struct tcb_s *stcb); void nxsig_release(FAR struct task_group_s *group); +#endif /* sig_timedwait.c */ @@ -209,6 +215,9 @@ void nxsig_release_pendingsigaction(FAR sigq_t *sigq); void nxsig_release_pendingsignal(FAR sigpendq_t *sigpend); FAR sigpendq_t *nxsig_remove_pendingsignal(FAR struct tcb_s *stcb, int signo); + +#ifdef CONFIG_ENABLE_ALL_SIGNALS bool nxsig_unmask_pendingsignal(void); +#endif #endif /* __SCHED_SIGNAL_SIGNAL_H */ diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 268931b247df1..9e5d28fd303d9 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -454,8 +454,9 @@ void nxtask_exithook(FAR struct tcb_s *tcb, int status) group_leave(tcb); /* Deallocate anything left in the TCB's queues */ - +#ifdef CONFIG_ENABLE_ALL_SIGNALS nxsig_cleanup(tcb); /* Deallocate Signal lists */ +#endif #ifdef CONFIG_SCHED_DUMP_LEAK if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) diff --git a/sched/task/task_restart.c b/sched/task/task_restart.c index 07566a3d99e93..8040450d4a204 100644 --- a/sched/task/task_restart.c +++ b/sched/task/task_restart.c @@ -119,8 +119,12 @@ static void nxtask_reset_task(FAR struct tcb_s *tcb, bool remove) /* Deallocate anything left in the TCB's signal queues */ +#ifndef CONFIG_DISABLE_ALL_SIGNALS +# ifdef CONFIG_ENABLE_ALL_SIGNALS nxsig_cleanup(tcb); /* Deallocate Signal lists */ +# endif sigemptyset(&tcb->sigprocmask); /* Reset sigprocmask */ +#endif /* Reset the current task priority */ diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index c226bdbc27db1..f06f258a6b826 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -460,8 +460,9 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority, /* exec(), pthread_create(), task_create(), and vfork() all * inherit the signal mask of the parent thread. */ - +#ifndef CONFIG_DISABLE_ALL_SIGNALS tcb->sigprocmask = rtcb->sigprocmask; +#endif /* Initialize the task state. It does not get a valid state * until it is activated. diff --git a/sched/task/task_spawnparms.c b/sched/task/task_spawnparms.c index 7022b5d5767bf..b79fc460198f3 100644 --- a/sched/task/task_spawnparms.c +++ b/sched/task/task_spawnparms.c @@ -157,6 +157,7 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) /* Firstly, set the signal mask if requested to do so */ +#ifndef CONFIG_DISABLE_ALL_SIGNALS if ((attr->flags & POSIX_SPAWN_SETSIGMASK) != 0) { FAR struct tcb_s *tcb = nxsched_get_tcb(pid); @@ -165,6 +166,7 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr) tcb->sigprocmask = attr->sigmask; } } +#endif /* If we are only setting the priority, then call sched_setparm() * to set the priority of the of the new task. diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 2e3444c1322fa..f13ace9f1a783 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -172,10 +172,10 @@ "shmdt","sys/shm.h","defined(CONFIG_MM_SHM)","int","FAR const void *" "shmget","sys/shm.h","defined(CONFIG_MM_SHM)","int","key_t","size_t","int" "shutdown","sys/socket.h","defined(CONFIG_NET)","int","int","int" -"sigaction","signal.h","","int","int","FAR const struct sigaction *","FAR struct sigaction *" -"signal","signal.h","","_sa_handler_t","int","_sa_handler_t" +"sigaction","signal.h","defined(CONFIG_ENABLE_ALL_SIGNALS)","int","int","FAR const struct sigaction *","FAR struct sigaction *" +"signal","signal.h","defined(CONFIG_ENABLE_ALL_SIGNALS)","_sa_handler_t","int","_sa_handler_t" "signalfd","sys/signalfd.h","defined(CONFIG_SIGNAL_FD)","int","int","FAR const sigset_t *","int" -"sigpending","signal.h","","int","FAR sigset_t *" +"sigpending","signal.h","defined(CONFIG_ENABLE_ALL_SIGNALS)","int","FAR sigset_t *" "sigprocmask","signal.h","","int","int","FAR const sigset_t *","FAR sigset_t *" "sigqueue","signal.h","","int","int","int","union sigval|FAR void *|sival_ptr" "sigsuspend","signal.h","","int","FAR const sigset_t *"