You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/05/07 22:11:44 UTC
[incubator-nuttx] branch errno updated: Completes the
Implementation of the TLS-based errno
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch errno
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/errno by this push:
new 3dca5eb Completes the Implementation of the TLS-based errno
3dca5eb is described below
commit 3dca5eba1598780cb4945d027c679b03b994880c
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Thu May 7 14:15:09 2020 -0600
Completes the Implementation of the TLS-based errno
- Remove per-thread errno from the TCB structure (pterrno)
- Remove get_errno() and set_errno() as functions. The macros are still available as stubs and will be needed in the future if we need to access the errno from a different address environment (KERNEL mode).
- Add errno value to the tls_info_s structure definitions
- Move sched/errno to libs/libc/errno. Replace old TCB access to the errno with TLS access to the errno.
---
TODO | 6 +-
arch/arm/src/arm/arm_sigdeliver.c | 44 +++----
arch/arm/src/armv6-m/arm_sigdeliver.c | 4 +-
arch/arm/src/armv7-a/arm_sigdeliver.c | 44 +++----
arch/arm/src/armv7-m/arm_sigdeliver.c | 4 +-
arch/arm/src/armv7-r/arm_sigdeliver.c | 43 +++----
arch/arm/src/armv8-m/arm_sigdeliver.c | 4 +-
arch/avr/src/avr/up_sigdeliver.c | 63 ++++------
arch/avr/src/avr32/up_sigdeliver.c | 65 ++++------
arch/mips/src/mips32/mips_sigdeliver.c | 43 +++----
arch/misoc/src/lm32/lm32_sigdeliver.c | 46 +++-----
arch/misoc/src/minerva/minerva_sigdeliver.c | 54 ++++-----
arch/renesas/src/m16c/m16c_sigdeliver.c | 44 +++----
arch/renesas/src/rx65n/rx65n_sigdeliver.c | 4 +-
arch/renesas/src/sh1/sh1_sigdeliver.c | 44 +++----
arch/risc-v/src/rv32im/riscv_sigdeliver.c | 4 +-
arch/risc-v/src/rv64gc/riscv_sigdeliver.c | 4 +-
arch/x86/src/i486/up_sigdeliver.c | 43 +++----
arch/x86_64/src/intel64/up_sigdeliver.c | 4 +-
arch/xtensa/src/common/xtensa_sigdeliver.c | 43 +++----
arch/z16/src/common/z16_sigdeliver.c | 4 +-
arch/z80/src/ez80/ez80_sigdeliver.c | 4 +-
arch/z80/src/z180/z180_sigdeliver.c | 43 +++----
arch/z80/src/z8/z8_sigdeliver.c | 44 +++----
arch/z80/src/z80/z80_sigdeliver.c | 44 +++----
include/errno.h | 131 ++++-----------------
include/nuttx/sched.h | 5 +-
include/nuttx/tls.h | 11 +-
include/sys/syscall_lookup.h | 2 -
libs/libc/Makefile | 40 ++-----
libs/libc/README.txt | 1 +
libs/libc/{tls => errno}/Make.defs | 18 +--
libs/libc/{tls/tls_getinfo.c => errno/lib_errno.c} | 43 ++-----
libs/libc/tls/Kconfig | 5 +-
libs/libc/tls/Make.defs | 3 +-
libs/libc/tls/tls_getinfo.c | 2 -
sched/Makefile | 40 ++-----
sched/errno/Make.defs | 45 -------
sched/errno/errno_errno.c | 118 -------------------
sched/errno/errno_get.c | 76 ------------
sched/errno/errno_set.c | 75 ------------
sched/mqueue/mq_rcvinternal.c | 11 +-
sched/mqueue/mq_sndinternal.c | 11 +-
sched/mqueue/mq_waitirq.c | 4 +-
sched/sched/sched_continue.c | 41 ++-----
sched/sched/sched_suspend.c | 41 ++-----
sched/semaphore/sem_wait.c | 8 +-
sched/semaphore/sem_waitirq.c | 41 ++-----
sched/signal/sig_deliver.c | 58 +++------
syscall/syscall.csv | 2 -
syscall/syscall_funclookup.c | 11 --
51 files changed, 406 insertions(+), 1186 deletions(-)
diff --git a/TODO b/TODO
index ed09fbc..0965b44 100644
--- a/TODO
+++ b/TODO
@@ -177,9 +177,9 @@ o Task/Scheduler (sched/)
Description: In NuttX, the errno value is unique for each thread. But for
bug-for-bug compatibility, the same errno should be shared by
the task and each thread that it creates. It is *very* easy
- to make this change: Just move the pterrno field from
- struct tcb_s to struct task_group_s. However, I am still not
- sure if this should be done or not.
+ to make this change: Just move the tls_errno field from
+ struct tls_info_s to struct task_group_s. However, I am still
+ not sure if this should be done or not.
NOTE: glibc behaves this way unless __thread is defined then,
in that case, it behaves like NuttX (using TLS to save the
thread local errno).
diff --git a/arch/arm/src/arm/arm_sigdeliver.c b/arch/arm/src/arm/arm_sigdeliver.c
index 6d50b06..af9d47e 100644
--- a/arch/arm/src/arm/arm_sigdeliver.c
+++ b/arch/arm/src/arm/arm_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/arm/src/arm/arm_sigdeliver.c
*
- * Copyright (C) 2007-2010, 2015, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -77,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -108,7 +92,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 0d010ea..4fc1fc5 100644
--- a/arch/arm/src/armv6-m/arm_sigdeliver.c
+++ b/arch/arm/src/armv6-m/arm_sigdeliver.c
@@ -81,7 +81,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -112,7 +112,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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/armv7-a/arm_sigdeliver.c b/arch/arm/src/armv7-a/arm_sigdeliver.c
index b0c240e..8ceef66 100644
--- a/arch/arm/src/armv7-a/arm_sigdeliver.c
+++ b/arch/arm/src/armv7-a/arm_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/arm/src/armv7-a/arm_sigdeliver.c
*
- * Copyright (C) 2013, 2015-2016, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -77,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -159,7 +143,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
- rtcb->pterrno = saved_errno;
+ 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/armv7-m/arm_sigdeliver.c b/arch/arm/src/armv7-m/arm_sigdeliver.c
index 3fae5e8..d62743d 100644
--- a/arch/arm/src/armv7-m/arm_sigdeliver.c
+++ b/arch/arm/src/armv7-m/arm_sigdeliver.c
@@ -61,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -147,7 +147,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
- rtcb->pterrno = saved_errno;
+ 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/armv7-r/arm_sigdeliver.c b/arch/arm/src/armv7-r/arm_sigdeliver.c
index 46ef7c6..e361ca3 100644
--- a/arch/arm/src/armv7-r/arm_sigdeliver.c
+++ b/arch/arm/src/armv7-r/arm_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/arm/src/armv7-r/arm_sigdeliver.c
*
- * Copyright (C) 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -76,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +92,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 d0a764f..88b7f71 100755
--- a/arch/arm/src/armv8-m/arm_sigdeliver.c
+++ b/arch/arm/src/armv8-m/arm_sigdeliver.c
@@ -61,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -147,7 +147,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
- rtcb->pterrno = saved_errno;
+ 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/avr/up_sigdeliver.c b/arch/avr/src/avr/up_sigdeliver.c
index 9a14f11..713bbb5 100644
--- a/arch/avr/src/avr/up_sigdeliver.c
+++ b/arch/avr/src/avr/up_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/avr/src/avr/up_sigdeliver.c
*
- * Copyright (C) 2011, 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -72,10 +57,11 @@ void up_sigdeliver(void)
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).
+ * so that the user code final gets the correct errno value (probably
+ * EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -106,7 +92,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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
@@ -130,17 +116,18 @@ void up_sigdeliver(void)
* unusual case that must be handled by up_fullcontextresore. This case is
* unusual in two ways:
*
- * 1. It is not a context switch between threads. Rather, up_fullcontextrestore
- * must behave more it more like a longjmp within the same task, using
- * he same stack.
+ * 1. It is not a context switch between threads. Rather,
+ * up_fullcontextrestore must behave more it more like a longjmp
+ * within the same task, using the same stack.
* 2. In this case, up_fullcontextrestore is called with r12 pointing to
* a register save area on the stack to be destroyed. This is
* dangerous because there is the very real possibility that the new
- * stack pointer might overlap with the register save area and hat stack
- * usage in up_fullcontextrestore might corrupt the register save data
- * before the state is restored. At present, there does not appear to
- * be any stack overlap problems. If there were, then adding 3 words
- * to the size of register save structure size will protect its contents.
+ * stack pointer might overlap with the register save area and that
+ * stack usage in up_fullcontextrestore might corrupt the register
+ * save data before the state is restored. At present, there does
+ * not appear to be any stack overlap problems. If there were, then
+ * adding 3 words to the size of register save structure size will
+ * protect its contents.
*/
board_autoled_off(LED_SIGNAL);
diff --git a/arch/avr/src/avr32/up_sigdeliver.c b/arch/avr/src/avr32/up_sigdeliver.c
index b024e3e..f6681db 100644
--- a/arch/avr/src/avr32/up_sigdeliver.c
+++ b/arch/avr/src/avr32/up_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/avr/src/avr32/up_sigdeliver.c
*
- * Copyright (C) 2010, 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -70,16 +55,17 @@ void up_sigdeliver(void)
{
struct tcb_s *rtcb = this_task();
#if 0
- uint32_t regs[XCPTCONTEXT_REGS+3]; /* Why +3? See below */
+ uint32_t regs[XCPTCONTEXT_REGS + 3]; /* Why +3? See below */
#else
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).
+ * so that the user code final gets the correct errno value (probably
+ * EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -110,7 +96,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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
@@ -130,17 +116,18 @@ void up_sigdeliver(void)
* unusual case that must be handled by up_fullcontextresore. This case is
* unusual in two ways:
*
- * 1. It is not a context switch between threads. Rather, up_fullcontextrestore
- * must behave more it more like a longjmp within the same task, using
- * he same stack.
+ * 1. It is not a context switch between threads. Rather,
+ * up_fullcontextrestore must behave more it more like a longjmp
+ * within the same task, using the same stack.
* 2. In this case, up_fullcontextrestore is called with r12 pointing to
* a register save area on the stack to be destroyed. This is
* dangerous because there is the very real possibility that the new
- * stack pointer might overlap with the register save area and hat stack
- * usage in up_fullcontextrestore might corrupt the register save data
- * before the state is restored. At present, there does not appear to
- * be any stack overlap problems. If there were, then adding 3 words
- * to the size of register save structure size will protect its contents.
+ * stack pointer might overlap with the register save area and that
+ * stack usage in up_fullcontextrestore might corrupt the register
+ * save data before the state is restored. At present, there does
+ * not appear to be any stack overlap problems. If there were, then
+ * adding 3 words to the size of register save structure size will
+ * protect its contents.
*/
board_autoled_off(LED_SIGNAL);
diff --git a/arch/mips/src/mips32/mips_sigdeliver.c b/arch/mips/src/mips32/mips_sigdeliver.c
index 1243736..ddf7477 100644
--- a/arch/mips/src/mips32/mips_sigdeliver.c
+++ b/arch/mips/src/mips32/mips_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/mips/src/mips32/mips_sigdeliver.c
*
- * Copyright (C) 2011, 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -77,7 +62,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -110,7 +95,7 @@ void up_sigdeliver(void)
regs[REG_EPC], regs[REG_STATUS]);
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 f32bdbf..7912a9c 100644
--- a/arch/misoc/src/lm32/lm32_sigdeliver.c
+++ b/arch/misoc/src/lm32/lm32_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_sigdeliver.c
*
- * Copyright (C) 2016, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -76,7 +61,7 @@ void lm32_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -105,10 +90,11 @@ void lm32_sigdeliver(void)
* errno that is needed by the user logic (it is probably EINTR).
*/
- sinfo("Resuming EPC: %08x INT_CTX: %08x\n", regs[REG_EPC], regs[REG_INT_CTX]);
+ sinfo("Resuming EPC: %08x INT_CTX: %08x\n",
+ regs[REG_EPC], regs[REG_INT_CTX]);
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 37c68fb..acf8f28 100644
--- a/arch/misoc/src/minerva/minerva_sigdeliver.c
+++ b/arch/misoc/src/minerva/minerva_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_sigdeliver.c
*
- * Copyright (C) 2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -73,11 +58,12 @@ 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).
+ /* 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 = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -111,16 +97,16 @@ void minerva_sigdeliver(void)
sigdeliver(rtcb);
- /* Output any debug messages BEFORE restoring errno (because they may alter
- * errno), then disable interrupts again and restore the original errno that
- * is needed by the user logic (it is probably EINTR).
+ /* Output any debug messages BEFORE restoring errno (because they may
+ * alter errno), then disable interrupts again and restore the original
+ * errno that is needed by the user logic (it is probably EINTR).
*/
sinfo("Resuming EPC: %08x INT_CTX: %08x\n", regs[REG_CSR_MEPC],
regs[REG_CSR_MSTATUS]);
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 1616f0b..6b2ba26 100644
--- a/arch/renesas/src/m16c/m16c_sigdeliver.c
+++ b/arch/renesas/src/m16c/m16c_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/renesas/src/m16c/m16c_sigdeliver.c
*
- * Copyright (C) 2009-2010, 2015, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -76,7 +60,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +91,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 862f97b..2b288dc 100644
--- a/arch/renesas/src/rx65n/rx65n_sigdeliver.c
+++ b/arch/renesas/src/rx65n/rx65n_sigdeliver.c
@@ -77,7 +77,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -119,7 +119,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 fdb6483..4b5fa6b 100644
--- a/arch/renesas/src/sh1/sh1_sigdeliver.c
+++ b/arch/renesas/src/sh1/sh1_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/renesas/src/common/up_sigdeliver.c
*
- * Copyright (C) 2008-2010, 2015, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -76,7 +60,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +91,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 d1276bc..c1b7ece 100644
--- a/arch/risc-v/src/rv32im/riscv_sigdeliver.c
+++ b/arch/risc-v/src/rv32im/riscv_sigdeliver.c
@@ -82,7 +82,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -115,7 +115,7 @@ void up_sigdeliver(void)
regs[REG_EPC], regs[REG_INT_CTX]);
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 073647e..9f21dcc 100644
--- a/arch/risc-v/src/rv64gc/riscv_sigdeliver.c
+++ b/arch/risc-v/src/rv64gc/riscv_sigdeliver.c
@@ -82,7 +82,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -162,7 +162,7 @@ void up_sigdeliver(void)
/* Restore the saved errno value */
- rtcb->pterrno = saved_errno;
+ 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/src/i486/up_sigdeliver.c b/arch/x86/src/i486/up_sigdeliver.c
index fb6ad54..52e3b5d 100644
--- a/arch/x86/src/i486/up_sigdeliver.c
+++ b/arch/x86/src/i486/up_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/x86/src/i486/up_sigdeliver.c
*
- * Copyright (C) 2011, 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -76,7 +61,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +92,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 dd73178..4275ce3 100644
--- a/arch/x86_64/src/intel64/up_sigdeliver.c
+++ b/arch/x86_64/src/intel64/up_sigdeliver.c
@@ -81,7 +81,7 @@ void up_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ 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
@@ -122,7 +122,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
(void)up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 6a00b96..3bc3998 100644
--- a/arch/xtensa/src/common/xtensa_sigdeliver.c
+++ b/arch/xtensa/src/common/xtensa_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_sigdeliver.c
*
- * Copyright (C) 2016, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -75,7 +60,7 @@ void xtensa_sig_deliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -154,7 +139,7 @@ void xtensa_sig_deliver(void)
/* Restore the saved errno value */
- rtcb->pterrno = saved_errno;
+ 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/z16/src/common/z16_sigdeliver.c b/arch/z16/src/common/z16_sigdeliver.c
index 4ca8254..2a91f25 100644
--- a/arch/z16/src/common/z16_sigdeliver.c
+++ b/arch/z16/src/common/z16_sigdeliver.c
@@ -61,7 +61,7 @@ void z16_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -92,7 +92,7 @@ void z16_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 dc553ca..4f203a1 100644
--- a/arch/z80/src/ez80/ez80_sigdeliver.c
+++ b/arch/z80/src/ez80/ez80_sigdeliver.c
@@ -62,7 +62,7 @@ void z80_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -93,7 +93,7 @@ void z80_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 678d8c6..529d698 100644
--- a/arch/z80/src/z180/z180_sigdeliver.c
+++ b/arch/z80/src/z180/z180_sigdeliver.c
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/z80/src/z180/z180_sigdeliver.c
*
- * Copyright (C) 2012, 2015, 2018-2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -74,7 +59,7 @@ void z80_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -105,7 +90,7 @@ void z80_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 9e40e2c..1b01f24 100644
--- a/arch/z80/src/z8/z8_sigdeliver.c
+++ b/arch/z80/src/z8/z8_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/z80/src/z8/z8_sigdeliver.c
*
- * Copyright (C) 2008-2010, 2015, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -94,7 +78,7 @@ void z80_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -125,7 +109,7 @@ void z80_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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 3be2b53..d3574c3 100644
--- a/arch/z80/src/z80/z80_sigdeliver.c
+++ b/arch/z80/src/z80/z80_sigdeliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/z80/src/z80/z80_sigdeliver.c
*
- * Copyright (C) 2007-2010, 2015, 2018-2019 Gregory Nutt. All rights
- * reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -75,7 +59,7 @@ void z80_sigdeliver(void)
* EINTR).
*/
- int saved_errno = rtcb->pterrno;
+ int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -106,7 +90,7 @@ void z80_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
- rtcb->pterrno = saved_errno;
+ 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/include/errno.h b/include/errno.h
index 76a1bc4..9caf44d 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -1,35 +1,20 @@
/****************************************************************************
* include/errno.h
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -46,74 +31,21 @@
* Pre-processor Definitions
****************************************************************************/
-/* How can we access the errno variable? */
-
-#ifdef CONFIG_BUILD_FLAT
- /* Flat build */
-
-# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
- /* We still might be using system calls in user code. If so, then
- * user code will have no direct access to the errno variable.
- */
-
-# undef __DIRECT_ERRNO_ACCESS
-
-# else
- /* Flat build with no system calls OR internal kernel logic... There
- * is direct access.
- */
-
-# define __DIRECT_ERRNO_ACCESS 1
-# endif
-
-#else
-# if defined(__KERNEL__)
- /* Kernel portion of protected/kernel build. Kernel code has direct
- * access
- */
-
-# define __DIRECT_ERRNO_ACCESS 1
-
-# else
- /* User portion of protected/kernel build. Application code has only
- * indirect access
- */
-
-# undef __DIRECT_ERRNO_ACCESS
-# endif
-#endif
-
-/* Convenience/compatibility definition.
- *
- * For a flat, all kernel-mode build, the error can be read and written
- * from all code using a simple pointer.
+/* Convenience/compatibility definition. If the errno is accessed from the
+ * internal OS code, then the OS code should use the set_errno() and
+ * get_errno(). Currently, those are just placeholders but would be needed
+ * in the KERNEL mode build in order to instantiate the process address
+ * environment as necessary to access the TLS-based errno variable.
*/
-#ifdef __DIRECT_ERRNO_ACCESS
-
-# define errno *__errno()
-# define set_errno(e) do { errno = (int)(e); } while (0)
-# define get_errno() errno
-
-#else
-
-/* We doing separate user-/kernel-mode builds, then the errno has to be
- * a little differently. In kernel-mode, the TCB errno value can still be
- * read and written using a pointer from code executing within the
- * kernel.
- *
- * But in user-mode, the errno can only be read using the name 'errno'.
- * The non-standard API set_errno() must explicitly be used from user-
- * mode code in order to set the errno value.
- *
- * The same is true of the case where we have syscalls enabled but this
- * is not a kernel build, then we really have no option but to use the
- * set_errno() accessor function explicitly, even from OS logic!
- */
-
-# define errno get_errno()
-
-#endif /* __DIRECT_ERRNO_ACCESS */
+#define errno *__errno()
+#define set_errno(e) \
+ do \
+ { \
+ errno = (int)(e); \
+ } \
+ while (0)
+#define get_errno() errno
/* Definitions of error numbers and the string that would be
* returned by strerror().
@@ -398,21 +330,10 @@ extern "C"
#define EXTERN extern
#endif
-/* Return a pointer to the thread specific errno. NOTE: When doing a
- * kernel-/user-mode build, this function can only be used within the
- * kernel-mode space.
- *
- * In the user-mode space, set_errno() and get_errno() are always available,
- * either as macros or via syscalls.
- */
+/* Return a pointer to the thread specific errno. */
FAR int *__errno(void);
-#ifndef __DIRECT_ERRNO_ACCESS
-void set_errno(int errcode);
-int get_errno(void);
-#endif
-
#undef EXTERN
#if defined(__cplusplus)
}
diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index cc63e7c..37a40f8 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -648,6 +648,7 @@ struct tcb_s
#ifdef CONFIG_CANCELLATION_POINTS
int16_t cpcount; /* Nested cancellation point count */
#endif
+ int16_t errcode; /* Used to pass error information */
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
int32_t timeslice; /* RR timeslice OR Sporadic budget */
@@ -708,10 +709,6 @@ struct tcb_s
uint32_t crit_max; /* Max time in critical section */
#endif
- /* Library related fields *****************************************************/
-
- int pterrno; /* Current per-thread errno */
-
/* State save areas ***********************************************************/
/* The form and content of these fields are platform-specific. */
diff --git a/include/nuttx/tls.h b/include/nuttx/tls.h
index fb085ba..7323a67 100644
--- a/include/nuttx/tls.h
+++ b/include/nuttx/tls.h
@@ -43,13 +43,7 @@
#ifndef CONFIG_TLS_NELEM
# warning CONFIG_TLS_NELEM is not defined
-# define CONFIG_TLS_NELEM 1
-#endif
-
-#if CONFIG_TLS_NELEM < 1
-# error CONFIG_TLS_NELEM must be at least one
-# undef CONFIG_TLS_NELEM
-# define CONFIG_TLS_NELEM 1
+# define CONFIG_TLS_NELEM 0
#endif
/* TLS Definitions **********************************************************/
@@ -81,7 +75,10 @@
struct tls_info_s
{
+#if CONFIG_TLS_NELEM > 0
uintptr_t tl_elem[CONFIG_TLS_NELEM]; /* TLS elements */
+#endif
+ int tl_errno; /* Per-thread error number */
};
/****************************************************************************
diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h
index 851cae2..13ec919 100644
--- a/include/sys/syscall_lookup.h
+++ b/include/sys/syscall_lookup.h
@@ -26,7 +26,6 @@
SYSCALL_LOOKUP1(_exit, 1)
SYSCALL_LOOKUP(exit, 1)
-SYSCALL_LOOKUP(get_errno, 0)
SYSCALL_LOOKUP(getpid, 0)
SYSCALL_LOOKUP(sched_getparam, 2)
@@ -46,7 +45,6 @@ SYSCALL_LOOKUP(sched_get_stackinfo, 2)
SYSCALL_LOOKUP(sched_setaffinity, 3)
#endif
-SYSCALL_LOOKUP(set_errno, 1)
SYSCALL_LOOKUP(uname, 1)
SYSCALL_LOOKUP(sethostname, 2)
diff --git a/libs/libc/Makefile b/libs/libc/Makefile
index 56a677b..ee26f12 100644
--- a/libs/libc/Makefile
+++ b/libs/libc/Makefile
@@ -1,35 +1,20 @@
############################################################################
# libs/libc/Makefile
#
-# Copyright (C) 2007-2014, 2016-2017, 2019 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <gn...@nuttx.org>
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
#
###########################################################################
@@ -49,6 +34,7 @@ include builtin/Make.defs
include dirent/Make.defs
include dlfcn/Make.defs
include endian/Make.defs
+include errno/Make.defs
include fixedmath/Make.defs
include grp/Make.defs
include hex2bin/Make.defs
diff --git a/libs/libc/README.txt b/libs/libc/README.txt
index 5c43c90..e7c12d9 100644
--- a/libs/libc/README.txt
+++ b/libs/libc/README.txt
@@ -32,6 +32,7 @@ we have:
builtin - Support for builtin applications. Used by nuttx/binfmt and NSH.
dlfcn - dlfcn.h
endian - endian.h
+ errno - errno.h
hex2bin - hex2bin.h
libgen - libgen.h
locale - locale.h
diff --git a/libs/libc/tls/Make.defs b/libs/libc/errno/Make.defs
similarity index 80%
copy from libs/libc/tls/Make.defs
copy to libs/libc/errno/Make.defs
index 934bcfa..405fe2c 100644
--- a/libs/libc/tls/Make.defs
+++ b/libs/libc/errno/Make.defs
@@ -1,5 +1,5 @@
############################################################################
-# libs/libc/tls/Make.defs
+# libs/libc/errno/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -18,17 +18,9 @@
#
############################################################################
-ifneq ($(CONFIG_TLS_NELEM),0)
+CSRCS += lib_errno.c
-CSRCS += tls_setelem.c tls_getelem.c
+# Include errno build support
-ifneq ($(CONFIG_TLS_ALIGNED),y)
-CSRCS += tls_getinfo.c
-endif
-
-# Include tls build support
-
-DEPPATH += --dep-path tls
-VPATH += :tls
-
-endif
+DEPPATH += --dep-path errno
+VPATH += :errno
diff --git a/libs/libc/tls/tls_getinfo.c b/libs/libc/errno/lib_errno.c
similarity index 61%
copy from libs/libc/tls/tls_getinfo.c
copy to libs/libc/errno/lib_errno.c
index 72f1833..27f67dd 100644
--- a/libs/libc/tls/tls_getinfo.c
+++ b/libs/libc/errno/lib_errno.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/fixedmath/tls_setelem.c
+ * sched/errno/lib_errno.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -24,55 +24,38 @@
#include <nuttx/config.h>
-#include <stdint.h>
-#include <assert.h>
+#include <sched.h>
+#include <errno.h>
-#include <nuttx/arch.h>
-#include <nuttx/tls.h>
#include <arch/tls.h>
-#ifndef CONFIG_TLS_ALIGNED
-
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
- * Name: tls_get_info
+ * Name: __errno
*
* Description:
- * Return a reference to the tls_info_s structure. This is used as part
- * of the internal implementation of tls_get/set_elem() and ONLY for the
- * where CONFIG_TLS_ALIGNED is *not* defined
+ * Return a pointer to the thread specific errno.
*
* Input Parameters:
* None
*
* Returned Value:
- * A reference to the thread-specific tls_info_s structure is return on
- * success. NULL would be returned in the event of any failure.
+ * A pointer to the per-thread errno variable.
+ *
+ * Assumptions:
*
****************************************************************************/
-FAR struct tls_info_s *tls_get_info(void)
+FAR int *__errno(void)
{
- FAR struct tls_info_s *info = NULL;
- struct stackinfo_s stackinfo;
- int ret;
+ /* Get the TLS tls_info_s structure instance for this thread */
- DEBUGASSERT(!up_interrupt_context());
+ FAR struct tls_info_s *tlsinfo = up_tls_info();
- ret = sched_get_stackinfo(0, &stackinfo);
- if (ret >= 0)
- {
- /* This currently assumes a push-down stack. The TLS data lies at the
- * lowest address of the stack allocation.
- */
+ /* And return the return refernce to the error number */
- info = (FAR struct tls_info_s *)stackinfo.stack_alloc_ptr;
- }
-
- return info;
+ return &tlsinfo->tl_errno;
}
-
-#endif /* !CONFIG_TLS_ALIGNED */
diff --git a/libs/libc/tls/Kconfig b/libs/libc/tls/Kconfig
index 40a5180..b14abc4 100644
--- a/libs/libc/tls/Kconfig
+++ b/libs/libc/tls/Kconfig
@@ -45,9 +45,12 @@ config TLS_LOG2_MAXSTACK
config TLS_NELEM
int "Number of TLS elements"
- default 1
+ default 0
---help---
The number of unique TLS elements. These can be accessed with
the user library functions tls_get_element() and tls_set_element().
+ NOTE that the special value of CONFIG_TLS_NELEM disables these
+ TLS interfaces.
+
endmenu # Thread Local Storage (TLS)
diff --git a/libs/libc/tls/Make.defs b/libs/libc/tls/Make.defs
index 934bcfa..01fd70e 100644
--- a/libs/libc/tls/Make.defs
+++ b/libs/libc/tls/Make.defs
@@ -19,8 +19,8 @@
############################################################################
ifneq ($(CONFIG_TLS_NELEM),0)
-
CSRCS += tls_setelem.c tls_getelem.c
+endif
ifneq ($(CONFIG_TLS_ALIGNED),y)
CSRCS += tls_getinfo.c
@@ -31,4 +31,3 @@ endif
DEPPATH += --dep-path tls
VPATH += :tls
-endif
diff --git a/libs/libc/tls/tls_getinfo.c b/libs/libc/tls/tls_getinfo.c
index 72f1833..79a9070 100644
--- a/libs/libc/tls/tls_getinfo.c
+++ b/libs/libc/tls/tls_getinfo.c
@@ -60,8 +60,6 @@ FAR struct tls_info_s *tls_get_info(void)
struct stackinfo_s stackinfo;
int ret;
- DEBUGASSERT(!up_interrupt_context());
-
ret = sched_get_stackinfo(0, &stackinfo);
if (ret >= 0)
{
diff --git a/sched/Makefile b/sched/Makefile
index 63d1c51..f3543dd 100644
--- a/sched/Makefile
+++ b/sched/Makefile
@@ -1,35 +1,20 @@
############################################################################
# sched/Makefile
#
-# Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <gn...@nuttx.org>
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
#
############################################################################
@@ -42,7 +27,6 @@ VPATH =
DEPPATH = --dep-path .
include clock/Make.defs
-include errno/Make.defs
include environ/Make.defs
include group/Make.defs
include init/Make.defs
diff --git a/sched/errno/Make.defs b/sched/errno/Make.defs
deleted file mode 100644
index 6c51ee2..0000000
--- a/sched/errno/Make.defs
+++ /dev/null
@@ -1,45 +0,0 @@
-############################################################################
-# sched/errno/Make.defs
-#
-# Copyright (C) 2014 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <gn...@nuttx.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-############################################################################
-
-CSRCS += errno_errno.c
-
-ifeq ($(CONFIG_LIB_SYSCALL),y)
-CSRCS += errno_get.c errno_set.c
-endif
-
-# Include errno build support
-
-DEPPATH += --dep-path errno
-VPATH += :errno
diff --git a/sched/errno/errno_errno.c b/sched/errno/errno_errno.c
deleted file mode 100644
index a262b5b..0000000
--- a/sched/errno/errno_errno.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
- * sched/errno/errno_errno.c
- *
- * Copyright (C) 2007, 2008, 2011, 2014 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <sched.h>
-#include <errno.h>
-#include <nuttx/arch.h>
-#include "sched/sched.h"
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/* This is a 'dummy' errno value to use in context where there is no valid
- * errno location to use. For example, when running from an interrupt handler
- * or early in initialization when task structures have not yet been
- * initialized.
- */
-
-static int g_irqerrno;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: __errno
- *
- * Description:
- * Return a pointer to the thread specific errno.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * A pointer to the per-thread errno variable.
- *
- * Assumptions:
- *
- ****************************************************************************/
-
-FAR int *__errno(void)
-{
- /* Check if this function was called from an interrupt handler. In that
- * case, we have to do things a little differently to prevent the interrupt
- * handler from modifying the tasks errno value.
- */
-
- if (!up_interrupt_context())
- {
- /* We were called from the normal tasking context. Verify that the
- * task at the head of the ready-to-run list is actually running. It
- * may not be running during very brief times during context switching
- * logic (see, for example, task_exit.c).
- *
- * There is also a corner case early in the initialization sequence:
- * The ready to run list may not yet be initialized and this_task()
- * may be NULL.
- */
-
- FAR struct tcb_s *rtcb = this_task();
- if (rtcb && rtcb->task_state == TSTATE_TASK_RUNNING)
- {
- /* Yes.. the task is running normally. Return a reference to the
- * thread-private errno in the TCB of the running task.
- */
-
- return &rtcb->pterrno;
- }
- }
-
- /* We were called either from (1) an interrupt handler or (2) from normally
- * code but in an unhealthy state. In either event, do not permit access to
- * the errno in the TCB of the task at the head of the ready-to-run list.
- * Instead, use a separate errno just for interrupt handlers. Of course,
- * this would have to change if we ever wanted to support nested interrupts
- * or if we really cared about the stability of the errno during those
- * "unhealthy states."
- */
-
- return &g_irqerrno;
-}
diff --git a/sched/errno/errno_get.c b/sched/errno/errno_get.c
deleted file mode 100644
index 2d91497..0000000
--- a/sched/errno/errno_get.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
- * sched/errno/errno_get.c
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#undef get_errno
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: get_errno
- *
- * Description:
- * Return the value of the thread specific errno. This function is only
- * intended to provide a mechanism for user-mode programs to get the
- * thread-specific errno value. It is #define'd to the symbol errno in
- * include/errno.h.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * The current value of the thread specific errno.
- *
- * Assumptions:
- *
- ****************************************************************************/
-
-int get_errno(void)
-{
- return *__errno();
-}
diff --git a/sched/errno/errno_set.c b/sched/errno/errno_set.c
deleted file mode 100644
index 2eada24..0000000
--- a/sched/errno/errno_set.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
- * sched/errno/errno_set.c
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#undef set_errno
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: set_errno
- *
- * Description:
- * Set the value of the thread specific errno. This function is only
- * intended to provide a mechanism for user-mode programs to set the
- * thread-specific errno value.
- *
- * Input Parameters:
- * errcode - The thread specific errno will be set to this value.
- *
- * Returned Value:
- * None
- *
- * Assumptions:
- *
- ****************************************************************************/
-
-void set_errno(int errcode)
-{
- *__errno() = errcode;
-}
diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c
index 4808bef..8749a85 100644
--- a/sched/mqueue/mq_rcvinternal.c
+++ b/sched/mqueue/mq_rcvinternal.c
@@ -157,20 +157,17 @@ int nxmq_wait_receive(mqd_t mqdes, FAR struct mqueue_msg_s **rcvmsg)
if ((mqdes->oflags & O_NONBLOCK) == 0)
{
- int saved_errno;
-
/* Yes.. Block and try again */
rtcb = this_task();
rtcb->msgwaitq = msgq;
msgq->nwaitnotempty++;
- /* "Borrow" the per-task errno to communication wake-up error
+ /* Initialize the 'errcode" used to communication wake-up error
* conditions.
*/
- saved_errno = rtcb->pterrno;
- rtcb->pterrno = OK;
+ rtcb->errcode = OK;
/* Make sure this is not the idle task, descheduling that
* isn't going to end well.
@@ -185,9 +182,7 @@ int nxmq_wait_receive(mqd_t mqdes, FAR struct mqueue_msg_s **rcvmsg)
* errno value (should be either EINTR or ETIMEDOUT).
*/
- ret = rtcb->pterrno;
- rtcb->pterrno = saved_errno;
-
+ ret = rtcb->errcode;
if (ret != OK)
{
return -ret;
diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c
index 0c0e84f..06c5ff1 100644
--- a/sched/mqueue/mq_sndinternal.c
+++ b/sched/mqueue/mq_sndinternal.c
@@ -260,8 +260,6 @@ int nxmq_wait_send(mqd_t mqdes)
while (msgq->nmsgs >= msgq->maxmsgs)
{
- int saved_errno;
-
/* Block until the message queue is no longer full.
* When we are unblocked, we will try again
*/
@@ -270,12 +268,11 @@ int nxmq_wait_send(mqd_t mqdes)
rtcb->msgwaitq = msgq;
msgq->nwaitnotfull++;
- /* "Borrow" the per-task errno to communication wake-up error
+ /* Initialize the errcode used to communication wake-up error
* conditions.
*/
- saved_errno = rtcb->pterrno;
- rtcb->pterrno = OK;
+ rtcb->errcode = OK;
/* Make sure this is not the idle task, descheduling that
* isn't going to end well.
@@ -290,9 +287,7 @@ int nxmq_wait_send(mqd_t mqdes)
* per-task errno value (should be EINTR or ETIMEOUT).
*/
- ret = rtcb->pterrno;
- rtcb->pterrno = saved_errno;
-
+ ret = rtcb->errcode;
if (ret != OK)
{
return -ret;
diff --git a/sched/mqueue/mq_waitirq.c b/sched/mqueue/mq_waitirq.c
index 0fb1103..8582cc7 100644
--- a/sched/mqueue/mq_waitirq.c
+++ b/sched/mqueue/mq_waitirq.c
@@ -97,9 +97,9 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode)
msgq->nwaitnotfull--;
}
- /* Mark the errno value for the thread. */
+ /* Mark the error value for the thread. */
- wtcb->pterrno = errcode;
+ wtcb->errcode = errcode;
/* Restart the task. */
diff --git a/sched/sched/sched_continue.c b/sched/sched/sched_continue.c
index 495b0e6..ba2ca76 100644
--- a/sched/sched/sched_continue.c
+++ b/sched/sched/sched_continue.c
@@ -1,35 +1,20 @@
/****************************************************************************
* sched/sched/sched_continue.c
*
- * Copyright (C) 2018 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -71,7 +56,7 @@ void sched_continue(FAR struct tcb_s *tcb)
flags = enter_critical_section();
/* Simply restart the thread. If is was blocked before, it will awaken
- * with pterrno = EINTR and will appears as if it were awakened by a
+ * with errcode = EINTR and will appears as if it were awakened by a
* signal. If pre-emption is not disabled this action could block this
* task here!
*/
diff --git a/sched/sched/sched_suspend.c b/sched/sched/sched_suspend.c
index e38c2cd..e24b1fc 100644
--- a/sched/sched/sched_suspend.c
+++ b/sched/sched/sched_suspend.c
@@ -1,35 +1,20 @@
/****************************************************************************
* sched/sched/sched_suspend.c
*
- * Copyright (C) 2018 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -84,7 +69,7 @@ void sched_suspend(FAR struct tcb_s *tcb)
* the block state by a signal.
*/
- tcb->pterrno = EINTR;
+ tcb->errcode = EINTR;
/* Move the TCB to the g_stoppedtasks list. */
diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c
index 0150963..91811d8 100644
--- a/sched/semaphore/sem_wait.c
+++ b/sched/semaphore/sem_wait.c
@@ -106,8 +106,6 @@ int nxsem_wait(FAR sem_t *sem)
else
{
- int saved_errno;
-
/* First, verify that the task is not already waiting on a
* semaphore
*/
@@ -144,8 +142,7 @@ int nxsem_wait(FAR sem_t *sem)
* between sem_waitirq() and this functions.
*/
- saved_errno = rtcb->pterrno;
- rtcb->pterrno = OK;
+ rtcb->errcode = OK;
/* Add the TCB to the prioritized semaphore wait queue, after
* checking this is not the idle task - descheduling that
@@ -185,8 +182,7 @@ int nxsem_wait(FAR sem_t *sem)
* thread was restarted.
*/
- ret = rtcb->pterrno != OK ? -rtcb->pterrno : OK;
- rtcb->pterrno = saved_errno;
+ ret = rtcb->errcode != OK ? -rtcb->errcode : OK;
#ifdef CONFIG_PRIORITY_INHERITANCE
sched_unlock();
diff --git a/sched/semaphore/sem_waitirq.c b/sched/semaphore/sem_waitirq.c
index af29167..2dfaf2e 100644
--- a/sched/semaphore/sem_waitirq.c
+++ b/sched/semaphore/sem_waitirq.c
@@ -1,35 +1,20 @@
/****************************************************************************
* sched/semaphore/sem_waitirq.c
*
- * Copyright (C) 2007-2010, 2014, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -117,7 +102,7 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
/* Mark the errno value for the thread. */
- wtcb->pterrno = errcode;
+ wtcb->errcode = errcode;
/* Restart the task. */
diff --git a/sched/signal/sig_deliver.c b/sched/signal/sig_deliver.c
index 599c539..d8b894e 100644
--- a/sched/signal/sig_deliver.c
+++ b/sched/signal/sig_deliver.c
@@ -1,36 +1,20 @@
/****************************************************************************
* sched/signal/sig_deliver.c
*
- * Copyright (C) 2007, 2008, 2012-2013, 2016, 2019 Gregory Nutt. All
- * rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
*
****************************************************************************/
@@ -72,7 +56,6 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
sigset_t newsigprocmask;
sigset_t altsigprocmask;
irqstate_t flags;
- int saved_errno;
/* Loop while there are signals to be delivered */
@@ -116,15 +99,6 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
sq_addlast((FAR sq_entry_t *)sigq, &(stcb->sigpostedq));
- /* Save the thread errno. When we finished dispatching the
- * signal actions and resume the task, the errno value must
- * be unchanged by the operation of the signal handling. In
- * particular, the EINTR indication that says that the task
- * was reawakened by a signal must be retained.
- */
-
- saved_errno = stcb->pterrno;
-
/* Save a copy of the old sigprocmask and install the new
* (temporary) sigprocmask. The new sigprocmask is the union
* of the current sigprocmask and the sa_mask for the signal being
@@ -192,11 +166,9 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
flags = enter_critical_section();
stcb->flags &= ~TCB_FLAG_SIGNAL_ACTION;
- /* Restore the original errno value and sigprocmask. */
-
- stcb->pterrno = saved_errno;
-
- /* What if the signal handler changed the sigprocmask? Try to retain
+ /* Restore the original sigprocmask.
+ *
+ * What if the signal handler changed the sigprocmask? Try to retain
* any such changes here.
*
* REVISIT: This logic is imperfect. It will fail to detect bits set
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index ed9749f..b285599 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -28,7 +28,6 @@
"fstatfs","sys/statfs.h","","int","int","FAR struct statfs *"
"fsync","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
"ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t"
-"get_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","int"
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR const char *"
"getgid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","gid_t"
"getitimer","sys/time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","int","FAR struct itimerval *"
@@ -143,7 +142,6 @@
"send","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR const void *","size_t","int"
"sendfile","sys/sendfile.h","defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t *","size_t"
"sendto","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR const void *","size_t","int","FAR const struct sockaddr *","socklen_t"
-"set_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","void","int"
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *","FAR const char *","int"
"setgid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","int","gid_t"
"sethostname","unistd.h","","int","FAR const char *","size_t"
diff --git a/syscall/syscall_funclookup.c b/syscall/syscall_funclookup.c
index d5e10fa..fea7879 100644
--- a/syscall/syscall_funclookup.c
+++ b/syscall/syscall_funclookup.c
@@ -95,17 +95,6 @@
* Pre-processor Definitions
****************************************************************************/
-/* Errno access is awkward. We need to generate get_errno() and set_errno()
- * interfaces to support the system calls, even though we don't use them
- * ourself.
- *
- * The "normal" pre-processor definitions for these functions is in errno.h
- * but we need the internal function prototypes in nuttx/errno.h.
- */
-
-#undef get_errno
-#undef set_errno
-
/****************************************************************************
* Public Data
****************************************************************************/