From 214b5beecedc8425ae45fc8c715a0c75877458f5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 1 Feb 2008 21:23:19 +0000 Subject: errno now defined to be *get_errno_ptr() git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@607 42af7a65-404d-4744-a932-0658087f49c3 --- misc/pascal/nuttx/keywords.h | 1 - nuttx/ChangeLog | 2 ++ nuttx/Documentation/NuttX.html | 3 +- nuttx/arch/arm/src/common/up_sigdeliver.c | 36 +++++++++++------------ nuttx/arch/z16/src/common/up_sigdeliver.c | 4 +-- nuttx/arch/z80/src/common/up_sigdeliver.c | 4 +-- nuttx/examples/nettest/nettest.h | 4 --- nuttx/examples/nsh/nsh.h | 2 -- nuttx/examples/pashello/pashello.h | 2 -- nuttx/examples/udp/udp-internal.h | 8 ++--- nuttx/include/errno.h | 10 +++++-- nuttx/include/nuttx/sched.h | 2 +- nuttx/netutils/dhcpd/dhcpd.c | 5 ++-- nuttx/netutils/uiplib/uip-server.c | 2 -- nuttx/netutils/webserver/httpd.c | 4 +-- nuttx/sched/get_errno_ptr.c | 5 ++-- nuttx/sched/mq_timedreceive.c | 2 +- nuttx/sched/mq_timedsend.c | 2 +- nuttx/sched/mq_waitirq.c | 48 +++++++++++++++--------------- nuttx/sched/os_internal.h | 4 +-- nuttx/sched/sem_waitirq.c | 48 +++++++++++++++--------------- nuttx/sched/sig_deliver.c | 49 ++++++++++++++++--------------- 22 files changed, 120 insertions(+), 127 deletions(-) diff --git a/misc/pascal/nuttx/keywords.h b/misc/pascal/nuttx/keywords.h index e8ad91461..a4316da9e 100644 --- a/misc/pascal/nuttx/keywords.h +++ b/misc/pascal/nuttx/keywords.h @@ -59,6 +59,5 @@ #endif #define TRACE(stream, format, arg...) dbg(format, ##arg) -#define errno *get_errno_ptr() #endif /* __KEYWORDS_H */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 665074ff1..191b5cf21 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -314,4 +314,6 @@ * Added a test case to verify the Pascal P-Code interpreter * Added /dev/zero + * 'errno' is now defined to be *get_errno_ptr() with no name conflicts + diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index b12036faa..60e1857cd 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: January 31, 2008

+

Last Updated: February 1, 2008

@@ -964,6 +964,7 @@ Other memory: * Added a test case to verify the Pascal P-Code interpreter * Added /dev/zero + * 'errno' is now defined to be *get_errno_ptr() with no name conflicts diff --git a/nuttx/arch/arm/src/common/up_sigdeliver.c b/nuttx/arch/arm/src/common/up_sigdeliver.c index 673855144..31d798b93 100644 --- a/nuttx/arch/arm/src/common/up_sigdeliver.c +++ b/nuttx/arch/arm/src/common/up_sigdeliver.c @@ -1,7 +1,7 @@ -/************************************************************ +/**************************************************************************** * common/up_sigdeliver.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include #include @@ -47,23 +47,23 @@ #include "up_internal.h" #include "up_arch.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Funtions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Name: up_sigdeliver * * Description: @@ -72,7 +72,7 @@ * with and forced to branch to this location with interrupts * disabled. * - ************************************************************/ + ****************************************************************************/ void up_sigdeliver(void) { @@ -86,7 +86,7 @@ void up_sigdeliver(void) * the correct errno value (probably EINTR). */ - int saved_errno = rtcb->errno; + int saved_errno = rtcb->pterrno; up_ledon(LED_SIGNAL); @@ -125,7 +125,7 @@ void up_sigdeliver(void) */ dbg("Resuming\n"); - rtcb->errno = saved_errno; + rtcb->pterrno = saved_errno; /* Then restore the correct state for this thread of * execution. diff --git a/nuttx/arch/z16/src/common/up_sigdeliver.c b/nuttx/arch/z16/src/common/up_sigdeliver.c index afc554e85..e6aa6325d 100644 --- a/nuttx/arch/z16/src/common/up_sigdeliver.c +++ b/nuttx/arch/z16/src/common/up_sigdeliver.c @@ -91,7 +91,7 @@ void up_sigdeliver(void) * EINTR). */ - int saved_errno = rtcb->errno; + int saved_errno = rtcb->pterrno; up_ledon(LED_SIGNAL); @@ -131,7 +131,7 @@ void up_sigdeliver(void) */ dbg("Resuming\n"); - rtcb->errno = saved_errno; + rtcb->pterrno = saved_errno; /* Then restore the correct state for this thread of * execution. diff --git a/nuttx/arch/z80/src/common/up_sigdeliver.c b/nuttx/arch/z80/src/common/up_sigdeliver.c index e9ade9964..5f2aab767 100644 --- a/nuttx/arch/z80/src/common/up_sigdeliver.c +++ b/nuttx/arch/z80/src/common/up_sigdeliver.c @@ -90,7 +90,7 @@ void up_sigdeliver(void) * EINTR). */ - int saved_errno = rtcb->errno; + int saved_errno = rtcb->pterrno; up_ledon(LED_SIGNAL); @@ -129,7 +129,7 @@ void up_sigdeliver(void) */ dbg("Resuming\n"); - rtcb->errno = saved_errno; + rtcb->pterrno = saved_errno; /* Then restore the correct state for this thread of * execution. diff --git a/nuttx/examples/nettest/nettest.h b/nuttx/examples/nettest/nettest.h index 4805c8f9a..db84ac495 100644 --- a/nuttx/examples/nettest/nettest.h +++ b/nuttx/examples/nettest/nettest.h @@ -65,10 +65,6 @@ #else - /* Get errno using a pointer */ - -# define errno *get_errno_ptr() - /* Used lib_rawprintf() so that there is not confusion from buffered IO */ # define message(...) lib_rawprintf(__VA_ARGS__) diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index 659a59d17..015c0aa88 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -52,8 +52,6 @@ #define NSH_MAX_ARGUMENTS 6 -#define errno (*get_errno_ptr()) - /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/nuttx/examples/pashello/pashello.h b/nuttx/examples/pashello/pashello.h index 1b544f182..ad206261e 100644 --- a/nuttx/examples/pashello/pashello.h +++ b/nuttx/examples/pashello/pashello.h @@ -44,8 +44,6 @@ * Definitions ****************************************************************************/ -#define errno *get_errno_ptr() - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/nuttx/examples/udp/udp-internal.h b/nuttx/examples/udp/udp-internal.h index ef5a030b7..94fe1e482 100644 --- a/nuttx/examples/udp/udp-internal.h +++ b/nuttx/examples/udp/udp-internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/udp/udp-internal.h * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -63,10 +63,6 @@ #else - /* Get errno using a pointer */ - -# define errno *get_errno_ptr() - /* If debug is enabled, use the synchronous lib_lowprintf so that the * program output does not get disassociated in the debug output. */ diff --git a/nuttx/include/errno.h b/nuttx/include/errno.h index 1291a2cff..1dea0f409 100644 --- a/nuttx/include/errno.h +++ b/nuttx/include/errno.h @@ -1,7 +1,7 @@ /************************************************************************ - * errno.h + * include/errno.h * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -44,6 +44,10 @@ * Definitions ************************************************************************/ +/* Convenience/compatibility definition */ + +#define errno *get_errno_ptr() + /* Definitions of error numbers and the string that would be * returned by strerror(). */ diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index c3cc5d809..87cdc8127 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -238,7 +238,7 @@ struct _TCB /* Library related fields *****************************************************/ - int errno; /* Current per-thread errno */ + int pterrno; /* Current per-thread errno */ /* File system support ********************************************************/ diff --git a/nuttx/netutils/dhcpd/dhcpd.c b/nuttx/netutils/dhcpd/dhcpd.c index 118b991f1..6c41b84a8 100644 --- a/nuttx/netutils/dhcpd/dhcpd.c +++ b/nuttx/netutils/dhcpd/dhcpd.c @@ -1,7 +1,7 @@ /**************************************************************************** * netutils/dhcpd/dhcpd.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -55,7 +55,6 @@ typedef unsigned char boolean; # include # include # include -# define errno *get_errno_ptr() #endif #include diff --git a/nuttx/netutils/uiplib/uip-server.c b/nuttx/netutils/uiplib/uip-server.c index 8baccf33d..38b5e6ae8 100644 --- a/nuttx/netutils/uiplib/uip-server.c +++ b/nuttx/netutils/uiplib/uip-server.c @@ -53,8 +53,6 @@ * Public Functions ****************************************************************************/ -#define errno *get_errno_ptr() - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/nuttx/netutils/webserver/httpd.c b/nuttx/netutils/webserver/httpd.c index 9e37e46aa..e3e155971 100644 --- a/nuttx/netutils/webserver/httpd.c +++ b/nuttx/netutils/webserver/httpd.c @@ -2,7 +2,7 @@ * netutils/webserver/httpd.c * httpd Web server * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This is a leverage of similar logic from uIP: @@ -76,8 +76,6 @@ #define ISO_slash 0x2f #define ISO_colon 0x3a -#define errno *get_errno_ptr() - #undef CONFIG_NETUTILS_HTTPD_DUMPBUFFER #undef CONFIG_NETUTILS_HTTPD_DUMPPSTATE diff --git a/nuttx/sched/get_errno_ptr.c b/nuttx/sched/get_errno_ptr.c index 36598caae..ebf2e105c 100644 --- a/nuttx/sched/get_errno_ptr.c +++ b/nuttx/sched/get_errno_ptr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * get_errno_ptr.c + * sched/get_errno_ptr.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,6 +44,7 @@ #include "os_internal.h" #undef get_errno_ptr +#undef errno /**************************************************************************** * Private Data @@ -93,7 +94,7 @@ FAR int *get_errno_ptr(void) * thread-private errno in the TCB of the running task. */ - return &rtcb->errno; + return &rtcb->pterrno; } } diff --git a/nuttx/sched/mq_timedreceive.c b/nuttx/sched/mq_timedreceive.c index 6f0d93d2b..ca4b4aa85 100644 --- a/nuttx/sched/mq_timedreceive.c +++ b/nuttx/sched/mq_timedreceive.c @@ -112,7 +112,7 @@ static void mq_rcvtimeout(int argc, uint32 pid) { /* Mark the errno value for the thread. */ - wtcb->errno = ETIMEDOUT; + wtcb->pterrno = ETIMEDOUT; /* Restart the the task. */ diff --git a/nuttx/sched/mq_timedsend.c b/nuttx/sched/mq_timedsend.c index 76e3fda5d..012bd2ab0 100644 --- a/nuttx/sched/mq_timedsend.c +++ b/nuttx/sched/mq_timedsend.c @@ -113,7 +113,7 @@ static void mq_sndtimeout(int argc, uint32 pid) { /* Mark the errno value for the thread. */ - wtcb->errno = ETIMEDOUT; + wtcb->pterrno = ETIMEDOUT; /* Restart the the task. */ diff --git a/nuttx/sched/mq_waitirq.c b/nuttx/sched/mq_waitirq.c index be23e5b90..75ecbb08f 100644 --- a/nuttx/sched/mq_waitirq.c +++ b/nuttx/sched/mq_waitirq.c @@ -1,7 +1,7 @@ -/************************************************************ - * mq_waitirq.c +/**************************************************************************** + * sched/mq_waitirq.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include #include @@ -43,35 +43,35 @@ #include #include "sem_internal.h" -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Function: sem_waitirq * * Description: @@ -89,7 +89,7 @@ * * Assumptions: * - ************************************************************/ + ****************************************************************************/ void mq_waitirq(FAR _TCB *wtcb) { @@ -111,7 +111,7 @@ void mq_waitirq(FAR _TCB *wtcb) { /* Mark the errno value for the thread. */ - wtcb->errno = EINTR; + wtcb->pterrno = EINTR; /* Restart the the task. */ diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index e3dffb207..665d05e74 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -105,10 +105,10 @@ enum os_crash_codes_e /* A more efficient ways to access the errno */ #define SET_ERRNO(e) \ - { _TCB *rtcb = _TCB*)g_readytorun.head; rtcb->errno = (e); } + { _TCB *rtcb = _TCB*)g_readytorun.head; rtcb->pterrno = (e); } #define _SET_TCB_ERRNO(t,e) \ - { (t)->errno = (e); } + { (t)->pterrno = (e); } /**************************************************************************** * Public Type Definitions diff --git a/nuttx/sched/sem_waitirq.c b/nuttx/sched/sem_waitirq.c index b7cbdce21..3aded997d 100644 --- a/nuttx/sched/sem_waitirq.c +++ b/nuttx/sched/sem_waitirq.c @@ -1,7 +1,7 @@ -/************************************************************ - * sem_waitirq.c +/**************************************************************************** + * sched/sem_waitirq.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include #include @@ -43,35 +43,35 @@ #include #include "sem_internal.h" -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Function: sem_waitirq * * Description: @@ -90,7 +90,7 @@ * * Assumptions: * - ************************************************************/ + ****************************************************************************/ void sem_waitirq(FAR _TCB *wtcb) { @@ -115,7 +115,7 @@ void sem_waitirq(FAR _TCB *wtcb) /* Mark the errno value for the thread. */ - wtcb->errno = EINTR; + wtcb->pterrno = EINTR; /* Restart the the task. */ diff --git a/nuttx/sched/sig_deliver.c b/nuttx/sched/sig_deliver.c index 0a900c73d..2244ca2fe 100644 --- a/nuttx/sched/sig_deliver.c +++ b/nuttx/sched/sig_deliver.c @@ -1,7 +1,7 @@ -/************************************************************ - * sig_deliver.c +/**************************************************************************** + * sched/sig_deliver.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 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. * @@ -31,11 +31,13 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ + +#include #include #include @@ -43,35 +45,36 @@ #include #include #include + #include "os_internal.h" #include "sem_internal.h" #include "sig_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Function: sig_deliver * * Description: @@ -79,7 +82,7 @@ * the signal receiving task. It processes all queued * signals then returns. * - ************************************************************/ + ****************************************************************************/ void sig_deliver(FAR _TCB *stcb) { @@ -99,7 +102,7 @@ void sig_deliver(FAR _TCB *stcb) * was reawakened by a signal must be retained. */ - saved_errno = stcb->errno; + saved_errno = stcb->pterrno; for (sigq = (FAR sigq_t*)stcb->sigpendactionq.head; (sigq); sigq = next) { next = sigq->flink; @@ -158,7 +161,7 @@ void sig_deliver(FAR _TCB *stcb) sig_releasependingsigaction(sigq); } - stcb->errno = saved_errno; + stcb->pterrno = saved_errno; sched_unlock(); } -- cgit v1.2.3