diff --git a/arch/arm/src/arm/arm_sigdeliver.c b/arch/arm/src/arm/arm_sigdeliver.c index 983d1de6246..7c51c14209b 100644 --- a/arch/arm/src/arm/arm_sigdeliver.c +++ b/arch/arm/src/arm/arm_sigdeliver.c @@ -57,13 +57,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -93,7 +86,6 @@ void arm_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/arm/src/armv6-m/arm_sigdeliver.c b/arch/arm/src/armv6-m/arm_sigdeliver.c index 53178409342..b5049c7fdec 100644 --- a/arch/arm/src/armv6-m/arm_sigdeliver.c +++ b/arch/arm/src/armv6-m/arm_sigdeliver.c @@ -62,13 +62,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS + 4]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -146,10 +139,6 @@ void arm_sigdeliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/arm/src/armv7-a/arm_sigdeliver.c b/arch/arm/src/armv7-a/arm_sigdeliver.c index 374170b62ce..9f1684cb7a5 100644 --- a/arch/arm/src/armv7-a/arm_sigdeliver.c +++ b/arch/arm/src/armv7-a/arm_sigdeliver.c @@ -57,13 +57,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -141,10 +134,6 @@ void arm_sigdeliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/arm/src/armv7-m/arm_sigdeliver.c b/arch/arm/src/armv7-m/arm_sigdeliver.c index ad1574b76b3..e371224dd04 100644 --- a/arch/arm/src/armv7-m/arm_sigdeliver.c +++ b/arch/arm/src/armv7-m/arm_sigdeliver.c @@ -57,13 +57,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -145,10 +138,6 @@ void arm_sigdeliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/arm/src/armv7-r/arm_sigdeliver.c b/arch/arm/src/armv7-r/arm_sigdeliver.c index bee9a5590aa..558278e60c0 100644 --- a/arch/arm/src/armv7-r/arm_sigdeliver.c +++ b/arch/arm/src/armv7-r/arm_sigdeliver.c @@ -57,13 +57,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -93,7 +86,6 @@ void arm_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/arm/src/armv8-m/arm_sigdeliver.c b/arch/arm/src/armv8-m/arm_sigdeliver.c index 2e578556087..2d86b685964 100644 --- a/arch/arm/src/armv8-m/arm_sigdeliver.c +++ b/arch/arm/src/armv8-m/arm_sigdeliver.c @@ -57,13 +57,6 @@ void arm_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -145,10 +138,6 @@ void arm_sigdeliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/avr/src/avr/up_sigdeliver.c b/arch/avr/src/avr/up_sigdeliver.c index 1e9a327c224..9d34f3c4ccb 100644 --- a/arch/avr/src/avr/up_sigdeliver.c +++ b/arch/avr/src/avr/up_sigdeliver.c @@ -57,13 +57,6 @@ void up_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint8_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -93,7 +86,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/avr/src/avr32/up_sigdeliver.c b/arch/avr/src/avr32/up_sigdeliver.c index 78863c55471..38bba235161 100644 --- a/arch/avr/src/avr32/up_sigdeliver.c +++ b/arch/avr/src/avr32/up_sigdeliver.c @@ -61,13 +61,6 @@ void up_sigdeliver(void) uint32_t regs[XCPTCONTEXT_REGS]; #endif - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -97,7 +90,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/mips/src/mips32/mips_sigdeliver.c b/arch/mips/src/mips32/mips_sigdeliver.c index 4bd28e91637..f0f0234ebdf 100644 --- a/arch/mips/src/mips32/mips_sigdeliver.c +++ b/arch/mips/src/mips32/mips_sigdeliver.c @@ -59,13 +59,6 @@ void up_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -97,7 +90,6 @@ void up_sigdeliver(void) regs[REG_EPC], regs[REG_STATUS]); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/misoc/src/lm32/lm32_sigdeliver.c b/arch/misoc/src/lm32/lm32_sigdeliver.c index 558425fe99a..4adc8495590 100644 --- a/arch/misoc/src/lm32/lm32_sigdeliver.c +++ b/arch/misoc/src/lm32/lm32_sigdeliver.c @@ -57,13 +57,6 @@ void lm32_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -95,7 +88,6 @@ void lm32_sigdeliver(void) regs[REG_EPC], regs[REG_INT_CTX]); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/misoc/src/minerva/minerva_sigdeliver.c b/arch/misoc/src/minerva/minerva_sigdeliver.c index 4b3f1e967ea..ac2603f5046 100644 --- a/arch/misoc/src/minerva/minerva_sigdeliver.c +++ b/arch/misoc/src/minerva/minerva_sigdeliver.c @@ -59,13 +59,6 @@ void minerva_sigdeliver(void) uint32_t regs[XCPTCONTEXT_REGS]; sig_deliver_t sigdeliver; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -107,7 +100,6 @@ void minerva_sigdeliver(void) regs[REG_CSR_MSTATUS]); up_irq_save(); - set_errno(saved_errno); /* Then restore the correct state for this thread of execution. */ diff --git a/arch/renesas/src/m16c/m16c_sigdeliver.c b/arch/renesas/src/m16c/m16c_sigdeliver.c index 561261ca89e..8c51c39bf10 100644 --- a/arch/renesas/src/m16c/m16c_sigdeliver.c +++ b/arch/renesas/src/m16c/m16c_sigdeliver.c @@ -56,13 +56,6 @@ void up_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint8_t regs[XCPTCONTEXT_SIZE]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -92,7 +85,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/renesas/src/rx65n/rx65n_sigdeliver.c b/arch/renesas/src/rx65n/rx65n_sigdeliver.c index 1c405f7720d..8984e14ba73 100644 --- a/arch/renesas/src/rx65n/rx65n_sigdeliver.c +++ b/arch/renesas/src/rx65n/rx65n_sigdeliver.c @@ -57,13 +57,6 @@ void up_sigdeliver(void) uint32_t regs[XCPTCONTEXT_REGS]; sig_deliver_t sigdeliver; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -104,7 +97,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Then restore the correct state for this thread of * execution. diff --git a/arch/renesas/src/sh1/sh1_sigdeliver.c b/arch/renesas/src/sh1/sh1_sigdeliver.c index 584157325c2..b9547818b42 100644 --- a/arch/renesas/src/sh1/sh1_sigdeliver.c +++ b/arch/renesas/src/sh1/sh1_sigdeliver.c @@ -56,13 +56,6 @@ void up_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -92,7 +85,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/risc-v/src/rv32im/riscv_sigdeliver.c b/arch/risc-v/src/rv32im/riscv_sigdeliver.c index 62438bccd59..ae64cd68044 100644 --- a/arch/risc-v/src/rv32im/riscv_sigdeliver.c +++ b/arch/risc-v/src/rv32im/riscv_sigdeliver.c @@ -59,13 +59,6 @@ void riscv_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -97,7 +90,6 @@ void riscv_sigdeliver(void) regs[REG_EPC], regs[REG_INT_CTX]); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/risc-v/src/rv64gc/riscv_sigdeliver.c b/arch/risc-v/src/rv64gc/riscv_sigdeliver.c index a9d94e8c94d..43a33b60e90 100644 --- a/arch/risc-v/src/rv64gc/riscv_sigdeliver.c +++ b/arch/risc-v/src/rv64gc/riscv_sigdeliver.c @@ -59,13 +59,6 @@ void riscv_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint64_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -141,10 +134,6 @@ void riscv_sigdeliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/sim/src/sim/up_sigdeliver.c b/arch/sim/src/sim/up_sigdeliver.c index efb15549ad2..738a45f5fc9 100644 --- a/arch/sim/src/sim/up_sigdeliver.c +++ b/arch/sim/src/sim/up_sigdeliver.c @@ -66,13 +66,6 @@ void sim_sigdeliver(void) irqstate_t flags = enter_critical_section(); #endif - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -134,10 +127,6 @@ void sim_sigdeliver(void) } #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Allows next handler to be scheduled */ rtcb->xcp.sigdeliver = NULL; diff --git a/arch/x86/src/i486/up_sigdeliver.c b/arch/x86/src/i486/up_sigdeliver.c index 05a74327e83..0f4971b10ac 100644 --- a/arch/x86/src/i486/up_sigdeliver.c +++ b/arch/x86/src/i486/up_sigdeliver.c @@ -57,13 +57,6 @@ void up_sigdeliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -93,7 +86,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/x86_64/src/intel64/up_sigdeliver.c b/arch/x86_64/src/intel64/up_sigdeliver.c index fa3d6c39290..aa712db9c41 100644 --- a/arch/x86_64/src/intel64/up_sigdeliver.c +++ b/arch/x86_64/src/intel64/up_sigdeliver.c @@ -63,13 +63,6 @@ void up_sigdeliver(void) regs = (uint64_t *)(((uint64_t)(regs_area) + 15) & (~(uint64_t)15)); - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - /* Save the real return state on the stack ASAP before any chance we went * sleeping and break the register profile. We entered this function with * interrupt disabled, therefore we don't have to worried being preempted @@ -109,7 +102,6 @@ void up_sigdeliver(void) sinfo("Resuming\n"); (void)up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/xtensa/src/common/xtensa_sigdeliver.c b/arch/xtensa/src/common/xtensa_sigdeliver.c index d01d8bbb86e..b07f4fd4b2b 100644 --- a/arch/xtensa/src/common/xtensa_sigdeliver.c +++ b/arch/xtensa/src/common/xtensa_sigdeliver.c @@ -56,13 +56,6 @@ void xtensa_sig_deliver(void) struct tcb_s *rtcb = this_task(); uint32_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - #ifdef CONFIG_SMP /* In the SMP case, we must terminate the critical section while the signal * handler executes, but we also need to restore the irqcount when the @@ -138,10 +131,6 @@ void xtensa_sig_deliver(void) up_irq_save(); #endif - /* Restore the saved errno value */ - - set_errno(saved_errno); - /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is * not supported. Therefore, these values will persist throughout the diff --git a/arch/z16/src/common/z16_sigdeliver.c b/arch/z16/src/common/z16_sigdeliver.c index 28bb314bdbb..68e17b0afdb 100644 --- a/arch/z16/src/common/z16_sigdeliver.c +++ b/arch/z16/src/common/z16_sigdeliver.c @@ -57,13 +57,6 @@ void z16_sigdeliver(void) chipreg_t regs[XCPTCONTEXT_REGS]; FAR uint32_t *regs32 = (FAR uint32_t *)regs; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -93,7 +86,6 @@ void z16_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/z80/src/ez80/ez80_sigdeliver.c b/arch/z80/src/ez80/ez80_sigdeliver.c index 72e51fc3746..cff88ad2e3a 100644 --- a/arch/z80/src/ez80/ez80_sigdeliver.c +++ b/arch/z80/src/ez80/ez80_sigdeliver.c @@ -58,13 +58,6 @@ void z80_sigdeliver(void) FAR struct tcb_s *rtcb = this_task(); chipreg_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -94,7 +87,6 @@ void z80_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/z80/src/z180/z180_sigdeliver.c b/arch/z80/src/z180/z180_sigdeliver.c index 9045ec35564..10979e65154 100644 --- a/arch/z80/src/z180/z180_sigdeliver.c +++ b/arch/z80/src/z180/z180_sigdeliver.c @@ -55,13 +55,6 @@ void z80_sigdeliver(void) FAR struct tcb_s *rtcb = this_task(); chipreg_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -91,7 +84,6 @@ void z80_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/z80/src/z8/z8_sigdeliver.c b/arch/z80/src/z8/z8_sigdeliver.c index 5f72af98996..3c93c08536b 100644 --- a/arch/z80/src/z8/z8_sigdeliver.c +++ b/arch/z80/src/z8/z8_sigdeliver.c @@ -74,13 +74,6 @@ void z80_sigdeliver(void) FAR struct tcb_s *rtcb = this_task(); chipreg_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -110,7 +103,6 @@ void z80_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/arch/z80/src/z80/z80_sigdeliver.c b/arch/z80/src/z80/z80_sigdeliver.c index 1ecf020852c..3d793cadc7d 100644 --- a/arch/z80/src/z80/z80_sigdeliver.c +++ b/arch/z80/src/z80/z80_sigdeliver.c @@ -55,13 +55,6 @@ void z80_sigdeliver(void) FAR struct tcb_s *rtcb = this_task(); chipreg_t regs[XCPTCONTEXT_REGS]; - /* Save the errno. This must be preserved throughout the signal handling - * so that the user code final gets the correct errno value (probably - * EINTR). - */ - - int saved_errno = get_errno(); - board_autoled_on(LED_SIGNAL); sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", @@ -91,7 +84,6 @@ void z80_sigdeliver(void) sinfo("Resuming\n"); up_irq_save(); - set_errno(saved_errno); /* Modify the saved return state with the actual saved values in the * TCB. This depends on the fact that nested signal handling is diff --git a/sched/signal/sig_deliver.c b/sched/signal/sig_deliver.c index d0739f97dcb..9a72ed64d68 100644 --- a/sched/signal/sig_deliver.c +++ b/sched/signal/sig_deliver.c @@ -51,6 +51,14 @@ void nxsig_deliver(FAR struct tcb_s *stcb) { + /* Save the errno. This must be preserved throughout the signal handling + * so that the user code final gets the correct errno value (probably + * EINTR). + */ + + int saved_errno = get_errno(); + int16_t saved_errcode = stcb->errcode; + FAR sigq_t *sigq; sigset_t savesigprocmask; sigset_t newsigprocmask; @@ -194,4 +202,9 @@ void nxsig_deliver(FAR struct tcb_s *stcb) nxsig_release_pendingsigaction(sigq); } + + /* Restore the saved errno value */ + + set_errno(saved_errno); + stcb->errcode = saved_errcode; }